/* =============================================================================
   CURIO - Design System
   ============================================================================= */

/* Local Sniglet Font */
@font-face {
    font-family: 'Sniglet';
    src: url('/assets/fonts/Sniglet-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Sniglet';
    src: url('/assets/fonts/Sniglet-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

/* Local Satisfy Font (Cursive) */
@font-face {
    font-family: 'Satisfy';
    src: url('/assets/fonts/Satisfy-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Variables locales héritant de theme.css */
:root {
    /* Aliases pour compatibilité avec le code existant */
    --primary-blue: var(--color-primary);
    --primary-purple: var(--color-accent);
    --primary-orange: var(--color-warning);
    --primary-red: var(--color-danger);
    --primary-green: var(--color-success);

    --bg-sidebar: var(--gradient-sidebar);
    --bg-main: var(--color-bg-primary);
    --bg-card: var(--color-bg-secondary);

    --text-dark: var(--color-text-primary);
    --text-gray: var(--color-text-muted);
    --text-light: var(--color-text-light);
    --text-white: var(--color-text-white);

    --shadow-card: var(--shadow-card);

    --sidebar-collapsed: var(--sidebar-width-collapsed);
    --sidebar-expanded: var(--sidebar-width-expanded);
}

/* Sniglet font loaded from Google Fonts in HTML */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-primary);
}

body {
    font-family: 'Sniglet', sans-serif;
    background: var(--bg-main);
    color: var(--text-dark);
    min-height: 100vh;
}

/* =============================================================================
   Layout
   ============================================================================= */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* =============================================================================
   Sidebar - Gradient, overlay, click-to-open
   =============================================================================

   MODE SWITCHER:
   - Par défaut: Mode "pop-out" (chaque onglet sort individuellement)
   - Ajouter classe .sidebar-expand-mode sur <body> pour revenir à l'ancien mode
     où toute la sidebar s'élargit au survol
*/

.sidebar {
    width: var(--sidebar-collapsed);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: fixed;
    height: 100vh;
    z-index: 200;
    padding: 8px 0;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible; /* Changed from hidden to allow pop-out */
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}

/* Mode ancien: sidebar s'élargit (activé via .sidebar-expand-mode sur body) */
body.sidebar-expand-mode .sidebar {
    overflow: hidden;
}

body.sidebar-expand-mode .sidebar.open {
    width: var(--sidebar-expanded);
}

/* Mode par défaut: sidebar reste fixe, pas d'expansion globale */
.sidebar.open {
    width: var(--sidebar-collapsed); /* Reste à la même largeur */
}

.sidebar.no-transition,
.sidebar.no-transition *,
.sidebar.no-transition .sidebar-logo-img {
    transition: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR - Nouvelle structure simplifiée
   ═══════════════════════════════════════════════════════════════════════════ */

/* Avatar rond - en haut de la sidebar */
.sidebar-avatar {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px 0 12px 0;
}

.sidebar-avatar img {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

/* Prénom */
.sidebar-child-name {
    font-family: 'Sniglet', sans-serif;
    font-size: 1.25rem;
    font-weight: 400;
    color: white;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    padding: 6px 8px;
    margin: 0 auto;
}

/* Section crédits */
.sidebar-credits {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6px 6px 4px 6px;
    width: 100%;
}

.sidebar-credits-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 22px;
    border: none;
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-family: 'Sniglet', sans-serif;
    font-size: 1.3rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-credits-badge:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.05);
}

.sidebar-credits-badge.credits-zero {
    background: rgba(239, 68, 68, 0.7);
}

.sidebar-credits-badge .credits-drop {
    font-size: 1.3rem;
}

.sidebar-credits-badge .credits-count {
    font-size: 1.4rem;
    font-weight: 500;
}

/* Bouton + pour ajouter des crédits (sous le badge) */
.sidebar-credits-add {
    display: flex;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: white;
    color: var(--primary-blue);
    font-size: 1rem;
    font-weight: 400;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    margin: 0 auto 10px auto;
}

.sidebar-credits-add:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
    padding: 10px 4px 10px 8px;
    margin-top: 0;
    justify-content: space-evenly;
    overflow: visible; /* Allow items to pop out */
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODE POP-OUT (par défaut): Chaque onglet sort individuellement au survol
   Les labels DÉBORDENT vers la droite de la sidebar
   ═══════════════════════════════════════════════════════════════════════════ */

.nav-item {
    display: flex;
    align-items: center;
    gap: 0;
    width: auto;
    min-width: 90px;
    padding: 16px 12px;
    justify-content: center;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Sniglet', sans-serif;
    font-size: 1.1rem;
    white-space: nowrap;
    position: relative;
    z-index: 1;
    margin: 6px 0;
}

.nav-item:hover {
    /* L'onglet DÉBORDE vers la droite avec fond solide */
    padding: 18px 26px 18px 16px;
    /* Fond solide reprenant les couleurs de la sidebar */
    background: linear-gradient(135deg, #6B5B95 0%, #8B5CF6 100%);
    color: white;
    border-radius: 16px 24px 24px 16px;
    box-shadow:
        4px 4px 18px rgba(0, 0, 0, 0.4),
        0 0 0 3px rgba(255, 255, 255, 0.15);
    z-index: 100;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 400;
}

.nav-item.active:hover {
    background: linear-gradient(135deg, #7B6BA5 0%, #9B6CF6 100%);
}

/* Animation clignotement pour "Mes activités" après génération */
@keyframes navItemPulse {
    0%, 100% {
        background: rgba(255, 255, 255, 0.15);
        box-shadow: none;
    }
    50% {
        background: linear-gradient(135deg, #F59E0B 0%, #F97316 100%);
        box-shadow: 0 0 12px rgba(249, 115, 22, 0.6);
    }
}

.nav-item.needs-attention {
    /* Style désactivé - pas de changement visuel */
    animation: none;
}

.nav-item.needs-attention:hover {
    animation: none;
}

.nav-item-icon {
    font-size: 2.2rem;
    flex-shrink: 0;
    width: 44px;
    text-align: center;
    transition: transform 0.25s ease;
}

.nav-item:hover .nav-item-icon {
    transform: scale(1.15);
}

.nav-item-label {
    display: block;
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: width 0.3s ease, opacity 0.25s ease, padding 0.3s ease;
    font-size: 1.3rem;
    padding-left: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-weight: 400;
}

.nav-item:hover .nav-item-label {
    width: auto;
    opacity: 1;
    padding-left: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODE EXPAND (ancien): Toute la sidebar s'élargit au survol
   Activer en ajoutant .sidebar-expand-mode sur <body>
   ═══════════════════════════════════════════════════════════════════════════ */

body.sidebar-expand-mode .sidebar-nav {
    overflow: hidden;
}

body.sidebar-expand-mode .sidebar.open .sidebar-nav {
    gap: 0;
    padding: 15px 8px;
    justify-content: space-between;
    height: 100%;
    flex: 1;
}

body.sidebar-expand-mode .nav-item {
    gap: var(--spacing-md);
    width: 100%;
    padding: 10px;
    overflow: visible;
    position: static;
    transform: none;
}

body.sidebar-expand-mode .nav-item:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 30px 10px;
    width: 100%;
    min-width: unset;
    border-radius: 12px;
    box-shadow: none;
    transform: none;
}

body.sidebar-expand-mode .nav-item.active {
    padding: 30px 10px;
}

body.sidebar-expand-mode .nav-item-icon {
    font-size: 2.2rem;
}

body.sidebar-expand-mode .nav-item:hover .nav-item-icon {
    transform: none;
}

body.sidebar-expand-mode .nav-item-label {
    display: none;
    max-width: none;
    opacity: 0;
    margin-left: 0;
}

body.sidebar-expand-mode .nav-item:hover .nav-item-label {
    max-width: none;
    margin-left: 0;
}

body.sidebar-expand-mode .sidebar.open .nav-item {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2px 8px;
    gap: 0;
    text-align: center;
    line-height: 1;
}

body.sidebar-expand-mode .sidebar.open .nav-item:hover,
body.sidebar-expand-mode .sidebar.open .nav-item.active {
    padding: 22px 10px;
}

body.sidebar-expand-mode .sidebar.open .nav-item-icon {
    font-size: 2rem;
    width: auto;
    line-height: 1;
}

body.sidebar-expand-mode .sidebar.open .nav-item-label {
    display: block;
    opacity: 1;
    font-size: 1.5rem;
    margin-top: -2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-weight: 400;
}


/* =============================================================================
   Child Profile - Top Right (bigger)
   ============================================================================= */

.child-profile-topright {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(calc(-50% + 113px));
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 16px;
    border-radius: 50px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid #4A90D9;
}

.child-profile-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    border: none;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
    display: block;
    flex-shrink: 0;
}

.child-profile-avatar:hover {
    transform: scale(1.08);
}

.child-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.child-profile-name {
    font-family: 'Sniglet', sans-serif;
    font-size: 1.6rem;
    color: #1e3a8a;
    font-weight: 400;
    white-space: nowrap;
}

.child-profile-add {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px dashed #C4B5FD;
    background: white;
    color: var(--primary-purple);
    font-size: 1.3rem;
    font-weight: 400;
    line-height: 1;
    padding-top: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.child-profile-add:hover {
    background: var(--primary-purple);
    color: white;
    border-color: var(--primary-purple);
}

/* Credits badge */
.credits-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 20px;
    border: none;
    background: var(--primary-blue);
    color: white;
    font-family: 'Sniglet', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.credits-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.4);
}

.credits-badge.credits-zero {
    background: var(--primary-red);
}

.credits-badge.credits-zero:hover {
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.credits-drop {
    font-size: 1.1rem;
}

.credits-count {
    min-width: 16px;
    text-align: center;
}

/* Credits add button (blue like credits badge) */
.credits-add {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--primary-blue);
    color: white;
    font-size: 1.3rem;
    font-weight: 400;
    line-height: 1;
    padding-top: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.credits-add:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(74, 144, 217, 0.4);
}

/* Utility */
.hidden {
    display: none !important;
}

/* =============================================================================
   Main Content - no shift when sidebar opens (overlay)
   ============================================================================= */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-collapsed);
    padding: var(--spacing-sm);
    background-color: #FFFFFF;
    background-image: var(--bg-seyes);
    background-size: 100% 100%;
    min-height: 100vh;
    overflow-y: auto;
    transition: margin-left 0.3s ease;
}

/* Mode expand uniquement: ajuster le contenu quand la sidebar s'élargit */
body.sidebar-expand-mode .sidebar.open ~ .main-content:has(.activites-page) {
    margin-left: var(--sidebar-expanded);
}

body.sidebar-expand-mode .sidebar.open ~ .main-content:has(.notebook-container) {
    margin-left: var(--sidebar-expanded);
}

body.sidebar-expand-mode .sidebar.open ~ .main-content .notebook-container {
    max-width: 100%;
    padding: 10px;
}

body.sidebar-expand-mode .sidebar.open ~ .main-content .notebook-page {
    padding: 40px 15px 10px 15px;
}

body.sidebar-expand-mode .sidebar.open ~ .main-content .notebook-page.right-page {
    padding-left: 60px;
}

body.sidebar-expand-mode .sidebar.open ~ .main-content .notebook-binding {
    width: 40px;
}

.page-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-md);
    border-bottom: none;
}

