/**
 * Advanced Listing Search Widget Styles
 * Minimal theme-friendly styling that inherits from the active theme
 */

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

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

/* Search Mode Section */
.search-mode-section {
    margin-bottom: 1em;
}

.search-mode-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5em;
}

.search-mode-radios {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
}

.radio-label input[type="radio"] {
    margin-right: 0.5em;
    margin-top: 0;
}

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

/* Search Input Section */
.search-input-section {
    margin-bottom: 1em;
}

.search-input-container {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 0.75em;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: inherit;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: #0073aa;
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.suggestion-item {
    padding: 0.75em;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 0.9em;
}

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

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

.suggestion-type {
    font-size: 0.8em;
    opacity: 0.7;
    margin-left: auto;
    text-transform: uppercase;
    font-weight: 500;
}

/* Filter Sections */
.basic-filters-section,
.property-fields-section {
    margin-bottom: 1em;
}

.property-fields-section {
    transition: opacity 0.3s ease;
}

.filter-group {
    margin-bottom: 1em;
}

.filter-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5em;
}

.filter-select {
    width: 100%;
    padding: 0.75em;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    box-sizing: border-box;
    font-size: inherit;
    font-family: inherit;
}

.filter-select:focus {
    outline: none;
    border-color: #0073aa;
}

/* Submit Section */
.search-submit-section {
    margin-bottom: 1em;
}

.search-submit-btn {
    width: 100%;
    padding: 0.75em 1em;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: inherit;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    transition: background-color 0.3s ease;
}

.search-submit-btn:hover {
    background: #005a87;
}

.search-submit-btn:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Reset Section */
.search-reset-section {
    text-align: center;
}

.search-reset-link {
    font-size: 0.9em;
    text-decoration: none;
    opacity: 0.8;
}

.search-reset-link:hover {
    text-decoration: underline;
    opacity: 1;
}

/* Loading State */
.search-input.loading {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="none" stroke="%23ccc" stroke-width="2"/><path d="M8 2a6 6 0 0 1 6 6" fill="none" stroke="%230073aa" stroke-width="2"><animateTransform attributeName="transform" type="rotate" from="0 8 8" to="360 8 8" dur="1s" repeatCount="indefinite"/></path></svg>');
    background-repeat: no-repeat;
    background-position: right 0.75em center;
    background-size: 16px 16px;
    padding-right: 2.5em;
}

/* Accessibility improvements */
.radio-label input[type="radio"]:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.search-reset-link:focus {
    outline: 1px dotted;
    outline-offset: 2px;
}

/* Animation for property fields show/hide */
.property-fields-section.hidden {
    opacity: 0;
    pointer-events: none;
}

.property-fields-section.visible {
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-mode-radios {
        flex-direction: column;
        gap: 0.5em;
    }
    
    .radio-label {
        padding: 0.5em 0;
    }
    
    .search-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .search-suggestions {
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .advanced-listing-search-widget {
        margin-bottom: 1em;
    }
    
    .search-mode-section,
    .search-input-section,
    .basic-filters-section,
    .property-fields-section {
        margin-bottom: 0.75em;
    }
    
    .filter-group {
        margin-bottom: 0.75em;
    }
}

/* Theme color inheritance for buttons - fallback if theme doesn't style buttons */
.search-submit-btn {
    background: var(--wp-admin-theme-color, #0073aa);
}

.search-submit-btn:hover {
    background: var(--wp-admin-theme-color-darker-10, #005a87);
}

.search-input:focus,
.filter-select:focus {
    border-color: var(--wp-admin-theme-color, #0073aa);
}

/* Dark mode support - only if theme doesn't handle it */
@media (prefers-color-scheme: dark) {
    .search-suggestions {
        background: #1e1e1e;
        border-color: #444;
        color: #fff;
    }
    
    .suggestion-item {
        border-color: #333;
    }
    
    .suggestion-item:hover,
    .suggestion-item.highlighted {
        background: #333;
    }
} 