/**
 * Styles pour la recherche globale dans le header
 * Modal plein écran avec backdrop blur et navigation clavier
 */

/* Modal de recherche globale */
.global-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

.global-search-modal.show {
    display: flex;
    opacity: 1;
}

/* Backdrop avec blur */
.global-search-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Conteneur principal */
.global-search-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 800px;
    margin: 80px auto 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

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

/* Barre de recherche */
.global-search-input-wrapper {
    position: relative;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.global-search-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.global-search-icon {
    color: #6c757d;
    font-size: 20px;
    flex-shrink: 0;
}

.global-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 18px;
    padding: 12px 0;
    background: transparent;
    color: #1a1a1a;
}

.global-search-input::placeholder {
    color: #adb5bd;
}

.global-search-shortcut {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 6px;
    font-size: 12px;
    color: #495057 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
    flex-shrink: 0;
}

.global-search-shortcut kbd {
    padding: 3px 7px;
    background: #ffffff !important;
    border: 1px solid #ced4da !important;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-size: 11px;
    font-weight: 600;
    color: #212529 !important;
    min-width: 20px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.2;
}

.global-search-shortcut span {
    color: #6c757d !important;
    font-weight: 400;
}

/* Bouton de fermeture */
.global-search-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    font-size: 16px;
}

.global-search-close-btn:hover {
    background: #f8f9fa;
    color: #495057;
}

.global-search-close-btn:active {
    background: #e9ecef;
    transform: scale(0.95);
}

/* Conteneur des résultats */
.global-search-results {
    max-height: 500px;
    overflow-y: auto;
    padding: 0;
}

/* En-tête des résultats */
.global-search-header {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.global-search-header-title {
    font-weight: 600;
    color: #495057;
    margin: 0;
    font-size: 14px;
}

.global-search-header-count {
    color: #6c757d;
    font-size: 13px;
}

/* Groupes de résultats */
.global-search-group {
    border-bottom: 1px solid #e9ecef;
}

.global-search-group-header {
    padding: 12px 20px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #495057;
}

.global-search-group-icon {
    width: 20px;
    text-align: center;
}

.global-search-group-badge {
    margin-left: auto;
    padding: 2px 8px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Items de résultat */
.global-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: #1a1a1a;
    transition: background-color 0.15s ease;
    border-left: 3px solid transparent;
    cursor: pointer;
}

.global-search-item:hover {
    background: #f8f9fa;
    border-left-color: #007bff;
}

.global-search-item.active {
    background: #e7f3ff;
    border-left-color: #007bff;
}

.global-search-item-icon {
    width: 20px;
    text-align: center;
    color: #6c757d;
    flex-shrink: 0;
}

.global-search-item-content {
    flex: 1;
    min-width: 0;
}

.global-search-item-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #1a1a1a;
}

.global-search-item-subtitle {
    font-size: 12px;
    color: #6c757d;
    margin: 0;
}

.global-search-item-arrow {
    color: #adb5bd;
    font-size: 12px;
    flex-shrink: 0;
}

/* Highlighting des termes recherchés */
.global-search-highlight {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
    color: #856404;
}

/* Message vide */
.global-search-empty {
    padding: 60px 20px;
    text-align: center;
    color: #6c757d;
}

.global-search-empty-icon {
    font-size: 48px;
    color: #dee2e6;
    margin-bottom: 16px;
}

.global-search-empty-text {
    font-size: 14px;
    margin: 0;
}

/* Historique */
.global-search-history {
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.global-search-history-title {
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.global-search-history-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.global-search-history-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 16px;
    font-size: 12px;
    color: #495057;
    cursor: pointer;
    transition: all 0.15s ease;
}

.global-search-history-item:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.global-search-history-item-icon {
    color: #6c757d;
    font-size: 10px;
}

/* Loading state */
.global-search-loading {
    padding: 40px 20px;
    text-align: center;
    color: #6c757d;
}

.global-search-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #e9ecef;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .global-search-container {
        margin: 20px;
        max-width: none;
        border-radius: 8px;
    }

    .global-search-input-wrapper {
        padding: 16px;
    }

    .global-search-input {
        font-size: 16px;
    }

    .global-search-shortcut {
        display: none;
    }

    .global-search-results {
        max-height: calc(100vh - 200px);
    }
}

/* Scrollbar personnalisée */
.global-search-results::-webkit-scrollbar {
    width: 8px;
}

.global-search-results::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.global-search-results::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 4px;
}

.global-search-results::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

