/* ===== SIDEBAR CSS - DASHBOARD D314 ===== */

/*
 * Styles pour la sidebar gauche du dashboard D314
 * Ce fichier contient :
 * - Section logo
 * - Carte utilisateur (avatar, niveau, XP)
 * - Navigation principale et groupes
 * - Badges dynamiques de navigation
 * - Scrollbars spécifiques sidebar
 * 
 * DÉPENDANCES:
 * - variables.css (pour toutes les variables)
 * - reset.css (pour les styles de base)
 * - layout.css (pour le positionnement de la sidebar)
 * 
 * ORDRE DE CHARGEMENT:
 * 1. variables.css
 * 2. reset.css  
 * 3. layout.css
 * 4. sidebar.css (ce fichier)
 *//* ===== SIDEBAR CSS - V5 CLEAN & SMART ===== */

/*
 * Sidebar adaptée au style v5 : clean, épuré, action-oriented
 * UTILISE VOS VARIABLES CSS EXISTANTES
 * Modifications principales :
 * - User card compacte
 * - Navigation simplifiée
 * - Badges discrets mais visibles
 * - Moins d'animations, plus de clarté
 */
/* ===== SIDEBAR CSS - V5 CLEAN & SMART (SANS AVATAR) ===== */

/*
 * Sidebar adaptée au style v5 : clean, épuré, navigation pure
 * SANS user-card (profil dans le header)
 * UTILISE VOS VARIABLES CSS EXISTANTES
 */
/* ===== SIDEBAR CSS - V6 ROUNDED FLOATING ===== */
/* Inspiré du Student Portal — adapté au thème Parcours dark */
/* ===== SIDEBAR CSS - DASHBOARD D314 ===== */
/* ALIGNÉ SUR LE DESIGN V5 */
/* ===== SIDEBAR CSS - DASHBOARD D314 ===== */
/* ALIGNÉ SUR LE DESIGN V5 */

/* ============================================ */
/* SIDEBAR CONTAINER                            */
/* ============================================ */

.d314-dashboard .sidebar {
    background: var(--bg-secondary) !important;
    border-right: 1px solid var(--border-subtle) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
}

/* On garde sidebar-inner comme wrapper interne simple */
.d314-dashboard .sidebar-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.d314-dashboard .sidebar-inner::-webkit-scrollbar {
    width: 0;
}

/* ============================================ */
/* LOGO / BRANDING                              */
/* ============================================ */

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sidebar-logo-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family-mono);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: #fff;
    flex-shrink: 0;
    transition: var(--transition-fast);
}

.sidebar-logo-icon:hover {
    filter: brightness(1.1);
}

.sidebar-logo-text {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-extrabold);
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sidebar-logo-dot {
    color: var(--primary-color);
    font-style: normal;
}

/* Version tag optionnel */
.sidebar-logo-version {
    margin-left: auto;
    font-family: var(--font-family-mono);
    font-size: 9px;
    color: var(--text-disabled);
}

/* ============================================ */
/* NAVIGATION                                   */
/* ============================================ */

.d314-dashboard nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 8px 6px;
    scrollbar-width: none;
}

.d314-dashboard nav::-webkit-scrollbar { width: 0; }

.d314-dashboard .nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* ============================================ */
/* GROUPES DE NAVIGATION                        */
/* ============================================ */

.d314-dashboard .nav-group {
    margin-bottom: 4px;
}

.d314-dashboard .nav-group-title {
    font-family: var(--font-family-mono);
    font-size: 9.5px;
    font-weight: var(--font-weight-bold);
    color: var(--text-disabled);
    text-transform: uppercase;
    letter-spacing: 1.1px;
    padding: 10px 10px 6px;
    margin: 0;
}

.d314-dashboard .nav-group-title::after {
    display: none;
}

/* Séparateur entre groupes */
.d314-dashboard .nav-separator {
    height: 1px;
    background: var(--border-subtle);
    margin: 5px 10px;
}

/* ============================================ */
/* LIENS DE NAVIGATION                          */
/* ============================================ */

.d314-dashboard .nav-item {
    margin-bottom: 1px;
    width: 100%;
    animation: none;
    opacity: 1;
    transform: none;
}

.d314-dashboard .nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-family-primary);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    transition: all 0.12s ease;
    position: relative;
    width: 100%;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
}

.d314-dashboard .nav-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hover */
.d314-dashboard .nav-link:hover {
    color: var(--text-primary);
    background: var(--surface-glass-hover);
    border-color: transparent;
    transform: none;
}

/* Active */
.d314-dashboard .nav-link.active {
    color: var(--text-primary);
    background: var(--surface-glass-active);
    border-color: var(--border-default);
    font-weight: var(--font-weight-semibold);
}

/* Indicateur actif — barre colorée à gauche */
.d314-dashboard .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    bottom: 25%;
    width: 2.5px;
    border-radius: 0 2px 2px 0;
    background: var(--nav-active-color, var(--primary-color));
}

.d314-dashboard .nav-link.active::after {
    display: none;
}

