/*
 * Arc_Prod File Role: Plugin-specific stylesheet for 'global_search'.
 * File: public_html/assets/xhelpers/css/plugins/global_search.css
 */

/* ===== CONTAINER ===== */
.global-search-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* ===== INPUT WRAPPER ===== */
.global-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 32px;
    height: 32px;
}

/* ===== ICÔNE LOUPE : visible en permanence, cliquable ===== */
.global-search-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: var(--token-text-secondary, #737373);
    font-size: 0.84rem;
    pointer-events: auto;
    cursor: pointer;
    z-index: 1;
    transition: left 0.25s ease, transform 0.25s ease, color 150ms ease;
}

/* ===== CHAMP : collapsed par défaut ===== */
.global-search-input {
    width: 0;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 20px;
    background: transparent;
    color: #374151;
    opacity: 0;
    pointer-events: none;
    outline: none;
    font-size: 0.78rem;
    line-height: 1.4;
    transition: width 0.25s ease, opacity 0.2s ease, padding 0.25s ease,
                background 0.2s ease, border-color 0.2s ease;
    -webkit-appearance: none;
}

/* ===== ÉTAT EXPANDED ===== */
.global-search-container.search-expanded .global-search-icon {
    left: 0.55rem;
    transform: translateY(-50%);
}

.global-search-container.search-expanded .global-search-input {
    width: 180px;
    padding: 0.24rem 0.6rem 0.24rem 1.7rem;
    border-color: rgba(0, 0, 0, 0.13);
    background: rgba(0, 0, 0, 0.05);
    opacity: 1;
    pointer-events: auto;
}

.global-search-container.search-expanded .global-search-input:focus {
    width: 210px;
    background: #fff;
    border-color: var(--ulb-blue, #384376);
    color: #1e293b;
    box-shadow: 0 0 0 3px rgba(56, 67, 118, 0.10);
}

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

.global-search-container.search-expanded .global-search-input-wrapper:focus-within .global-search-icon {
    color: var(--brand-text);
}

.global-search-input::-webkit-search-cancel-button {
    filter: invert(0.4) opacity(0.6);
    cursor: pointer;
}

/* ===== DROPDOWN AUTOCOMPLETE ===== */
.global-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 300px;
    max-width: 420px;
    max-height: 380px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.13);
    z-index: 1060;
}

.global-search-group {
    padding: 0.2rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.global-search-group:last-of-type {
    border-bottom: none;
}

.global-search-group-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.75rem 0.25rem;
    font-size: 0.70rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.05em;
}

.global-search-item {
    display: block;
    padding: 0.38rem 0.75rem 0.38rem 1.5rem;
    color: #1e293b;
    text-decoration: none;
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 100ms ease, color 100ms ease;
}

.global-search-item:hover {
    background: #f0f4ff;
    color: var(--brand-text);
}

.global-search-empty {
    padding: 1rem 0.75rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.84rem;
}

.global-search-viewall {
    display: block;
    padding: 0.5rem 0.75rem;
    text-align: center;
    font-size: 0.80rem;
    font-weight: 500;
    color: var(--brand-text);
    text-decoration: none;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 0 0 10px 10px;
    transition: background 100ms ease;
}

.global-search-viewall:hover {
    background: #f0f4ff;
}

/* ===== BOUTON FERMER (mobile) ===== */
.global-search-mobile-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--token-text-secondary, #737373);
    font-size: 1.1rem;
    padding: 0;
    border-radius: 50%;
}
.global-search-mobile-close:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--token-text-primary, #1e293b);
}

/* ===== RESPONSIVE : mobile — loupe + overlay au clic ===== */
@media (max-width: 767.98px) {
    /* Icône loupe visible dans la navbar (collapsed) */
    .global-search-container {
        /* visible */
    }

    /* Overlay plein-écran quand la recherche est ouverte (z-index > navbar 1200) */
    .global-search-container.search-expanded {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: var(--navbar-bg, #fff);
        z-index: 1300;
        padding: 0 12px;
        display: flex;
        align-items: center;
        gap: 8px;
        box-shadow: var(--navbar-shadow, 0 2px 8px rgba(0, 0, 0, 0.15));
    }

    .global-search-container.search-expanded .global-search-input-wrapper {
        flex: 1;
        min-width: 0;
        height: 36px;
    }

    .global-search-container.search-expanded .global-search-input {
        width: 100% !important;
    }

    .global-search-container.search-expanded .global-search-input:focus {
        width: 100% !important;
    }

    /* Bouton ✕ visible uniquement en mode expanded */
    .global-search-container.search-expanded .global-search-mobile-close {
        display: flex;
    }

    /* Dropdown pleine largeur sur mobile */
    .global-search-container.search-expanded .global-search-dropdown {
        left: 0;
        right: 0;
        width: auto;
    }
}

/* Très petit écran (< 480px) : navbar fait 52px */
@media (max-width: 479.98px) {
    .global-search-container.search-expanded {
        height: 52px;
    }
}


/* ============================================================
   Global search parity (extrait de misc.css) — 2026-03-18
   ============================================================ */
/* --- Global search: redesign parity pass --- */
/* En-tête de vue : transparent, sans bordure ni ombre — convention du skill
   apple-style pour les en-têtes (stats-header, lsapi-hero-card…). L'ancien aplat
   de couleur pleine avec texte blanc dominait la page et imposait des couleurs
   indifférentes au mode sombre. */
body.arcprod-tenant .global-search-page-content .global-search-hero {
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0 0 0.35rem;
    margin-bottom: 0.75rem;
}

body.arcprod-tenant .global-search-page-content .global-search-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Icône décorative dans un titre de section : masquée (convention apple-style).
   Ici elle doublait de surcroît la loupe du champ de recherche juste en dessous. */
body.arcprod-tenant .global-search-page-content .global-search-title .bi {
    display: none;
}

body.arcprod-tenant .global-search-page-content .global-search-subtitle {
    margin-top: 0.3rem;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

/* Même badge que le compteur des groupes de résultats, pour une page homogène. */
body.arcprod-tenant .global-search-page-content .global-search-count {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
    padding: 0.12rem 0.5rem;
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--arc-brand) 14%, var(--bg-primary));
    color: var(--brand-text);
    border: 1px solid color-mix(in srgb, var(--arc-brand) 25%, var(--border-color));
    font-weight: 600;
    font-size: 0.8rem;
}

