/**
 * Simplified Listing Search Widget Styles
 * Styled to match Enfold theme patterns
 */

.simplified-listing-search-widget {
    margin-bottom: 1.5em;
}

.simplified-listing-search-form {
    width: 100%;
    max-width: 100%;
}

/* Search Input Row with Button */
.search-input-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: stretch;
    width: 100%;
}

.search-input-container {
    flex: 1;
    position: relative;
    min-width: 0; /* Prevents flex item from overflowing */
    z-index: 1; /* Ensure stacking context */
}

.search-input {
    width: 100%;
    height: 3.2rem; /* Match Enfold button height */
    padding: 0 1rem;
    border: 1px solid #e1e1e1;
    border-radius: 2px; /* Enfold uses subtle rounded corners */
    font-size: 1rem;
    line-height: 1.65;
    background: #ffffff;
    box-sizing: border-box;
    min-width: 200px;
    font-family: inherit; /* Use theme's font family */
    color: #333333;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #719430; /* Theme green color */
    box-shadow: 0 0 3px rgba(113, 148, 48, 0.2);
}

.search-input::placeholder {
    color: #8e8e8e;
    opacity: 1;
}

/* Search Button - Using Enfold button styles */
.search-submit-btn {
    height: 3.2rem; /* Match input height */
    padding: 0 1.25rem; /* Reduced padding for smaller width */
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 150px; /* Increased from 100px */
    max-width: 200px; /* Increased from 120px */
    border-radius: 2px;
    font-size: 0.95rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
    margin: 0; /* Ensure no margin */
}

/* Enfold button color overrides */
.search-submit-btn.avia-color-theme-color {
    background-color: #719430 !important;
    color: #ffffff !important;
}

.search-submit-btn.avia-color-theme-color:hover {
    background-color: #5a7628 !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(113, 148, 48, 0.3);
}

.search-submit-btn .avia_iconbox_title {
    font-weight: 500;
    margin: 0;
    font-size: inherit;
}

/* Listing Type Radio Buttons - Enfold style */
.listing-types-section {
    margin-top: 0.75rem;
    width: 100%;
}

.radio-group {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    align-items: center;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
    font-size: 1rem;
    white-space: nowrap;
    font-weight: 400;
    color: #333333;
    transition: color 0.3s ease;
}

.radio-label:hover {
    color: #719430;
}

.radio-label input[type="radio"] {
    margin-right: 0.6rem;
    margin-top: 0;
    margin-bottom: 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 2px solid #cccccc;
    border-radius: 50%; /* Round for radio buttons */
    background: #ffffff;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.radio-label input[type="radio"]:checked {
    background-color: #719430;
    border-color: #719430;
}

.radio-label input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
}

.radio-label input[type="radio"]:hover {
    border-color: #719430;
}

.radio-label span {
    user-select: none;
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e1e1e1;
    border-top: none;
    border-radius: 0 0 2px 2px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 999999; /* Very high z-index to appear above sliders and other elements */
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.search-suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.95rem;
    color: #333333;
    transition: all 0.2s ease;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
    background: #f8f8f8;
    color: #719430;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .search-input-row {
        flex-direction: column;
        gap: 0.5rem; /* Reduced gap on mobile */
        align-items: stretch;
        margin-bottom: 0.5rem; /* Reduced spacing on mobile */
    }
    
    .search-input {
        min-width: auto;
        height: 3rem;
        font-size: 16px; /* Prevent iOS zoom */
    }
    
    .search-submit-btn {
        height: 3rem;
        padding: 0.8rem 1.5rem;
        width: 100%; /* Full width on mobile */
        min-width: auto !important; /* Override min-width on mobile */
        max-width: none !important; /* Override max-width on mobile */
        font-size: 1rem;
    }
    
    .listing-types-section {
        margin-top: 0.5rem; /* Reduced spacing on mobile */
    }
    
    .radio-group {
        gap: 1.5rem;
        justify-content: flex-start;
    }
    
    .radio-label {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .radio-group {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .radio-label {
        width: 100%;
    }
    
    .search-input {
        font-size: 16px; /* Prevent iOS zoom */
    }
}

/* Theme compatibility overrides - More specific selectors */
.simplified-listing-search-widget .search-input,
.simplified-listing-search-widget input[type="text"],
.simplified-listing-search-widget input[type="search"] {
    height: 3.2rem !important;
    min-height: 3.2rem !important;
    max-height: 3.2rem !important;
    line-height: 1.65 !important;
    padding: 0 1rem !important;
    font-size: 1rem !important;
    border-radius: 2px !important;
    border: 1px solid #e1e1e1 !important;
    background: #ffffff !important;
    box-shadow: none !important;
}

.simplified-listing-search-widget .search-input:focus,
.simplified-listing-search-widget input[type="text"]:focus,
.simplified-listing-search-widget input[type="search"]:focus {
    border-color: #719430 !important;
    box-shadow: 0 0 3px rgba(113, 148, 48, 0.2) !important;
}

.simplified-listing-search-widget .avia-button {
    height: 3.2rem !important;
    min-height: 3.2rem !important;
    max-height: 3.2rem !important;
    line-height: 1.65 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 2px !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    padding: 0 1.25rem !important;
    min-width: 150px !important;
    max-width: 200px !important;
    flex-shrink: 0 !important;
    margin: 0 !important; /* Ensure no margin */
}

@media (max-width: 768px) {
    .simplified-listing-search-widget .search-input,
    .simplified-listing-search-widget input[type="text"],
    .simplified-listing-search-widget input[type="search"] {
        height: 3rem !important;
        min-height: 3rem !important;
        max-height: 3rem !important;
        font-size: 16px !important; /* Prevent iOS zoom */
    }
    
    .simplified-listing-search-widget .avia-button {
        height: 3rem !important;
        min-height: 3rem !important;
        max-height: 3rem !important;
        width: 100% !important;
        min-width: auto !important; /* Override min-width on mobile */
        max-width: none !important; /* Override max-width on mobile */
        font-size: 1rem !important;
        padding: 0.8rem 1.5rem !important;
    }
    
    .simplified-listing-search-widget .search-input-row {
        margin-bottom: 0.5rem !important;
    }
    
    .simplified-listing-search-widget .listing-types-section {
        margin-top: 0.5rem !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .search-suggestions {
        background: #1e1e1e;
        border-color: #444;
        color: #fff;
    }
    
    .suggestion-item {
        border-color: #333;
        color: #fff;
    }
    
    .suggestion-item:hover,
    .suggestion-item.highlighted {
        background: #333;
        color: #8fb859;
    }
}

/* Additional z-index overrides for search suggestions */
.simplified-listing-search-widget .search-suggestions {
    z-index: 999999 !important;
    position: absolute !important;
}

.simplified-listing-search-widget .search-input-container {
    position: relative !important;
    z-index: 1 !important;
} 