/* ========================================
   PROFESSIONAL DARK THEME - CSS VARIABLES
   Modern, Sophisticated Color System
   ======================================== */

:root {
    /* Background Colors - Sophisticated Grayscale */
    --bg-darkest: #1a1a1a;          /* Deepest background - harmonized */
    --bg-dark: #1a1a1a;             /* Main app background - harmonized */
    --bg-primary: #1a1a1a;          /* Primary content background */
    --bg-secondary: #1a1a1a;        /* Secondary areas - harmonized */
    --bg-card: #1a1a1a;             /* Card backgrounds - harmonized */
    --bg-elevated: #2a2a2a;         /* Elevated elements (headers, hover) */
    --bg-elevated-hover: #2d2d2d;   /* Elevated hover state */
    --bg-subtle: #333333;           /* Subtle backgrounds */
    --bg-interactive-hover: #353535; /* Interactive element hover */
    
    /* Background Colors - Blue-Gray Variants (Optional Depth) */
    --bg-bluegray-dark: #1e2432;    /* Blue-tinted dark */
    --bg-bluegray: #252d3a;         /* Blue-tinted medium */
    
    /* Text Colors - Clear Hierarchy */
    --text-primary: #e8e8e8;        /* Primary text - high emphasis */
    --text-primary-bright: #f0f0f0; /* Brightest text */
    --text-secondary: #b0b0b0;      /* Secondary text - medium emphasis */
    --text-tertiary: #9e9e9e;       /* Tertiary text - low emphasis */
    --text-muted: #7a7a7a;          /* Muted text */
    --text-disabled: #6e6e6e;       /* Disabled text */
    --text-subtle: #5a5a5a;         /* Very subtle text */
    
    /* Accent Colors - Brand Identity */
    --accent-orange: #E77D01;       /* Primary orange accent */
    --accent-orange-hover: #D16D01; /* Orange hover state */
    --accent-orange-light: rgba(231, 125, 1, 0.1);
    --accent-orange-border: rgba(231, 125, 1, 0.3);
    
    --accent-blue: #3b82f6;         /* Primary blue accent */
    --accent-blue-hover: #2563eb;   /* Blue hover state */
    --accent-blue-light: rgba(59, 130, 246, 0.1);
    
    --accent-green: #10b981;        /* Success/positive */
    --accent-green-hover: #059669;  /* Green hover */
    --accent-red: #ef4444;          /* Error/negative */
    --accent-yellow: #f59e0b;       /* Warning */
    
    /* Border Colors - Subtle Separation */
    --border-subtle: #2a2a2a;       /* Very subtle borders */
    --border-primary: #3a3a3a;      /* Primary borders */
    --border-secondary: #404040;    /* Secondary borders */
    --border-light: #4a4a4a;        /* Lighter borders */
    --border-focus: #4a5568;        /* Focus state borders */
    
    /* Hover/Focus States */
    --hover-overlay: rgba(255, 255, 255, 0.05);
    --focus-ring: rgba(59, 130, 246, 0.4);
    --focus-ring-orange: rgba(231, 125, 1, 0.4);
    
    /* Shadows - Depth & Elevation */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.6);
    
    /* Spacing System */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ========================================
   SIDEBAR MODERNE - REFINED DARK THEME
   Clean, Borderless Design
   ======================================== */

/* Sidebar principale - sophisticated dark */
.sidebar {
    background-color: var(--bg-primary) !important;
    border-right: 1px solid var(--border-subtle);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.5);
}

/* Override des classes dark */
.sidebar-dark,
.sidebar.bg-dark {
    background-color: var(--bg-primary) !important;
}

/* Padding de la sidebar */
.sidebar-p-y {
    padding: 1.5rem 0;
}

/* Titres de section dans la sidebar */
.sidebar-heading {
    color: var(--text-disabled) !important;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 1rem 1.5rem 0.5rem 1.5rem;
    margin-top: 1.5rem;
}