.page-title {
    font-size: 2rem;
    font-weight: 400;
    color: var(--text-dark);
    text-decoration: none;
    position: relative;
    display: inline-block;
    padding: 4px 16px;
    background: linear-gradient(180deg, transparent 50%, #FDE68A 50%);
    border-radius: 4px;
    font-family: 'Sniglet', sans-serif;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

/* =============================================================================
   Cards
   ============================================================================= */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.card-icon.blue { background: rgba(74, 144, 217, 0.1); color: var(--primary-blue); }
.card-icon.orange { background: rgba(249, 115, 22, 0.1); color: var(--primary-orange); }
.card-icon.green { background: rgba(34, 197, 94, 0.1); color: var(--primary-green); }
.card-icon.purple { background: rgba(139, 92, 246, 0.1); color: var(--primary-purple); }

.card-title {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-dark);
}

/* =============================================================================
   Compétences
   ============================================================================= */

.competences-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    height: calc(100vh - 40px);
    padding-top: var(--spacing-xs);
    width: 98%;
    max-width: 1800px;
    margin: 0 auto;
    padding-top: 62px;
}

.competence-list {
    background: var(--bg-card);
    border-radius: 28px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 3px solid;
    max-height: calc(100vh - 180px);
}

.competence-list:first-child { border-color: #A78BFA; }
.competence-list:last-child { border-color: #F87171; }

.competence-list-header {
    padding: var(--spacing-md) var(--spacing-lg);
    color: white;
    font-weight: 400;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.competence-list-header.centered { justify-content: center; }
.competence-list-header span:first-child { font-size: 1.5rem; }
.competence-list-header.francais { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.competence-list-header.maths { background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%); }

.competence-list-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-sm);
    gap: var(--spacing-sm);
    overflow: hidden;
}

.difficulty-section.fixed {
    flex: 1;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.difficulty-section[data-difficulty="facile"] { border-color: #4ade80; background: linear-gradient(to bottom, #F0FDF4, white); }
.difficulty-section[data-difficulty="moyen"] { border-color: #fbbf24; background: linear-gradient(to bottom, #FFFBEB, white); }
.difficulty-section[data-difficulty="difficile"] { border-color: #f87171; background: linear-gradient(to bottom, #FEF2F2, white); }

.difficulty-label {
    font-family: 'Sniglet', sans-serif;
    font-size: 1.3rem;
    font-weight: 400;
    text-align: center;
    padding: 8px 0;
    color: white;
    border-radius: 10px 10px 0 0;
}

.difficulty-section[data-difficulty="facile"] .difficulty-label { background: #4ade80; }
.difficulty-section[data-difficulty="moyen"] .difficulty-label { background: #fbbf24; }
.difficulty-section[data-difficulty="difficile"] .difficulty-label { background: #f87171; }

.difficulty-header-fixed {
    padding: 6px var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.difficulty-title { font-weight: 400; color: var(--text-dark); font-size: 0.85rem; }
.difficulty-emoji { font-size: 1rem; }

.difficulty-content {
    flex: 1;
    overflow-y: auto;
    background: white;
    padding: 2px 0;
    min-height: 0;
    scrollbar-width: auto;
    scrollbar-color: #64748b #f1f5f9;
    border-radius: 8px 8px 10px 10px;
}
.difficulty-content::-webkit-scrollbar { width: 20px; }
.difficulty-content::-webkit-scrollbar-track { background: #e2e8f0; border-radius: 10px; margin: 4px; }
.difficulty-content::-webkit-scrollbar-thumb { background-color: #475569; border-radius: 10px; min-height: 80px; }

.difficulty-chevron { display: none; }

.competence-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px dashed #E5E7EB;
    gap: 4px;
    transition: background 0.2s;
}

.competence-item-header {
    display: flex;
    align-items: center;
    width: 100%;
    gap: var(--spacing-sm);
}

.competence-item:hover { background: rgba(139, 92, 246, 0.05); }
.competence-item:last-child { border-bottom: none; }

/* Checkbox cachée - sélection par liste dans génération manuelle */
.competence-checkbox {
    display: none;
}

.competence-text { flex: 1; font-size: 0.8rem; color: var(--text-dark); line-height: 1.3; font-weight: 400; }

/* Boutons d'action pour chaque compétence */
.competence-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
    width: 100%;
}

.competence-btn {
    font-family: 'Sniglet', sans-serif;
    font-size: 0.9rem;
    padding: 5px 12px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.competence-btn.lecon-btn {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border: 1px solid #f59e0b;
}

.competence-btn.lecon-btn:hover {
    background: linear-gradient(135deg, #fde68a, #fcd34d);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.competence-btn.select-btn {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
    border: 1px solid #3b82f6;
}

.competence-btn.select-btn:hover {
    background: linear-gradient(135deg, #bfdbfe, #93c5fd);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.competence-btn-icon {
    font-size: 0.75rem;
}

.competence-weight { display: flex; align-items: center; gap: 4px; }

.weight-btn {
    width: 24px; height: 24px;
    border: 1px solid #E5E7EB; border-radius: 4px;
    background: white; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; color: var(--text-gray); transition: all 0.2s;
}
.weight-btn:hover { border-color: var(--primary-blue); color: var(--primary-blue); }

.weight-bars { display: flex; gap: 2px; }
.weight-bar { width: 4px; height: 12px; background: #E5E7EB; border-radius: 2px; transition: background 0.2s; }
.weight-bar.active { background: var(--primary-blue); }

/* =============================================================================
   Soulignement des compétences utilisées
   ============================================================================= */

.competence-item.usage-1 { border-left: 3px solid #22C55E; background: linear-gradient(to right, rgba(34, 197, 94, 0.08), transparent); }
.competence-item.usage-2 { border-left: 3px solid #8B5CF6; background: linear-gradient(to right, rgba(139, 92, 246, 0.08), transparent); }

.usage-indicator {
    font-size: 0.7rem; color: white;
    background: linear-gradient(135deg, #22C55E, #16A34A);
    padding: 2px 6px; border-radius: 10px; font-weight: 400;
    margin-left: auto; margin-right: 8px; flex-shrink: 0;
}
.competence-item.usage-2 .usage-indicator { background: linear-gradient(135deg, #8B5CF6, #7C3AED); }

/* =============================================================================
   Gauge
   ============================================================================= */

.gauge-container { display: flex; align-items: center; gap: var(--spacing-lg); }
.gauge-bars { display: flex; gap: 4px; flex: 1; }
.gauge-bar { flex: 1; height: 40px; background: #E5E7EB; border-radius: var(--radius-sm); transition: background 0.3s; }
.gauge-bar.filled { background: linear-gradient(180deg, #22C55E 0%, #16A34A 100%); }
.gauge-bar.filled.warning { background: linear-gradient(180deg, #F97316 0%, #EA580C 100%); }
.gauge-bar.next {
    background: repeating-linear-gradient(45deg, #E5E7EB, #E5E7EB 5px, #D1D5DB 5px, #D1D5DB 10px);
    position: relative;
}
.gauge-bar.next::after { content: "▲"; position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 0.6rem; color: var(--primary-orange); }
.gauge-value { text-align: center; }
.gauge-percentage { font-size: 2rem; font-weight: 400; color: var(--primary-green); }
.gauge-label { font-size: 0.8rem; color: var(--text-gray); }

/* =============================================================================
   Responsive - Tablet (1024px)
   ============================================================================= */

@media (max-width: 1024px) {
    .competences-container {
        grid-template-columns: 1fr;
        padding-top: 80px;
        height: auto;
        min-height: calc(100vh - 40px);
    }

    .competence-list {
        max-height: none;
        margin-bottom: 20px;
    }

    .notebook-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 20px);
    }

    .notebook-spread {
        flex-direction: column;
        height: auto;
    }

    .notebook-binding {
        display: none;
    }

    .notebook-page {
        border-radius: 12px !important;
        margin-bottom: 20px;
        box-shadow: none !important;
        min-height: 400px;
    }

    .notebook-page.left-page,
    .notebook-page.right-page {
        padding: 20px;
        border: none;
    }

    .child-profile-topright {
        transform: translateX(-50%);
        left: 50%;
    }
}

/* =============================================================================
   Responsive - Mobile (768px)
   ============================================================================= */

@media (max-width: 768px) {
    :root {
        --sidebar-collapsed: 0px;
        --sidebar-expanded: 100%;
    }

    /* Sidebar devient un menu hamburger */
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
        flex-direction: row;
        padding: 8px 16px;
        z-index: 300;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        width: 100%;
        transform: translateY(0);
        height: 100vh;
        flex-direction: column;
        padding: 20px;
        overflow-y: auto;
    }

    .sidebar-nav {
        flex-direction: row;
        gap: 0;
        flex-wrap: wrap;
        justify-content: center;
    }

    .sidebar.open .sidebar-nav {
        flex-direction: column;
        gap: 10px;
    }

    .nav-item {
        padding: 8px;
        font-size: 0.9rem;
    }

    .nav-item-icon {
        font-size: 1.5rem;
        width: 30px;
    }

    .sidebar.open .nav-item-label {
        font-size: 1.2rem;
        /* Override pop-out mode styles for mobile */
        max-width: none;
        opacity: 1;
        margin-left: 8px;
        display: block;
    }

    .sidebar.open .nav-item {
        /* Reset pop-out transforms for mobile */
        transform: none;
        width: 100%;
        min-width: unset;
        border-radius: 12px;
        box-shadow: none;
        padding: 12px 16px;
        justify-content: flex-start;
    }

    .sidebar.open .nav-item:hover {
        transform: none;
        padding: 12px 16px;
        background: rgba(255, 255, 255, 0.2);
    }

    /* Mobile: larger sidebar elements when open */
    .sidebar.open .sidebar-avatar img {
        width: 60px;
        height: 60px;
    }

    .sidebar.open .sidebar-child-name {
        font-size: 1.3rem;
        max-width: 200px;
    }

    .sidebar.open .sidebar-credits-badge {
        padding: 6px 12px;
        font-size: 1rem;
    }

    /* Main content full width on mobile */
    .main-content {
        margin-left: 0;
        padding: 10px;
        padding-top: 70px; /* Space for mobile header */
    }

    /* Child profile - mobile header */
    .child-profile-topright {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        transform: none;
        justify-content: space-between;
        padding: 8px 12px;
        z-index: 250;
    }

    .child-profile-name {
        display: none;
    }

    .child-profile-avatar {
        width: 36px;
        height: 36px;
    }

    .credits-badge {
        padding: 4px 10px;
        font-size: 0.85rem;
    }

    /* Mobile menu toggle button */
    .mobile-menu-toggle {
        display: flex !important;
        width: 36px;
        height: 36px;
        background: linear-gradient(135deg, #4A90D9, #8B5CF6);
        border: none;
        border-radius: 10px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: white;
        font-size: 1.3rem;
    }

    /* Page titles */
    .page-title {
        font-size: 1.5rem;
        padding: 4px 12px;
    }

    .page-header {
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    /* Competences mobile */
    .competences-container {
        grid-template-columns: 1fr;
        padding: 10px;
        padding-top: 70px;
        gap: 15px;
        height: auto;
    }

    .competence-list {
        max-height: none;
        border-width: 2px;
    }

    .competence-list-header {
        padding: 10px 15px;
        font-size: 1.1rem;
    }

    .competence-item {
        padding: 8px 12px;
    }

    .competence-text {
        font-size: 0.75rem;
    }

    .difficulty-header-fixed {
        padding: 5px 10px;
    }

    .difficulty-title {
        font-size: 0.75rem;
    }

    /* Notebook mobile */
    .notebook-container {
        padding: 5px;
        height: auto;
    }

    .notebook-spread {
        flex-direction: column;
        box-shadow: none;
        border-radius: 8px;
    }

    .notebook-binding {
        display: none;
    }

    .notebook-page {
        border-radius: 8px !important;
        margin-bottom: 15px;
        padding: 15px !important;
        min-height: 300px;
    }

    .notebook-page.left-page,
    .notebook-page.right-page {
        border: 2px solid #e5e7eb;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
        background: white !important;
    }

    .notebook-header-text {
        font-size: 1.8rem;
    }

    .notebook-header-curio {
        width: 50px;
        height: 50px;
    }

    /* Cards mobile */
    .card {
        padding: 15px;
        border-radius: 16px;
    }

    .card-header {
        gap: 10px;
        margin-bottom: 12px;
    }

    .card-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .card-title {
        font-size: 1rem;
    }

    /* Modal mobile */
    .modal {
        margin: 15px;
        max-width: calc(100% - 30px);
        padding: 20px;
    }

    .modal-title {
        font-size: 1.1rem;
    }

    /* Buttons mobile */
    .btn {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    /* Gauge mobile */
    .gauge-container {
        flex-direction: column;
        gap: 10px;
    }

    .gauge-bars {
        width: 100%;
    }

    .gauge-bar {
        height: 30px;
    }

    .gauge-percentage {
        font-size: 1.5rem;
    }
}

/* =============================================================================
   Responsive - Small Mobile (480px)
   ============================================================================= */

@media (max-width: 480px) {
    .main-content {
        padding: 8px;
        padding-top: 65px;
    }

    .child-profile-topright {
        padding: 6px 10px;
        gap: 6px;
    }

    .child-profile-avatar {
        width: 32px;
        height: 32px;
    }

    .child-profile-add {
        width: 28px;
        height: 28px;
        font-size: 1.1rem;
    }

    .credits-add {
        width: 28px;
        height: 28px;
        font-size: 1.1rem;
    }

    .credits-badge {
        padding: 3px 8px;
        font-size: 0.8rem;
    }

    .page-title {
        font-size: 1.3rem;
    }

    .competence-list-header {
        font-size: 1rem;
        padding: 8px 12px;
    }

    .competence-text {
        font-size: 0.7rem;
    }

    .notebook-header-text {
        font-size: 1.5rem;
    }

    .notebook-header-curio {
        width: 40px;
        height: 40px;
    }

    .modal {
        margin: 10px;
        padding: 15px;
    }

    .form-input,
    .form-select {
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* =============================================================================
   Mobile Menu Button (shown only on mobile)
   ============================================================================= */

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #4A90D9, #8B5CF6);
    border: none;
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 1.5rem;
    z-index: 350;
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.mobile-menu-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(74, 144, 217, 0.4);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* =============================================================================
   Hide sidebar on mobile by default, show when toggled
   ============================================================================= */

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    body.sidebar-open .sidebar {
        transform: translateY(0);
    }

    body.sidebar-open .main-content {
        opacity: 0.3;
        pointer-events: none;
    }

    body.sidebar-open .mobile-menu-toggle {
        background: linear-gradient(135deg, #EF4444, #DC2626);
    }

    body.sidebar-open .mobile-menu-toggle::after {
        content: '✕';
        font-size: 1.3rem;
    }

    body.sidebar-open .mobile-menu-toggle span {
        display: none;
    }
}

/* =============================================================================
   Modal
   ============================================================================= */

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-overlay.active { display: flex; }

.modal {
    background: white; border-radius: var(--radius-xl);
    padding: var(--spacing-xl); width: 100%; max-width: 400px;
    box-shadow: var(--shadow-lg); animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--spacing-lg); }
.modal-title { font-size: 1.25rem; font-weight: 400; color: var(--text-dark); }

.modal-close {
    width: 32px; height: 32px; border: none; background: #F3F4F6;
    border-radius: var(--radius-full); cursor: pointer; font-size: 1.25rem;
    color: var(--text-gray); display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.modal-close:hover { background: #E5E7EB; color: var(--text-dark); }

.modal-body { display: flex; flex-direction: column; gap: var(--spacing-md); }
.form-group { display: flex; flex-direction: column; gap: var(--spacing-xs); }
.form-label { font-size: 0.875rem; font-weight: 400; color: var(--text-dark); }

.form-input,
.form-select {
    padding: var(--spacing-md); border: 1px solid #E5E7EB;
    border-radius: var(--radius-md); font-size: 0.95rem; transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus { outline: none; border-color: var(--primary-purple); }

.modal-actions { display: flex; gap: var(--spacing-md); margin-top: var(--spacing-lg); }

.btn {
    flex: 1; padding: var(--spacing-md) var(--spacing-lg); border: none;
    border-radius: var(--radius-md); font-size: 0.95rem; font-weight: 400;
    cursor: pointer; transition: all 0.2s;
}
.btn-secondary { background: #F3F4F6; color: var(--text-dark); }
.btn-secondary:hover { background: #E5E7EB; }
.btn-primary { background: var(--primary-purple); color: white; }
.btn-primary:hover { background: #7C3AED; }

/* Paywall option hover */
.paywall-option:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
    transition: all 0.2s;
}

/* =============================================================================
   Bouton pondération
   ============================================================================= */

.weight-btn-minus {
    width: 24px; height: 24px; border: 1px solid #E5E7EB; border-radius: 4px;
    background: white; cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; color: var(--text-gray); transition: all 0.2s;
}
.weight-btn-minus:hover { border-color: var(--primary-red); color: var(--primary-red); }

/* =============================================================================
   DESIGN CAHIER COLORÉ (Mes Compétences)
   ============================================================================= */

.notebook-container {
    display: flex; justify-content: center; align-items: stretch;
    padding: 5px; height: calc(100vh - 10px);
    width: 100%; max-width: 1600px; margin: 0 auto; margin-top: 2px;
}

.notebook-spread {
    display: flex; width: 100%; height: 100%;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 10px #3B82F6;
    position: relative;
    background: #fff; /* Fond uniforme blanc */
}

/* Reliure masquée - fond uniforme */
.notebook-binding {
    display: none;
}

.binding-ring {
    display: none;
}

.notebook-page {
    flex: 1; background-color: #fff; background-image: var(--bg-seyes);
    padding: 20px 20px 5px 20px; display: flex; flex-direction: column;
    position: relative; overflow: hidden;
}

.notebook-page.left-page {
    border-top-left-radius: 8px; border-bottom-left-radius: 8px;
    padding-right: 25px;
    background: #fff;
    background-image: var(--bg-seyes);
    border-right: 1px solid #e0e0e0;
    box-shadow: inset -8px 0 12px -10px rgba(0, 0, 0, 0.08);
}

.notebook-page.right-page {
    border-top-right-radius: 8px; border-bottom-right-radius: 8px;
    padding-left: 25px;
    background: #fff;
    background-image: var(--bg-seyes);
    border-left: 1px solid #e0e0e0;
    box-shadow: inset 8px 0 12px -10px rgba(0, 0, 0, 0.08);
}

.notebook-header-text {
    font-family: 'Sniglet', sans-serif; font-size: 2.5rem; font-weight: 400;
    display: table; margin: 0 auto 4px auto; text-transform: none;
    letter-spacing: -0.02em; border-bottom: none; padding-bottom: 2px;
}

.notebook-header-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
    position: relative;
}

.notebook-header-wrapper .notebook-header-text {
    margin: 0;
}

.notebook-header-curio {
    width: 85px;
    height: 85px;
    object-fit: contain;
}

.francais-theme .notebook-header-text { color: #2563eb; }
.maths-theme .notebook-header-text { color: #dc2626; }

.notebook-header-icon, .competence-intro-text, .dice-section { display: none !important; }

.notebook-page .competence-list { background: transparent; box-shadow: none; border: none; height: 100%; display: flex; flex-direction: column; }
.notebook-page .competence-list-header { display: none; }

.notebook-page .competence-list-body {
    flex: 1; padding: 0; gap: 15px; overflow-y: auto;
    padding-right: 10px; padding-bottom: 8px;
    scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent;
    display: flex; flex-direction: column;
}
.notebook-page .competence-list-body::-webkit-scrollbar { width: 6px; }
.notebook-page .competence-list-body::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 28px; }

.notebook-page .difficulty-section.fixed {
    margin: 0 4px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    background: white; border-radius: 16px; border-style: solid; border-width: 8px;
    flex: 1; min-height: 0; overflow-y: auto;
    scrollbar-width: auto; scrollbar-color: #94a3b8 transparent;
}
.notebook-page .difficulty-section.fixed::-webkit-scrollbar { width: 42px; }
.notebook-page .difficulty-section.fixed::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 21px; margin: 8px 0; }
.notebook-page .difficulty-section.fixed::-webkit-scrollbar-thumb { background-color: #64748b; border-radius: 21px; border: 3px solid #f1f5f9; min-height: 50px; }

