/* ============================================
   GLOBAL SEARCH - Wrapper
============================================ */
.global-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* Trigger : input dans le header (readonly) */
.global-search-wrapper > .search-input {
    cursor: pointer;
    width: 280px;
    padding: 10px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: #f8f8f8;
    color: #666;
    transition: border-color 0.2s, background-color 0.2s;
}

.global-search-wrapper > .search-input:hover {
    border-color: #ccc;
    background: #fff;
}

/* ============================================
   GLOBAL SEARCH - Dropdown avec forme spéciale
============================================ */

/* Conteneur principal - forme en L inversé */
.global-search-dropdown {
    position: absolute;
    top: -10px;
    left: -10px;
    z-index: 1100;
    display: none;
    flex-direction: column;
    max-height: calc(100vh - 80px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    padding: 55px 100px 10px 0;
    width: 650px;
}

.global-search-dropdown.active {
    display: flex;
}

/* Zone blanche derrière l'input (onglet) */
.global-search-dropdown::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 302px;
    height: 55px;
    background: white;
    border-radius: 12px 0 0 0;
}

/* Découpe à droite de l'input pour ne pas dépasser le header */
.global-search-dropdown::after {
    content: '';
    position: absolute;
    top: 0;
    left: 302px;
    right: 0;
    height: 55px;
    background: transparent;
}

/* L'input trigger devient actif et éditable */
.global-search-wrapper.active > #global-search-trigger {
    position: relative;
    z-index: 1101;
    background: white;
    border: none;
    cursor: text;
}

.global-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.08);
    z-index: 1099;
    display: none;
}

.global-search-overlay.active {
    display: block;
}

/* ============================================
   GLOBAL SEARCH - Header (input dans dropdown)
============================================ */
.global-search-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
}

.global-search-icon {
    width: 22px;
    height: 22px;
    color: #999;
    flex-shrink: 0;
}

.global-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 18px;
    background: transparent;
    color: #333;
}

.global-search-input::placeholder {
    color: #aaa;
}

/* Séparateur */
.global-search-divider {
    height: 1px;
    background: #eee;
    margin: 0 20px;
}

/* ============================================
   GLOBAL SEARCH - Results zone
============================================ */
.global-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 20px;
}

/* ============================================
   GLOBAL SEARCH - Loading
============================================ */
.global-search-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.global-search-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e0e0e0;
    border-top-color: #FFD500;
    border-radius: 50%;
    animation: global-search-spin 0.8s linear infinite;
}

@keyframes global-search-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   GLOBAL SEARCH - Columns (3 colonnes)
============================================ */
.global-search-columns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 16px 20px 20px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.global-search-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.global-search-column-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #888;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

/* ============================================
   GLOBAL SEARCH - List items
============================================ */
.global-search-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.global-search-item {
    margin-bottom: 4px;
}

.global-search-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s;
}

.global-search-item a:hover {
    background-color: #f5f5f5;
}

.global-search-item-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    background: #fafafa;
    flex-shrink: 0;
}

.global-search-item-info {
    flex: 1;
    min-width: 0;
}

.global-search-item-name {
    font-weight: 500;
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.global-search-item-meta {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

/* ============================================
   GLOBAL SEARCH - See all link
============================================ */
.global-search-see-all {
    display: block;
    text-align: center;
    padding: 10px 27px;
    margin-top: 10px;
    background: #FFD500;
    color: #000;
    font-weight: 600;
    font-size: 12px;
    text-decoration: none;
    border-radius: 6px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.global-search-see-all:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 213, 0, 0.4);
}

/* ============================================
   GLOBAL SEARCH - Responsive
============================================ */
@media (max-width: 768px) {
    .global-search-wrapper > .search-input {
        width: 44px;
        padding: 10px;
        background: transparent;
        border: none;
        color: transparent;
    }

    .global-search-wrapper > .search-input::placeholder {
        color: transparent;
    }

    /* Afficher icône loupe sur mobile */
    .global-search-wrapper > .search-input {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
        background-size: 20px;
    }

    .global-search-dropdown {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 100vh;
        filter: none;
    }

    .global-search-tab {
        display: none;
    }

    .global-search-body {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .global-search-columns {
        grid-template-columns: 1fr;
        gap: 16px;
        max-height: calc(100vh - 120px);
    }

    .global-search-column {
        border-bottom: 1px solid #eee;
        padding-bottom: 16px;
    }

    .global-search-column:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .global-search-header {
        padding: 20px;
    }

    .global-search-input {
        font-size: 16px;
    }
}

/* Body lock */
body.global-search-open {
    overflow: hidden;
}