.sidebar-heading:first-child {
    margin-top: 0.5rem;
}

/* Menu items */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
}

.sidebar-menu-item {
    margin: 0.125rem 0.5rem;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    position: relative;
}

/* Boutons de menu - clean, minimal */
.sidebar-menu-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    color: var(--text-secondary) !important;
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    font-weight: 500;
    font-size: 0.9375rem;
    width: 100%;
    background-color: transparent;
    border: none; /* NO BORDERS */
    position: relative;
}

.sidebar-menu-button:hover {
    background-color: var(--bg-elevated);
    color: var(--text-primary) !important;
    text-decoration: none;
}

/* Item actif - subtle orange accent */
.sidebar-menu-item.active .sidebar-menu-button {
    background-color: var(--bg-elevated);
    color: var(--text-primary-bright) !important;
    border: none; /* NO BORDERS */
}

.sidebar-menu-item.active .sidebar-menu-button::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: linear-gradient(180deg, #E77D01, #D16D01);
    border-radius: 0 2px 2px 0;
}

.sidebar-menu-item.active .sidebar-menu-button:hover {
    background-color: var(--bg-elevated-hover);
    color: var(--text-primary-bright) !important;
}

.sidebar-menu-item.active .sidebar-menu-icon {
    color: #E77D01 !important;
}

