:root {
    /* Palette Mode Clair (par défaut) */
    --bg-main: #f8fafc;
    --nav-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --hover-bg: #f1f5f9;

    /* Bouton Actif */
    --active-bg: #000000;
    --active-icon: #ffffff;
    --active-text: #0284C7; /*f5a623*/

    --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --nav-width: 250px;
}

:root[data-theme="dark"] {
    /* Palette Mode Sombre */
    --bg-main: #020617;
    --nav-bg: #0f172a;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: #1e293b;
    --hover-bg: #1e293b;

    /* Bouton Actif en mode sombre (légèrement ajusté pour le contraste) */
    --active-bg: #1e293b; 
    --active-icon: #ffffff;
    --active-text: #0284C7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-ui);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden; 
    transition: background-color 0.3s ease, color 0.3s ease;
}

.lifeup-layout {
    display: flex;
    height: 100vh;
    height: 100dvh; 
    width: 100vw;
}

/* --- Barre de navigation --- */
.lifeup-nav {
    width: var(--nav-width);
    background-color: var(--nav-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.2rem; /* Espacement ajusté */
    z-index: 10;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.brand {
    margin-bottom: 2.5rem;
    padding: 0 0.5rem;
}

.logo-text {
    font-size: 1.75rem;
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--text-primary);
}

.nav-links {
    list-style: none;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tab-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.tab-btn .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit; /* Prend la couleur du texte par défaut */
}

.tab-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

/* Style de l'onglet actif (correspondant exactement à la photo) */
.tab-btn.active {
    background-color: var(--active-bg);
}

.tab-btn.active .icon {
    color: var(--active-icon); /* Icône blanche */
}

.tab-btn.active .label {
    color: var(--active-text); /* Texte Orange */
    font-weight: 600;
}

.nav-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.back-vivasky {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.back-vivasky:hover {
    color: var(--text-primary);
}

/* Gestion du bouton thème (Alternance Soleil/Lune) */
.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: background-color 0.2s, color 0.2s;
}

.icon-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.theme-icon-sun { display: none; }
.theme-icon-moon { display: block; }
:root[data-theme="dark"] .theme-icon-sun { display: block; }
:root[data-theme="dark"] .theme-icon-moon { display: none; }

/* --- Espace de chargement du module --- */
.module-viewer {
    flex-grow: 1;
    position: relative;
    background-color: var(--bg-main);
}

#module-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* --- Adaptation Mobile --- */
@media (max-width: 768px) {
    .lifeup-layout { flex-direction: column-reverse; }
    
    .lifeup-nav {
        width: 100%;
        height: auto;
        min-height: 70px;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border);
        justify-content: space-around;
        align-items: center;
        padding: 5px 0 calc(10px + env(safe-area-inset-bottom)) 0; 
    }
    
    .brand, .nav-footer { display: none; }
    
    .nav-links {
        flex-direction: row;
        width: 100%;
        justify-content: space-around;
        gap: 0;
    }
    
    .tab-btn {
        flex-direction: column;
        gap: 0.3rem;
        padding: 0.5rem;
        border-radius: 0;
    }
    
    .tab-btn .label { font-size: 0.7rem; }
    
    .tab-btn.active {
        background-color: transparent;
    }
    
    .tab-btn.active .icon {
        color: var(--active-text); /* En mobile, l'icône devient orange pour ressortir */
    }
}