/* --- NOUVEAU HEADER UNIFIÉ - THÈME SOMBRE --- */

/* 1. Structure générale du Header */
.header-unified.dark-theme {
  background-color: transparent; /* Un noir un peu plus doux que le noir pur #000 */
  padding: 12px 24px;
  color: #ffffff;
  position: relative;
  z-index: 9; /* Ligne de séparation subtile */
}

.header-content-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1600px; /* Optionnel : pour centrer le contenu sur de très grands écrans */
  margin: 0 auto;
}

/* 2. Logo (Remarque importante) */
.header-unified .logo img {
  max-height: 50px;
  /* Rappel : le logo doit être une version PNG/SVG avec des couleurs claires */
}

/* 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);
  border-color: #ffffff;
}


/* 5. Style du Menu Utilisateur (Crucial) */
.header-right-group .user-info .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: transparent;
  border: 1.5px solid #666; /* Même style que le bouton secondaire pour la cohérence */
  border-radius: 8px;
  padding: 7px 15px; /* Ajustement du padding pour être aligné avec les autres boutons */
  cursor: pointer;
  transition: all 0.2s ease;
  color: #ffffff;
}
.header-right-group .user-info .dropdown-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
}
.header-right-group .user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}
.header-right-group .dropdown-toggle span {
  font-weight: 500;
  font-size: 14px;
}
.header-right-group .dropdown-chevron-icon {
  color: #ccc;
}

/* 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;
}

.btn.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgb(4 74 86 / 49%);
}


/* 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 12px; /* On réduit les marges externes */
    }

    /* 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(--bs-primary); /* Vos icônes en couleur */
        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 */
    }
}