/* Section expandue/active - FULL ORANGE BACKGROUND */
.sidebar-js-collapse[aria-expanded="true"],
.sidebar-menu-button[aria-expanded="true"] {
    background: linear-gradient(90deg, var(--accent-orange, #E77D01) 0%, var(--accent-orange, #E77D01) 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: var(--radius-lg) !important;
    transition: all var(--transition-base, 0.2s ease) !important;
    box-shadow: 0 2px 8px rgba(255, 122, 61, 0.3) !important;
}

/* Override the default ::before for expanded sections */
.sidebar-menu-button.sidebar-js-collapse[aria-expanded="true"]::before {
    display: none !important;
    content: none !important;
}

/* Hover state with brighter orange */
.sidebar-js-collapse[aria-expanded="true"]:hover,
.sidebar-menu-button[aria-expanded="true"]:hover {
    background: linear-gradient(90deg, var(--accent-orange-hover, #D16D01) 0%, var(--accent-orange-hover, #D16D01) 100%) !important;
    color: #ffffff !important;
    border: none !important;
    transition: all var(--transition-base, 0.2s ease) !important;
    box-shadow: 0 4px 12px rgba(255, 122, 61, 0.4) !important;
    transform: translateX(2px);
}

/* Texte et icônes pour les sections expandues */
.sidebar-js-collapse[aria-expanded="true"] .sidebar-menu-text,
.sidebar-menu-button[aria-expanded="true"] .sidebar-menu-text,
.sidebar-js-collapse[aria-expanded="true"] .sidebar-menu-icon,
.sidebar-menu-button[aria-expanded="true"] .sidebar-menu-icon,
.sidebar-js-collapse[aria-expanded="true"] .theme-lesson-count,
.sidebar-menu-button[aria-expanded="true"] .theme-lesson-count {
    color: #ffffff !important;
}

/* Icônes du menu */
.sidebar-menu-icon {
    color: var(--text-tertiary) !important;
    font-size: 1.25rem;
    transition: color 0.2s ease;
}

.sidebar-menu-icon--left {
    margin-right: 1rem;
}

.sidebar-menu-button:hover .sidebar-menu-icon {
    color: var(--text-primary) !important;
}

/* Texte du menu */
.sidebar-menu-text {
    color: var(--text-secondary) !important;
    font-weight: 500;
    flex: 1;
}

.sidebar-menu-button:hover .sidebar-menu-text {
    color: var(--text-primary) !important;
}

.sidebar-menu-item.active .sidebar-menu-text {
    color: #ffffff !important;
}

/* Conteneur pour l'icône et le texte */
.sidebar-menu-button > .sidebar-menu-icon + .sidebar-menu-text {
    margin-right: 0.5rem;
}

/* Sous-menus */
.sidebar-submenu {
    list-style: none;
    padding-left: 0;
    margin: 0;
    background-color: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
}

.sidebar-submenu .sidebar-menu-item {
    margin: 0;
    border-radius: 0;
}

.sidebar-submenu .sidebar-menu-button {
    padding-left: 3rem;
    font-size: 0.9rem;
    border-radius: 0;
}

.sidebar-submenu .sidebar-menu-button:hover {
    background-color: var(--hover-bg);
}

/* Indentation des sous-menus */
.sm-indent {
    margin-left: 0.75rem;
    margin-right: 0.75rem;
}

/* Toggle icon pour les menus déroulants */
.sidebar-menu-toggle-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    margin-left: auto;
}

.sidebar-menu-toggle-icon::after {
    content: "keyboard_arrow_down";
    font-family: 'Material Icons';
    color: var(--text-tertiary);
    font-size: 1.25rem;
    display: block;
    line-height: 1;
}

.sidebar-js-collapse[aria-expanded="true"] .sidebar-menu-toggle-icon {
    transform: rotate(180deg);
}

.sidebar-js-collapse[aria-expanded="true"] .sidebar-menu-toggle-icon::after {
    color: #ffffff !important;
}

.sidebar-menu-item.active .sidebar-menu-toggle-icon::after {
    color: #ffffff;
}

/* Active button background */
.sm-active-button-bg .sidebar-menu-item.active {
    background-color: transparent;
}

/* Scrollbar personnalisée pour la sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
    }
}

/* Animation pour l'ouverture/fermeture */
.sidebar {
    transition: transform 0.3s ease;
}

/* États de hover améliorés */
.sidebar-menu-button {
    position: relative;
    overflow: hidden;
}

.sidebar-menu-button::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background-color: #E77D01;
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.sidebar-menu-item.active .sidebar-menu-button::before {
    transform: scaleY(1);
}

/* Badge ou notification (si nécessaire) */
.sidebar-badge {
    background-color: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    margin-left: auto;
}

/* Séparateur visuel entre les sections */
.sidebar-menu + .sidebar-heading {
    border-top: 1px solid var(--border-light);
    padding-top: 1.5rem;
}

/* ========================================
   COMPTEUR DE LEÇONS POUR LES THÈMES
   ======================================== */

/* Conteneur d'info du thème */
.theme-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
    line-height: 1.3;
    padding: 0.25rem 0;
    margin-right: 0.75rem;
}

/* Compteur de leçons sous le titre */
.theme-lesson-count {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted) !important;
    white-space: nowrap;
    text-transform: none;
    margin-top: 0.1rem;
}

/* Hover sur le bouton */
.sidebar-menu-button:hover .theme-lesson-count {
    color: var(--text-secondary) !important;
}

/* État actif */
.sidebar-menu-item.active .theme-lesson-count {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Section expandue - texte blanc pour le compteur */
.sidebar-js-collapse[aria-expanded="true"] .theme-lesson-count,
.sidebar-menu-button[aria-expanded="true"] .theme-lesson-count {
    color: #ffffff !important;
    opacity: 0.95;
}

/* Texte du thème */
.sidebar-menu .sidebar-menu-text {
    font-size: 0.95rem;
    font-weight: 700 !important;
    text-transform: none !important;
    letter-spacing: 0.5px;
}

/* Texte des modules - REMETTRE STYLE ORIGINAL */
.sidebar-submenu .sidebar-menu-text {
    font-size: 0.75rem;
    font-weight: 500 !important;
    text-transform: none !important;
    letter-spacing: normal;
}

/* Responsive */
@media (max-width: 768px) {
    .theme-lesson-count {
        font-size: 0.6rem;
    }
}