/* Couleurs d'accentuation par section — à appliquer via data-color ou classes */
.d314-dashboard .nav-link[data-color="math"].active::before   { background: var(--primary-color); }
.d314-dashboard .nav-link[data-color="phys"].active::before   { background: var(--accent-phys); }
.d314-dashboard .nav-link[data-color="blue"].active::before   { background: var(--accent-purple); }
.d314-dashboard .nav-link[data-color="green"].active::before  { background: var(--success-color); }
.d314-dashboard .nav-link[data-color="amber"].active::before  { background: var(--warning-color); }
.d314-dashboard .nav-link[data-color="rose"].active::before   { background: var(--danger-color); }
.d314-dashboard .nav-link[data-color="orange"].active::before { background: var(--orange-color); }

/* ============================================ */
/* ICÔNES DE NAVIGATION                         */
/* ============================================ */

.d314-dashboard .nav-icon {
    min-width: 15px;
    width: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    line-height: 1;
    opacity: 0.45;
    transition: opacity 0.12s;
}

.d314-dashboard .nav-link:hover .nav-icon,
.d314-dashboard .nav-link.active .nav-icon {
    opacity: 1;
    transform: none;
}

/* ============================================ */
/* BADGES                                       */
/* ============================================ */

.d314-dashboard .nav-badge {
    margin-left: auto;
    font-family: var(--font-family-mono);
    font-size: 9.5px;
    font-weight: var(--font-weight-bold);
    padding: 1px 6px;
    border-radius: 8px;
    border: 1px solid;
    flex-shrink: 0;
    min-width: 18px;
    text-align: center;
    line-height: 1.5;

    /* Default : violet */
    color: var(--primary-color);
    background: var(--primary-light);
    border-color: var(--primary-border);
}

.d314-dashboard .nav-badge.live {
    color: var(--success-color);
    background: var(--success-bg);
    border-color: var(--success-border);
}

.d314-dashboard .nav-badge.warning {
    color: var(--warning-color);
    background: var(--warning-bg);
    border-color: var(--warning-border);
}

.d314-dashboard .nav-badge.danger,
.d314-dashboard #analytics-badge,
.d314-dashboard .analytics-badge {
    color: var(--danger-color);
    background: var(--danger-bg);
    border-color: var(--danger-border);
    animation: none;
    background-image: none;
}

.d314-dashboard .nav-badge.achievement,
.d314-dashboard .achievement-badge {
    color: var(--warning-color);
    background: var(--warning-bg);
    border-color: var(--warning-border);
    background-image: none;
}

.d314-dashboard .nav-badge:empty {
    display: none;
}

/* ============================================ */
/* BLOC XP — optionnel, avant le footer         */
/* ============================================ */

.sidebar-xp {
    margin: 0 8px 6px;
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 10px 12px;
    flex-shrink: 0;
}

.sidebar-xp-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 7px;
}

.sidebar-xp-level {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
}

.sidebar-xp-level span {
    color: var(--primary-color);
}

.sidebar-xp-pts {
    font-family: var(--font-family-mono);
    font-size: 9.5px;
    color: var(--text-muted);
}

.sidebar-xp-track {
    height: 4px;
    background: var(--progress-bg);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 5px;
}

.sidebar-xp-bar {
    height: 100%;
    background: var(--progress-fill-math);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    transition: width 1.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.sidebar-xp-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
    animation: xp-shimmer 2.8s infinite;
}

@keyframes xp-shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(300%); }
}

.sidebar-xp-hint {
    font-size: var(--font-size-xs);
    color: var(--text-disabled);
}

.sidebar-xp-hint strong {
    color: var(--primary-color);
    font-weight: var(--font-weight-semibold);
}

/* ============================================ */
/* FOOTER — USER + LOGOUT                       */
/* ============================================ */

.sidebar-footer {
    padding: 8px 8px 10px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

/* User row */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.12s ease;
    border: 1px solid transparent;
    text-decoration: none;
}

.sidebar-user:hover {
    background: var(--surface-glass-hover);
    border-color: var(--border-default);
}

.sidebar-user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-extrabold);
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-sub {
    font-size: 10.5px;
    color: var(--text-muted);
}

/* Logout — icône seule en rose dans le user row */
.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    color: var(--danger-color);
    text-decoration: none;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    transition: all 0.12s ease;
    opacity: 0.7;
}
.sidebar-logout:hover {
    opacity: 1;
    box-shadow: 0 0 8px var(--danger-bg);
}

/* Ancien .logo-section — masqué */
.d314-dashboard .logo-section {
    display: none;
}

/* ============================================ */
/* RESPONSIVE                                   */
/* ============================================ */

@media (max-width: 1024px) {
    .sidebar-logo { padding: 12px 12px 10px; }
}

@media (max-width: 768px) {
    .d314-dashboard .sidebar {
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.23, 1, 0.32, 1);
        width: var(--sidebar-width);
    }

    .d314-dashboard .sidebar.open {
        transform: translateX(0);
    }

    .d314-dashboard .nav-link {
        padding: 9px 10px;
        font-size: var(--font-size-md);
    }
}

/* ============================================ */
/* PRINT                                        */
/* ============================================ */

@media print {
    .d314-dashboard .sidebar { display: none !important; }
}

/* ============================================ */
/* ACCESSIBILITY                                */
/* ============================================ */

@media (prefers-reduced-motion: reduce) {
    .d314-dashboard .nav-link,
    .sidebar-logout,
    .sidebar-user,
    .sidebar-xp-bar { transition: none; }
    .sidebar-xp-bar::after { animation: none; }
}

.d314-dashboard .nav-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.sidebar-logout:focus-visible {
    outline: 2px solid var(--danger-color);
    outline-offset: -2px;
}