/* ====================================================================== */
/* SEARCH OVERLAY STYLES - Consolidated */
/* ====================================================================== */

/* Search Overlay Background */
.usarm-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.usarm-search-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Search Container */
.usarm-search-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    width: 90vw;
    max-height: 80vh;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Search Header */
.usarm-search-header {
    padding: 30px 30px 20px;
    border-bottom: 1px solid #eee;
    position: relative;
}

.usarm-search-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0 40px 0 0;
    text-align: center;
}

/* Close Button */
.usarm-search-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: #f8f9fa;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #666;
    transition: all 0.2s ease;
}

.usarm-search-close:hover {
    background: #e9ecef;
    color: #333;
    transform: rotate(90deg);
}

/* Search Form */
.usarm-overlay-search-form {
    padding: 0 30px 20px;
}

.usarm-search-input-container {
    position: relative;
    margin-bottom: 20px;
}

.usarm-search-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.usarm-search-input:focus {
    border-color: #AC2125;
    box-shadow: 0 0 0 3px rgba(172, 33, 37, 0.1);
}

.usarm-search-input::placeholder {
    color: #999;
}

/* Search Button */
.usarm-search-submit {
    background: #AC2125;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usarm-search-submit:hover {
    background: #8b1c1f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(172, 33, 37, 0.3);
}

.usarm-search-submit:active {
    transform: translateY(0);
}

/* Search Type Toggle */
.usarm-search-type-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.usarm-search-type-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.usarm-search-type-btn.active {
    background: #AC2125;
    color: white;
    border-color: #AC2125;
}

.usarm-search-type-btn:hover:not(.active) {
    border-color: #AC2125;
    color: #AC2125;
}

/* Search Results */
.usarm-search-results {
    max-height: 300px;
    overflow-y: auto;
    padding: 0 30px 30px;
}

.usarm-search-results-header {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.usarm-search-result-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.usarm-search-result-item:hover {
    background-color: #f8f9fa;
    margin: 0 -15px;
    padding-left: 15px;
    padding-right: 15px;
    border-radius: 6px;
}

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

.usarm-search-result-title {
    font-weight: 600;
    color: #333;
    text-decoration: none;
    display: block;
    margin-bottom: 5px;
}

.usarm-search-result-title:hover {
    color: #AC2125;
}

.usarm-search-result-excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .usarm-search-container {
        width: 95vw;
        margin: 20px;
    }
    
    .usarm-search-header,
    .usarm-overlay-search-form,
    .usarm-search-results {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    .usarm-search-title {
        font-size: 20px;
        margin-right: 30px;
    }
    
    .usarm-search-close {
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    .usarm-search-input {
        padding: 12px 15px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .usarm-search-submit {
        padding: 12px 25px;
        font-size: 15px;
    }
}

/* Loading State */
.usarm-search-overlay.loading .usarm-search-container {
    opacity: 0.7;
    pointer-events: none;
}

.usarm-search-overlay.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid transparent;
    border-top: 3px solid #AC2125;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility Features */
@media (prefers-reduced-motion: reduce) {
    .usarm-search-overlay,
    .usarm-search-container,
    .usarm-search-close,
    .usarm-search-submit,
    .usarm-search-type-btn {
        transition: none;
        animation: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .usarm-search-container {
        background: white;
        border: 3px solid black;
    }
    
    .usarm-search-input {
        border: 3px solid black;
    }
    
    .usarm-search-input:focus {
        outline: 3px solid #0073aa;
    }
    
    .usarm-search-submit {
        background: black;
        border: 3px solid black;
    }
    
    .usarm-search-close {
        background: white;
        border: 3px solid black;
        color: black;
    }
}

/* Focus Management */
.usarm-search-overlay *:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Search Trigger Buttons (WordPress Blocks) */
.wp-block-search.search-trigger,
.widget_search.search-trigger {
    cursor: pointer;
    position: relative;
}

.wp-block-search.search-trigger::before {
    content: "SEARCH";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
    pointer-events: none;
}

/* ====================================================================== */
/* AIRCHECK LIBRARY SEARCH BUTTON */
/* ====================================================================== */

.search-button-simple,
.aircheck-search-trigger {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    min-height: 47px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 200px;
    margin: 0 auto 20px;
}

.search-button-simple:hover,
.aircheck-search-trigger:hover {
    background: #AC2125;
    color: white;
    border-color: #AC2125;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(172, 33, 37, 0.3);
}

.search-button-simple:active,
.aircheck-search-trigger:active {
    transform: translateY(0);
}

.search-row {
    text-align: center;
    margin-bottom: 20px;
}

/* ====================================================================== */
/* ALPHABETICAL NAVIGATION */
/* ====================================================================== */

.alphabetical-navigation {
    margin: 30px 0;
    text-align: center;
}

.alphabetical-navigation.bottom-nav {
    margin-top: 40px;
    border-top: 1px solid #eee;
    padding-top: 30px;
}

.alphabet-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    max-width: 800px;
    margin: 0 auto;
}

.alphabet-btn {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alphabet-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.alphabet-btn.active {
    background: #AC2125;
    color: white;
    border-color: #AC2125;
    box-shadow: 0 2px 8px rgba(172, 33, 37, 0.3);
}

.alphabet-btn:active {
    transform: translateY(0);
}

/* Special styling for "All" button */
.alphabet-btn[data-letter="all"] {
    min-width: 50px;
    font-size: 12px;
    margin-right: 8px;
}

/* Special styling for "#" button */
.alphabet-btn[data-letter="#"] {
    margin-right: 8px;
}

/* Mobile Responsive for Alphabetical Navigation */
@media screen and (max-width: 768px) {
    .alphabet-buttons {
        gap: 3px;
    }
    
    .alphabet-btn {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 32px;
        height: 32px;
    }
    
    .alphabet-btn[data-letter="all"] {
        min-width: 45px;
        font-size: 11px;
    }
}

@media screen and (max-width: 480px) {
    .alphabet-buttons {
        gap: 2px;
    }
    
    .alphabet-btn {
        padding: 4px 6px;
        font-size: 11px;
        min-width: 28px;
        height: 28px;
    }
    
    .alphabet-btn[data-letter="all"] {
        min-width: 40px;
        font-size: 10px;
    }
    
    .search-button-simple,
    .aircheck-search-trigger {
        max-width: 150px;
        font-size: 13px;
        padding: 10px 16px;
    }
}