/**
 * BFL Smart Search - Search Overlay Styles
 * Meadows Field Airport (BFL)
 * 
 * Colors:
 * - Primary green: #5E782C
 * - Accent line: #D4D34B
 * - Nav trigger: #093547
 */

/* ==========================================================================
   Search Trigger Button (in header)
   ========================================================================== */

.bfl-search-trigger {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0.5rem !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    color: #093547 !important;
    transition: opacity 0.2s ease;
    border-radius: 4px;
    outline: none !important;
}

.bfl-search-trigger svg {
    width: 22px;
    height: 22px;
    display: block;
    color: #093547 !important;
    stroke: #093547 !important;
    fill: none !important;
}

.bfl-search-trigger:hover {
    opacity: 0.7;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.bfl-search-trigger:hover svg {
    color: #093547 !important;
    stroke: #093547 !important;
}

.bfl-search-trigger:focus {
    opacity: 0.7;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: 2px solid #093547 !important;
    outline-offset: 2px;
}

.bfl-search-trigger:focus:not(:focus-visible) {
    outline: none !important;
}

.bfl-search-trigger:focus-visible {
    outline: 2px solid #093547 !important;
    outline-offset: 2px;
}

/* ==========================================================================
   Search Overlay Container
   ========================================================================== */

.bfl-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    pointer-events: none;
}

.bfl-search-overlay[hidden] {
    display: block !important; /* Override browser default for animation */
    visibility: hidden;
}

.bfl-search-overlay:not([hidden]) {
    pointer-events: auto;
    visibility: visible;
}

/* Backdrop */
.bfl-search-overlay__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.25s ease-out;
}

.bfl-search-overlay:not([hidden]) .bfl-search-overlay__backdrop {
    opacity: 1;
}