/* ── Formulaire de recherche de la page ──
   Champ extensible et bouton de taille fixe ; en petit écran le bouton passe
   sous le champ, tous deux en pleine largeur (cible tactile confortable). */
body.arcprod-tenant .global-search-page-content .global-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

body.arcprod-tenant .global-search-page-content .global-search-form__field {
    position: relative;
    flex: 1 1 260px;
}

/* Tokens du runtime tenant (--text-muted, --radius-md) et non --arc-* : sur les sept
   tokens --arc-* employés par ce fichier, seul --arc-brand est réellement défini
   (tokens.css) — les autres sont sans valeur. */
body.arcprod-tenant .global-search-page-content .global-search-form__icon {
    position: absolute;
    top: 50%;
    left: 0.75rem;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

body.arcprod-tenant .global-search-page-content .global-search-form__field .form-control {
    padding-left: 2.25rem;
    border-radius: var(--radius-md);
}

/* Bouton discret et de largeur automatique : il accompagne le champ, il ne doit pas
   dominer la page. Il reste sur la même ligne y compris en petit écran, où un bloc
   pleine largeur en couleur pleine écrasait tout le reste. */
body.arcprod-tenant .global-search-page-content .global-search-form__submit {
    flex: 0 0 auto;
    border-radius: var(--radius-md);
    padding-inline: 0.85rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

body.arcprod-tenant .global-search-page-content .global-search-form__submit .bi {
    margin-right: 0.1rem;
}

/* Tokens de thème (et non des blancs en dur) : cette carte s'affiche aussi en mode
   sombre, où un fond #ffffff rendait le texte illisible.
   --bg-primary est le token de SURFACE (blanc en clair, #1c1c1e en sombre) ;
   --bg-secondary est le fond de PAGE en sombre (#000000) et ferait disparaître
   la carte. */
body.arcprod-tenant .global-search-page-content .global-search-empty {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    /* --text-secondary et non --text-muted : ce dernier vaut 30 % d'opacité en mode
       sombre, soit 2,5:1 sur cette surface, sous le seuil AA. --text-secondary donne
       5,95:1 en sombre et 4,76:1 en clair. */
    color: var(--text-secondary);
    text-align: center;
    padding: 1.15rem 1rem;
}

body.arcprod-tenant .global-search-page-content .global-search-empty h5 {
    margin: 0.15rem 0 0.35rem;
    /* --arc-title n'est défini nulle part : sans valeur, le titre héritait de la
       couleur atténuée du parent et perdait son contraste. */
    color: var(--text-primary);
    font-size: 1.04rem;
    font-weight: 600;
}

body.arcprod-tenant .global-search-page-content .global-search-group-card {
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--arc-brand);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

body.arcprod-tenant .global-search-page-content .global-search-group-header {
    /* Surface de thème : le dégradé de blancs restait clair en mode sombre. */
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 0.72rem 0.9rem;
}

body.arcprod-tenant .global-search-page-content .global-search-group-header h5 {
    color: var(--text-primary);
    font-size: 1.02rem;
    font-weight: 700;
}

/* Teintes dérivées mélangées à la SURFACE du thème (--bg-primary) et non à « white » :
   c'est le patron du design system, il suit automatiquement le mode sombre. */
body.arcprod-tenant .global-search-page-content .global-search-group-count {
    background: color-mix(in srgb, var(--arc-brand) 14%, var(--bg-primary));
    color: var(--brand-text);
    border: 1px solid color-mix(in srgb, var(--arc-brand) 25%, var(--border-color));
    font-size: 0.74rem;
    font-weight: 700;
}

body.arcprod-tenant .global-search-page-content .global-search-item {
    padding: 0.72rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.16s ease;
}

body.arcprod-tenant .global-search-page-content .global-search-item:last-child {
    border-bottom: 0;
}

body.arcprod-tenant .global-search-page-content .global-search-item:hover {
    background: color-mix(in srgb, var(--arc-brand) 6%, var(--bg-primary));
}

body.arcprod-tenant .global-search-page-content .global-search-item a {
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
}

body.arcprod-tenant .global-search-page-content .global-search-item a:hover {
    color: var(--brand-text);
}

body.arcprod-tenant .global-search-page-content .global-search-back-btn {
    border-radius: 10px;
    min-height: 2.35rem;
    padding: 0.48rem 0.9rem;
    font-weight: 600;
}


