/* --- NOUVEAU HEADER UNIFIÉ - THÈME SOMBRE --- */

/* Onglets à accès restreint masqués par défaut : .d-none est une classe Bootstrap,
   absente des pages sans Bootstrap (accueil, équipe, article…). On la définit ici
   (CSS chargé globalement) pour que le masquage s'applique partout. */
.site-subnav .nav-segmented > li.d-none { display: none !important; }

/* 1. Structure générale du Header */
.header-unified.dark-theme {
  background-color: var(--md-ink, #15181E) !important; /* solide sur TOUTES les pages (accueil inclus) — jamais transparent */
  padding: 12px 0; /* le retrait latéral est porté par .header-content-wrapper (aligné nav/contenu) */
  color: #ffffff;
  position: relative;
  z-index: 40; /* au-dessus de la barre de nav sticky (z-index 30) → le menu compte passe par-dessus */
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Sécurité : neutralise toute transparence héritée des variantes image/gradient du hero */
.header-unified.dark-theme.header-image,
.header-unified.dark-theme.header-gradiant {
  background-color: var(--md-ink, #15181E) !important;
}

/* ==========================================================================
   BARRE DE NAVIGATION TICKETS — chrome partagé (toutes les pages)
   Système Madic : barre blanche collante, onglet actif rouge souligné 2.5px
   ========================================================================== */
.modern-subnav.site-subnav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #ffffff;
  border-bottom: 1px solid var(--md-border, #E7E9ED);
}

.modern-subnav.site-subnav .nav-segmented {
  display: flex;
  gap: 2px;
  list-style: none;
  margin: 0 auto;
  padding: 0;
  /* Même boîte que .container du contenu → 1er onglet aligné au logo et au contenu */
  width: 90%;
  max-width: 1600px;
  overflow-x: auto;
  scrollbar-width: none;
}
.modern-subnav.site-subnav .nav-segmented::-webkit-scrollbar { display: none; }
.modern-subnav.site-subnav li { margin: 0; list-style: none; }

.modern-subnav.site-subnav .nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 15px 14px;
  margin-bottom: -1px; /* l'underline actif chevauche la bordure basse de la barre */
  font: 500 13.5px/1 var(--md-font-ui, 'Hanken Grotesk', sans-serif);
  color: var(--md-text-2, #5B616E);
  text-decoration: none !important;
  white-space: nowrap;
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  border-radius: 0;
  transition: color .15s ease, border-color .15s ease;
}
.modern-subnav.site-subnav .nav-item:hover,
.modern-subnav.site-subnav .nav-item:focus {
  color: var(--md-text, #1A1D23);
}
.modern-subnav.site-subnav .nav-item.active {
  color: var(--md-red, #E2001A);
  font-weight: 700;
  border-bottom-color: var(--md-red, #E2001A);
}
.modern-subnav.site-subnav .nav-item i { font-size: 15px; }

/* Badge « beta » (design : pilule grise) */
.modern-subnav.site-subnav .beta-badge {
  font: 700 9px/1 var(--md-font-ui, 'Hanken Grotesk', sans-serif);
  letter-spacing: .05em;
  text-transform: uppercase;
  background: var(--md-border-soft, #EEF0F3);
  color: var(--md-label, #8A909C);
  padding: 3px 5px;
  border-radius: 4px;
}

/* État non connecté (public) : pas d'onglets (design = header public FR|EN + Connexion) */
body.role-anonymous .modern-subnav.site-subnav { display: none; }

@media (max-width: 768px) {
  .modern-subnav.site-subnav .nav-item { padding: 13px 12px; font-size: 13px; }
}

.header-content-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Même boîte que .container du contenu (style.css : width 90%, max 1600) → logo aligné au contenu */
  width: 90%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0;
}

/* 2. Logo Madic — picto PNG (settings.logo) + texte MADIC / HELPDESK */
.header-unified .logo a { display: inline-flex; text-decoration: none; }
.header-unified .logo-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.header-unified .logo-pic {
  flex: none;
  display: block;
  height: 34px;
  width: auto;
}
.header-unified .logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
  text-align: left;
}
.header-unified .logo-madic {
  font: 800 17px/1 var(--md-font-display, 'Archivo', sans-serif);
  letter-spacing: .04em;
  color: #ffffff;
}
.header-unified .logo-helpdesk {
  font: 600 9px/1 var(--md-font-ui, 'Hanken Grotesk', sans-serif);
  letter-spacing: .34em;
  color: var(--md-red, #E2001A);
  margin-top: 3px;
}

/* 3. Groupe d'actions à droite */
.header-right-group {
  display: flex;
  align-items: center;
  gap: 12px; /* Espace entre les boutons et le menu */
}

/* 4. Styles des Boutons (Hiérarchie) */
.header-right-group .btn {
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid transparent;
  transition: all 0.2s ease;
}

/* Bouton Primaire : Rouge sur fond sombre */
.header-right-group .btn.btn-primary-red {
  background-color: #D9232D;
  color: #ffffff;
  border-color: #D9232D;
}
.header-right-group .btn.btn-primary-red:hover {
  background-color: #b51c25;
  border-color: #b51c25;
  transform: translateY(-1px);
}

/* Bouton Secondaire : "Ghost" blanc */
.header-right-group .btn.btn-secondary-ghost {
  background-color: transparent;
  color: #ffffff;
  border-color: #666; /* Bordure grise pour ne pas être trop agressive */
}
.header-right-group .btn.btn-secondary-ghost:hover {
  background-color: rgba(255, 255, 255, 0.1);
  /* pas de bordure blanche au survol : on garde la bordure discrète */
}


/* 5. Style du Menu Utilisateur (Crucial) */
.header-right-group .user-info .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px; /* pilule (design) */
  padding: 5px 12px 5px 6px; /* asymétrique : avatar collé à gauche */
  cursor: pointer;
  transition: all 0.2s ease;
  color: #ffffff;
}
.header-right-group .user-info .dropdown-toggle:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}
.header-right-group .user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}
.header-right-group .account-chevron {
  color: #9AA0AC;
  flex: none;
}
/* Masque la flèche Bootstrap (on garde notre chevron SVG) — évite le doublon */
.header-right-group .user-info .dropdown-toggle::after { display: none !important; }
/* Avatar compte → initiales (pastille rouge dégradée, design) */
.header-right-group .header-initials {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #E2001A, #8a0010);
  color: #fff;
  font: 700 11px/1 var(--md-font-display, 'Archivo', sans-serif);
  flex: none;
}
.header-right-group .dropdown-toggle span {
  font-weight: 500;
  font-size: 14px;
}
.header-right-group .dropdown-chevron-icon {
  color: #ccc;
}

/* Menu compte — système Madic */
.header-right-group .user-info .dropdown-menu {
  background-color: #ffffff;
  border: 1px solid var(--md-border, #E7E9ED);
  border-radius: 12px;
  box-shadow: 0 12px 28px -10px rgba(20, 24, 32, 0.22);
  padding: 6px;
  min-width: 13rem;
  font-family: var(--md-font-ui, 'Hanken Grotesk', sans-serif);
  margin-top: 8px;
}

.header-right-group .dropdown-menu a[role="menuitem"],
.header-right-group .dropdown-menu button[role="menuitem"] {
  color: var(--md-text, #1A1D23) !important;
  background: transparent;
  border: none;
  font: 500 13.5px var(--md-font-ui, 'Hanken Grotesk', sans-serif);
  padding: 9px 12px;
  border-radius: 8px;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.header-right-group .dropdown-menu i { color: var(--md-label-2, #9AA0AC); width: 16px; text-align: center; }

.header-right-group .dropdown-menu a[role="menuitem"]:hover,
.header-right-group .dropdown-menu a[role="menuitem"]:focus,
.header-right-group .dropdown-menu button[role="menuitem"]:hover,
.header-right-group .dropdown-menu button[role="menuitem"]:focus {
  color: var(--md-red, #E2001A) !important;
  background-color: var(--md-red-tint, #FDECEC);
}
.header-right-group .dropdown-menu a[role="menuitem"]:hover i,
.header-right-group .dropdown-menu button[role="menuitem"]:hover i { color: var(--md-red, #E2001A); }

/* Style du bouton d'action principal (CTA) */
.btn.btn-primary {
  padding: 10px 20px;
  border-radius: 8px; /* Bords légèrement arrondis, très moderne */
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px; /* Espace entre l'icône et le texte */
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Hover neutre (plus de lift translateY ni d'ombre teal de l'ancien thème) */
.btn.btn-primary:hover {
  transform: none;
  box-shadow: none;
}


/* 2. Style du Sub-Header (barre de navigation) */
.subnav {
    background-color: #f3f3f3;

}
.subnav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  height: 50px;
      max-width: 1600px;
    margin: auto;
  background-color: #f3f3f3;
}

.subnav-tabs {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 24px;
}

.subnav-link {
    padding: 0;
  text-decoration: none;
  color: #555;
  font-weight: 500;
  font-size: 15px;
  height: 100%;
  display: inline-flex;
  align-items: center;
  border-bottom: 3px solid transparent; /* Bordure pour l'onglet actif */
  transition: color 0.2s ease, border-color 0.2s ease;
}

.subnav-link:hover {
  color: #111;
}

.subnav-link.active {
  color: #D9232D;
  border-bottom-color: #D9232D;
}

/* Outils à droite de la subnav */
.subnav-tools {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Style moderne et CLAIR pour le menu utilisateur */
.subnav-tools .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: #f5f5f5; /* Fond subtil pour montrer que c'est un élément */
  border: 1px solid #e0e0e0;
  border-radius: 20px; /* Forme "pilule" */
  padding: 4px 12px 4px 4px; /* Padding asymétrique pour l'avatar */
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.subnav-tools .dropdown-toggle:hover {
  background-color: #e9e9e9;
}
.subnav-tools .user-avatar {
  width: 28px;
  height: 28px;
}
.subnav-tools .dropdown-toggle span {
  font-weight: 500;
  color: #333;
}
.subnav-tools .dropdown-chevron-icon {
  color: #777;
}

body.role-anonymous .subnav {
  display: none;
}
/* ==========================================================================
   MOBILE HEADER RESPONSIVE
   ========================================================================== */

@media screen and (max-width: 768px) {

    /* --- 1. HEADER PRINCIPAL (Barre noire) --- */

    .header-unified.dark-theme {
        padding: 8px 0; /* retrait latéral porté par .header-content-wrapper */
    }

    /* Le groupe de droite prend toute la largeur pour bien espacer les éléments */
    .header-content-wrapper {
        justify-content: flex-end; /* Ou 'center' si vous voulez centrer les boutons */
    }

    .header-right-group {
        width: 100%;
        justify-content: end; /* Distribue l'espace entre les boutons */
        gap: 8px;
    }

    /* TRANSFORMATION DES BOUTONS EN ICÔNES */
    /* L'astuce : on met la taille de police à 0 pour cacher le texte, 
       puis on remet une taille normale sur l'icône (i) */
    
    .header-right-group .btn {
        font-size: 0 !important; /* Cache le texte "Créer un ticket" */
        padding: 10px !important; /* Carré autour de l'icône */
        width: 42px;
        height: 42px;
        justify-content: center;
        border-radius: 50%; /* On les rend ronds pour faire "App" */
        gap: 0;
    }

    /* On s'assure que l'icône reste visible et de bonne taille */
    .header-right-group .btn i,
    .header-right-group .btn svg {
        font-size: 18px !important;
        margin: 0 !important;
    }

    /* MENU UTILISATEUR (User Profile) */
    /* On cache le nom "Corentin B.", on ne garde que l'avatar */
    .header-right-group .user-info .dropdown-toggle {
        padding: 0;
        border: none;
        background: transparent !important;
    }

    .header-right-group .dropdown-toggle span {
        display: none; /* Cache le nom */
    }
    
    .header-right-group .dropdown-chevron-icon {
        display: none; /* Cache la flèche */
    }

    .header-right-group .user-avatar {
        width: 40px;
        height: 40px;
        border: 2px solid rgba(255,255,255,0.2);
    }


    /* --- 2. SUB-NAV (Menu gris clair) --- */
    
    .subnav-bar {
        height: auto; /* Laisse la hauteur s'adapter */
        padding: 0;
        overflow: hidden;
    }

    /* On rend le menu scrollable horizontalement (comme Instagram/YouTube) */
    .subnav-tabs {
        width: 100%;
        overflow-x: auto; /* Active le scroll horizontal */
        white-space: nowrap; /* Empêche les liens de passer à la ligne */
        gap: 0; /* On gère l'espace via le padding des liens */
        margin-bottom: 2px;
        /* Cache la barre de défilement (esthétique) */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
    }
    .subnav-tabs::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    .subnav-link {
        padding: 12px 16px; /* Zone de clic confortable */
        font-size: 14px;
        flex-shrink: 0; /* Empêche les liens de s'écraser */
    }

    /* On cache les outils de droite du subnav (souvent redondants sur mobile) */
    .subnav-tools {
        display: none; 
    }

    .subnav .dropdown-menu,
    #toolbar-left .dropdown-menu,
    .filter-dropdown-menu {
        
        /* SORTIR DU FLUX PARENT (C'est la clé) */
        position: fixed !important;
        z-index: 9999 !important;
        
        /* POSITIONNEMENT FIXE EN BAS */
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        
        /* DIMENSIONS ET STYLE */
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        transform: none !important; /* Annule le positionnement calculé par JS */
        
        background-color: #fff !important;
        border-radius: 20px 20px 0 0 !important;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.2) !important;
        padding: 20px 0 !important;
        max-height: 70vh !important;
        overflow-y: auto !important;
        
        /* Annuler les règles spécifiques de .dropdown-menu-end */
        right: 0 !important; 
        left: 0 !important;
    }

    /* 2. Style des liens pour le tactile */
    .subnav .dropdown-menu .dropdown-item,
    #toolbar-left .dropdown-menu .dropdown-item {
        padding: 15px 20px !important;
        font-size: 16px !important;
        border-bottom: 1px solid #f0f0f0;
    }

    /* 3. Petite barre de "poignée" en haut */
    .subnav .dropdown-menu::before,
    #toolbar-left .dropdown-menu::before {
        content: '';
        display: block;
        width: 40px;
        height: 5px;
        background-color: #e0e0e0;
        border-radius: 3px;
        margin: -10px auto 15px auto;
    }

    /* On cible le menu déroulant qui est DANS le groupe de droite du header */
    .header-right-group .dropdown-menu {
        
        /* 1. POSITIONNEMENT FIXE (Sort du header) */
        position: fixed !important;
        z-index: 2147483647 !important; /* Toujours au-dessus de tout */
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        
        /* 2. DIMENSIONS ET STYLE */
        width: 100vw !important;
        margin: 0 !important;
        padding: 20px 0 30px 0 !important; /* Un peu plus de padding en bas */
        
        background-color: #ffffff !important;
        border-radius: 20px 20px 0 0 !important; /* Arrondi haut */
        border: none !important;
        box-shadow: 0 -10px 50px rgba(0,0,0,0.5) !important;
        
        /* 3. NETTOYAGE */
        transform: none !important;
    }

    /* Affichage quand le menu est ouvert */
    .header-right-group .dropdown-menu.show,
    .header-right-group .dropdown.show .dropdown-menu { /* Fallback pour certaines versions de Zendesk */
        display: block !important;
        animation: slideUpProfile 0.3s ease-out;
    }

    @keyframes slideUpProfile {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* 4. STYLE DES LIENS (Gros boutons tactiles) */
    .header-right-group .dropdown-menu a[role="menuitem"],
    .header-right-group .dropdown-menu button[role="menuitem"] {
        display: flex !important;
        align-items: center;
        width: 100%;
        padding: 15px 25px !important;
        font-size: 16px !important;
        color: #333 !important;
        background: transparent;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        text-align: left;
        text-decoration: none;
    }

    /* Icônes dans le menu */
    .header-right-group .dropdown-menu i {
        margin-right: 15px;
        font-size: 18px;
        color: var(--md-label-2, #9AA0AC); /* gris Madic (rouge au survol via la règle globale) */
        width: 20px;
        text-align: center;
    }

    /* 5. Petite poignée grise en haut */
    .header-right-group .dropdown-menu::before {
        content: '';
        display: block;
        width: 50px;
        height: 5px;
        background-color: #e0e0e0;
        border-radius: 3px;
        margin: -10px auto 20px auto; /* Centré en haut */
    }
}