/* ========================================
   GLOBAL SEARCH — index.php (mobile + desktop)
   ======================================== */

.global-search-section {
    max-width: 920px;
    margin: var(--section-gap-md, clamp(16px, 2.5vw, 24px)) auto var(--section-gap-lg, clamp(28px, 3.5vw, 40px));
    padding: 0 clamp(16px, 4vw, 32px);
    position: relative;
    z-index: 5;
}

.quote-box--index + .global-search-section {
    margin-top: var(--quote-gap-next, var(--section-gap-md, clamp(20px, 3vw, 28px)));
}

/* Index — search flows into autonomy */
.content:has(.hero--image-only) .global-search-section {
    margin-top: var(--section-gap-md, clamp(16px, 2.5vw, 24px));
    margin-bottom: 0;
    padding-top: var(--section-gap-sm, 12px);
    padding-bottom: var(--section-gap-md, clamp(16px, 2.5vw, 24px));
    max-width: min(880px, 94vw);
}

.global-search-wrapper {
    position: relative;
}

.global-search-form {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.97), rgba(12, 12, 12, 0.99));
    border: 1.5px solid rgba(255, 215, 0, 0.22);
    border-radius: 18px;
    padding: 8px 10px 8px 16px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.global-search-form:focus-within {
    border-color: rgba(255, 215, 0, 0.55);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), 0 0 0 3px rgba(255, 215, 0, 0.08);
}

.global-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

.global-search-icon svg {
    width: 20px;
    height: 20px;
    color: #94A3B8;
}

#global-search-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 16px;
    padding: 12px 6px;
    outline: none;
    font-family: 'Montserrat', sans-serif;
}

#global-search-input::placeholder {
    color: #64748B;
}

#global-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.global-search-btn {
    flex-shrink: 0;
    background: linear-gradient(135deg, #FFD700, #D4AF37);
    border: none;
    border-radius: 14px;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(255, 215, 0, 0.25);
}

.global-search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(255, 215, 0, 0.35);
}

.global-search-btn svg {
    width: 20px;
    height: 20px;
}

.global-search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 10px);
    background: #111;
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 18px;
    padding: 14px 16px 18px;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
    -webkit-overflow-scrolling: touch;
}

.gs-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #FFD700;
    margin: 10px 0 6px;
    font-weight: 600;
}

.gs-section:first-child h3 {
    margin-top: 0;
}

.gs-section ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.gs-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    text-decoration: none;
    color: #fff;
    border-radius: 12px;
    transition: background 0.2s;
}

.gs-item:hover,
.gs-item:focus-visible {
    background: rgba(255, 215, 0, 0.08);
    outline: none;
}

.gs-item img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    background: #1a1a1a;
}

.gs-item span {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.gs-item span strong {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gs-item small {
    color: #94A3B8;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gs-empty,
.gs-loading {
    color: #94A3B8;
    margin: 8px 0;
    font-size: 14px;
    padding: 8px 4px;
}

/* Desktop : barre plus large, intégrée sous le hero */
@media (min-width: 769px) {
    .global-search-section {
        margin-top: var(--section-gap-md, clamp(20px, 3vw, 28px));
        margin-bottom: var(--section-gap-lg, clamp(32px, 4vw, 48px));
    }

    .quote-box--index + .global-search-section {
        margin-top: var(--quote-gap-next, var(--section-gap-md, clamp(20px, 3vw, 28px)));
    }

    .content:has(.hero--image-only) .global-search-section {
        margin-top: 0;
        margin-bottom: 0;
    }

    .global-search-form {
        padding: 10px 12px 10px 20px;
        border-radius: 20px;
    }

    #global-search-input {
        font-size: 17px;
        padding: 14px 10px;
    }

    .global-search-btn {
        width: 52px;
        height: 52px;
        border-radius: 16px;
    }
}

/* Mobile : pleine largeur, bouton tactile */
@media (max-width: 768px) {
    .global-search-section {
        margin-top: var(--section-gap-md, 16px);
        margin-bottom: var(--section-gap-md, 28px);
    }

    .content:has(.hero--image-only) .global-search-section {
        margin-top: 0;
        margin-bottom: 0;
        padding-bottom: var(--section-gap-md, 24px);
    }

    .global-search-form {
        border-radius: 16px;
        padding: 6px 8px 6px 12px;
    }

    #global-search-input {
        font-size: 16px;
        padding: 10px 4px;
    }

    .global-search-btn {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .global-search-results {
        position: fixed;
        left: 12px;
        right: 12px;
        top: auto;
        bottom: 12px;
        max-height: 55vh;
        z-index: 1000;
    }

    .global-search-wrapper.is-open .global-search-results {
        display: block !important;
    }
}

@media (max-width: 480px) {
    .global-search-section {
        margin-top: var(--as-space-stack-sm, 16px);
        padding: 0 14px;
    }

    .gs-item img {
        width: 40px;
        height: 40px;
    }
}