/* Main container - slides down from top, positioned below header */
.bfl-search-overlay__container {
    position: absolute;
    top: var(--bfl-header-height, 80px);
    left: 0;
    right: 0;
    background: #5E782C;
    transform: translateY(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bfl-search-overlay:not([hidden]) .bfl-search-overlay__container {
    transform: translateY(0);
}

.bfl-search-overlay__inner {
    max-width: 700px;
    margin: 0 auto;
    padding: 3rem 1.5rem 2rem;
    overflow: hidden;
}

/* ==========================================================================
   Search Form - Clean, minimal styling like mockup
   ========================================================================== */

.bfl-search-overlay__form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Reset ALL form elements within overlay to prevent theme interference */
.bfl-search-overlay button,
.bfl-search-overlay input {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    outline: none;
    -webkit-appearance: none !important;
    appearance: none !important;
}

/* Submit button (magnifying glass) */
.bfl-search-overlay__submit {
    flex-shrink: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.75) !important;
    transition: color 0.2s ease;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
}

.bfl-search-overlay__submit:hover,
.bfl-search-overlay__submit:focus {
    color: #fff !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.bfl-search-overlay__submit:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.bfl-search-overlay__submit:focus:not(:focus-visible) {
    outline: none;
}

.bfl-search-overlay__submit:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.bfl-search-overlay__submit svg {
    width: 32px;
    height: 32px;
}

/* Search input - clean, no border */
.bfl-search-overlay__input {
    flex: 1;
    min-width: 0;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 2rem !important; /* 32px */
    font-weight: 600 !important;
    line-height: 1.4 !important;
    color: #fff !important;
    caret-color: #fff;
    padding: 0 !important;
    margin: 0 !important;
    height: auto !important;
    min-height: 0 !important;
}

.bfl-search-overlay__input::placeholder {
    color: rgba(255, 255, 255, 0.75) !important;
    opacity: 1 !important; /* Firefox fix */
}

.bfl-search-overlay__input:focus {
    outline: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Remove default search input styling */
.bfl-search-overlay__input::-webkit-search-cancel-button,
.bfl-search-overlay__input::-webkit-search-decoration {
    -webkit-appearance: none !important;
    appearance: none !important;
    display: none !important;
}

/* Close button - subtle, positioned right */
.bfl-search-overlay__close {
    flex-shrink: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0.5rem !important;
    margin: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6) !important;
    transition: color 0.2s ease;
    border-radius: 4px;
    margin-left: auto !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
}

.bfl-search-overlay__close:hover,
.bfl-search-overlay__close:focus {
    color: #fff !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.bfl-search-overlay__close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.bfl-search-overlay__close:focus:not(:focus-visible) {
    outline: none;
}

.bfl-search-overlay__close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.bfl-search-overlay__close svg {
    width: 24px;
    height: 24px;
}

/* Accent line under input */
.bfl-search-overlay__accent-line {
    height: 3px;
    background: #D4D34B;
    margin-top: 0.75rem;
    border-radius: 2px;
}

/* ==========================================================================
   Search Results
   ========================================================================== */

.bfl-search-overlay__results {
    margin-top: 1.5rem;
    max-height: 350px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.bfl-search-overlay__results::-webkit-scrollbar {
    width: 6px;
}

.bfl-search-overlay__results::-webkit-scrollbar-track {
    background: transparent;
}

.bfl-search-overlay__results::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Results empty state / loading */
.bfl-search-overlay__loading,
.bfl-search-overlay__no-results {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    padding: 1rem 0;
}

/* Destination intent card */
.bfl-search-overlay__destination-card {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.bfl-search-overlay__destination-card h3 {
    color: #fff;
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bfl-search-overlay__destination-card h3 svg {
    width: 20px;
    height: 20px;
    color: #D4D34B;
}

.bfl-search-overlay__destination-card p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9375rem;
    line-height: 1.5;
    margin: 0 0 1rem 0;
}

.bfl-search-overlay__destination-card a {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: #D4D34B;
    font-weight: 600;
    font-size: 0.9375rem;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.bfl-search-overlay__destination-card a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.bfl-search-overlay__destination-card a svg {
    width: 16px;
    height: 16px;
}

/* Results section */
.bfl-search-overlay__section {
    margin-bottom: 1.25rem;
}

.bfl-search-overlay__section:last-child {
    margin-bottom: 0;
}

.bfl-search-overlay__section-title {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.5rem 0 !important;
}

/* Result item */
.bfl-search-overlay__result {
    display: block;
    padding: 0.75rem;
    margin: 0 -0.75rem;
    border-radius: 6px;
    text-decoration: none !important;
    transition: background-color 0.15s ease;
    color: #fff !important;
}

.bfl-search-overlay__result:hover,
.bfl-search-overlay__result:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    outline: none;
    color: #fff !important;
    text-decoration: none !important;
}

.bfl-search-overlay__result:visited {
    color: #fff !important;
}

.bfl-search-overlay__result-title {
    color: #fff !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    margin: 0 !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bfl-search-overlay__result-title .bfl-badge {
    font-size: 0.625rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    letter-spacing: 0.03em;
}

.bfl-search-overlay__result-excerpt {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 0.875rem !important;
    margin: 0.25rem 0 0 0 !important;
    line-height: 1.4;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

/* Tablet - 1024px and below */
@media (max-width: 1024px) {
    .bfl-search-overlay__inner {
        padding: 2.5rem 1.25rem 1.5rem;
    }
    
    .bfl-search-overlay__input {
        font-size: 1.75rem;
    }
    
    .bfl-search-overlay__results {
        max-height: 300px;
    }
}

/* Mobile - 767px and below */
@media (max-width: 767px) {
    .bfl-search-overlay__container {
        /* On mobile, take more screen real estate */
        min-height: 45vh;
    }
    
    .bfl-search-overlay__inner {
        padding: 2rem 1rem 1.25rem;
    }
    
    .bfl-search-overlay__form {
        gap: 0.5rem;
    }
    
    .bfl-search-overlay__submit svg {
        width: 26px;
        height: 26px;
    }
    
    .bfl-search-overlay__input {
        font-size: 1.5rem;
    }
    
    .bfl-search-overlay__results {
        max-height: calc(45vh - 140px);
    }
    
    .bfl-search-overlay__destination-card {
        padding: 1rem;
    }
    
    .bfl-search-overlay__destination-card h3 {
        font-size: 1rem;
    }
    
    .bfl-search-overlay__destination-card p {
        font-size: 0.875rem;
    }
}

/* Small mobile - 480px and below */
@media (max-width: 480px) {
    .bfl-search-overlay__input {
        font-size: 1.25rem;
    }
    
    .bfl-search-overlay__close svg {
        width: 20px;
        height: 20px;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .bfl-search-overlay__backdrop,
    .bfl-search-overlay__container {
        transition: none;
    }
    
    .bfl-search-trigger,
    .bfl-search-overlay__submit,
    .bfl-search-overlay__close,
    .bfl-search-overlay__destination-card a,
    .bfl-search-overlay__result {
        transition: none;
    }
}

/* ==========================================================================
   High Contrast Mode Support
   ========================================================================== */

@media (forced-colors: active) {
    .bfl-search-overlay__container {
        border-bottom: 3px solid CanvasText;
    }
    
    .bfl-search-overlay__input {
        border: 1px solid CanvasText;
    }
    
    .bfl-search-overlay__result:focus {
        outline: 2px solid Highlight;
    }
}
