/**
 * Search Overlay Component Styles
 * Mobile search panel that appears over content
 * 
 * Usage: Automatically shown on mobile when searching
 */

/* Search Overlay Container */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    opacity: 0;
    transition: opacity 300ms ease-in-out;
    pointer-events: none;  /* No capturar clicks cuando está oculto */
}

.search-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;  /* Permitir clicks cuando está activo */
}

/* Backdrop */
.search-overlay__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* Panel */
.search-overlay__panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-height: 70vh;
    background: #FFFFFF;
    z-index: 2;
    transform: translateY(-100%);
    transition: transform 300ms ease-out;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search-overlay.active .search-overlay__panel {
    transform: translateY(0);
}

/* Header */
.search-overlay__header {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #E5E5E5;
    background: #FFFFFF;
    flex-shrink: 0;
}

.search-overlay__back {
    background: none;
    border: none;
    font-size: 24px;
    color: #333;
    cursor: pointer;
    padding: 5px 10px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-overlay__back:active {
    opacity: 0.6;
}

.search-overlay__input-wrapper {
    flex: 1;
    position: relative;
}

.search-overlay__input {
    width: 100%;
    height: 44px;
    padding: 10px 40px 10px 15px;
    border: 1px solid #D5D9DB;
    border-radius: 8px;
    font-family: 'Raleway', sans-serif;
    font-size: 16px;
    color: #333;
    background: #F5F3F1;
}

.search-overlay__input:focus {
    outline: none;
    border-color: #0096A9;
    background: #FFFFFF;
}

.search-overlay__clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    color: #97928A;
    cursor: pointer;
    padding: 5px;
    display: none;
}

.search-overlay__clear.visible {
    display: block;
}

.search-overlay__clear:active {
    opacity: 0.6;
}

/* Results Container */
.search-overlay__results {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Results Header */
.search-overlay__results-header {
    padding: 15px;
    background: #F5F3F1;
    border-bottom: 1px solid #E5E5E5;
    color: #545859;
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Result Item */
.search-overlay__result-item {
    padding: 15px;
    border-bottom: 1px solid #F5F3F1;
    cursor: pointer;
    transition: background-color 150ms ease;
}

.search-overlay__result-item:active {
    background-color: #F5F3F1;
}

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

/* Result Header */
.search-overlay__result-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.search-overlay__result-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.search-overlay__result-icon--visible {
    color: #0096A9;
}

.search-overlay__result-icon--activatable {
    color: #D7282F;
}

.search-overlay__result-location {
    color: #97928A;
    font-family: 'Raleway', sans-serif;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Result Snippet */
.search-overlay__result-snippet {
    color: #333;
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.search-overlay__result-snippet strong {
    color: #D7282F;
    font-weight: 600;
}

/* Empty State */
.search-overlay__empty {
    padding: 40px 20px;
    text-align: center;
    color: #97928A;
}

.search-overlay__empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.search-overlay__empty-text {
    font-family: 'Raleway', sans-serif;
    font-size: 16px;
    margin: 0;
}

/* Loading State */
.search-overlay__loading {
    padding: 40px 20px;
    text-align: center;
    color: #97928A;
}

.search-overlay__loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 3px solid #F5F3F1;
    border-top-color: #0096A9;
    border-radius: 50%;
    animation: search-spinner 0.8s linear infinite;
}

@keyframes search-spinner {
    to { transform: rotate(360deg); }
}

.search-overlay__loading-text {
    font-family: 'Raleway', sans-serif;
    font-size: 14px;
    margin: 0;
}

/* More Results Indicator */
.search-overlay__more {
    padding: 15px;
    text-align: center;
    background: #F5F3F1;
    color: #545859;
    font-family: 'Raleway', sans-serif;
    font-size: 13px;
    font-weight: 500;
    border-top: 1px solid #E5E5E5;
}

/* Desktop: Hide overlay, use existing dropdown */
@media (min-width: 1001px) {
    .search-overlay {
        display: none !important;
    }
}

/* Mobile: Show overlay */
@media (max-width: 1000px) {
    /* Hide desktop search results panel */
    .search-results-panel {
        display: none !important;
    }
    
    /* Adjust panel height for smaller screens */
    .search-overlay__panel {
        max-height: 80vh;
    }
}

/* Very small screens */
@media (max-width: 400px) {
    .search-overlay__header {
        padding: 12px;
    }
    
    .search-overlay__input {
        height: 40px;
        font-size: 15px;
    }
    
    .search-overlay__result-item {
        padding: 12px;
    }
}
