/* assets/css/style.css */
/* Réinitialisation & Variables Globales */
:root {
    --bg-dark: #0b0f19;
    --bg-card: rgba(18, 25, 41, 0.7);
    --accent-math: #00e5ff;
    --accent-francais: #ff2a7a;
    --success: #00ff88;
    --danger: #ff3333;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border-glass: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    overflow-x: hidden;
    /* Pattern background discret type grille médicale */
    background-image:
        linear-gradient(var(--border-glass) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-glass) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center top;
    padding-bottom: 80px;
    /* Espace pour la bottom nav */
}

/* Typographie globale */
h1,
h2,
h3,
h4 {
    font-weight: 700;
}

a {
    color: var(--accent-math);
    text-decoration: none;
    transition: 0.3s;
}

a:hover {
    filter: brightness(1.2);
}

/* --- Utilitaire Glassmorphism --- */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* --- Topbar (Header Médical) --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar-svg {
    width: 45px;
    height: 45px;
}

.user-name {
    font-size: 1.1rem;
    margin: 0;
    color: #fff;
}

.user-grade {
    font-size: 0.8rem;
    color: var(--accent-math);
}

.topbar-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.vies-container {
    display: flex;
    gap: 4px;
}

.vie-icon {
    width: 20px;
    height: 20px;
}

.vie-icon.active {
    filter: drop-shadow(0 0 4px var(--danger));
}

.xp-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.xp-label {
    color: var(--success);
}

.xp-bar-bg {
    width: 80px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 99px;
    overflow: hidden;
}

.xp-bar-fill {
    height: 100%;
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* --- Layout Principal --- */
.main-content {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Login Form --- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-box {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    text-align: center;
}

.login-logo {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--accent-math);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.input-field {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    padding: 1rem;
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    transition: 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-math);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent-math), #00b3cc);
    color: var(--bg-dark);
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.6);
}

.error-msg {
    background: rgba(255, 51, 51, 0.1);
    color: var(--danger);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 51, 51, 0.2);
}

/* --- Dashboard (Hall) --- */
.dashboard-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.brain-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    position: relative;
}

.brain-svg {
    width: 100%;
    max-width: 400px;
    filter: drop-shadow(0 0 20px rgba(0, 229, 255, 0.1));
}

.brain-path {
    fill: rgba(255, 255, 255, 0.05);
    stroke: var(--border-glass);
    stroke-width: 2;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    transform-origin: center;
}

/* Nouvelles règles Premium */
.lobe-link {
    cursor: pointer;
}

.premium-lobe {
    stroke-width: 3;
}

.lobe-link:hover .premium-lobe.lobe-maths {
    filter: url(#glow-math);
    fill: rgba(0, 229, 255, 0.5);
    transform: scale(1.02) translateX(-5px);
}

.lobe-link:hover .premium-lobe.lobe-francais {
    filter: url(#glow-fr);
    fill: rgba(255, 42, 122, 0.5);
    transform: scale(1.02) translateX(5px);
}

.node-math,
.node-fr {
    transition: transform 0.3s, fill 0.3s;
}

.lobe-link:hover .node-math {
    fill: var(--accent-math);
    transform: scale(1.5);
}

.lobe-link:hover .node-fr {
    fill: var(--accent-francais);
    transform: scale(1.5);
}

@keyframes pulseData {
    0% {
        stroke-dashoffset: 0;
        opacity: 0.3;
    }

    50% {
        opacity: 0.8;
    }

    100% {
        stroke-dashoffset: 20;
        opacity: 0.3;
    }
}

.pulse-line {
    animation: pulseData 2s linear infinite;
}

/* Tooltip dynamique historique (optionnel si on utilise la data-tooltip globale) */
.brain-tooltip {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
}

.brain-tooltip.visible {
    opacity: 1;
}

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    background: rgba(11, 15, 25, 0.9);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-glass);
    padding: 0.8rem 0;
    padding-bottom: calc(0.8rem + env(safe-area-inset-bottom));
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.nav-item:hover,
.nav-item.active {
    color: var(--accent-math);
}

.nav-item.logout:hover {
    color: var(--danger);
}

/* --- Modules & Exercices --- */
.module-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media(min-width: 768px) {
    .module-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.module-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s;
}

.module-card:hover {
    transform: translateY(-5px);
}

.module-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
}

.math-card .module-icon {
    color: var(--accent-math);
}

.fr-card .module-icon {
    color: var(--accent-francais);
}

/* Elements interactifs divers */
.feedback-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.feedback-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.feedback-content {
    text-align: center;
    animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.feedback-icon {
    width: 100px;
    height: 100px;
    margin-bottom: 1rem;
}

/* Responsive adjustments */
@media(max-width: 400px) {
    .topbar-user {
        gap: 0.5rem;
    }

    .user-name {
        font-size: 0.9rem;
    }
}

/* Animations Gamification */
@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    50% {
        transform: translateX(10px);
    }

    75% {
        transform: translateX(-10px);
    }

    100% {
        transform: translateX(0);
    }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

@keyframes breakHeart {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 4px var(--danger));
    }

    50% {
        transform: scale(1.2) rotate(-10deg);
        filter: grayscale(50%);
    }

    100% {
        transform: scale(1) rotate(0);
        filter: grayscale(100%);
        fill: #334155;
    }
}

.vie-icon.lost-life {
    animation: breakHeart 0.5s forwards;
}

/* --- Premium Tooltips --- */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: rgba(15, 23, 42, 0.95);
    opacity: 0;
    transition: opacity 0.3s ease, margin-top 0.3s ease;
    z-index: 100;
    margin-top: -5px;
    pointer-events: none;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, margin-top 0.3s ease;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    margin-top: 7px;
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    margin-top: 12px;
}

[data-tooltip]:hover::before {
    margin-top: 0px;
}

/* --- Effet Scanline Premium --- */
@keyframes scanline {
    0% {
        transform: translateY(-100px);
        opacity: 0;
    }

    10% {
        opacity: 0.5;
    }

    50% {
        opacity: 0.8;
    }

    90% {
        opacity: 0.5;
    }

    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

.scanline-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 15vh;
    background: linear-gradient(to bottom, transparent, rgba(0, 229, 255, 0.05), transparent);
    pointer-events: none;
    animation: scanline 6s linear infinite;
    z-index: 9999;
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
}

/* --- Completed Module Styles --- */
.completed-module {
    opacity: 0.9;
    background: linear-gradient(145deg, rgba(0, 255, 136, 0.05), rgba(0, 0, 0, 0.4));
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.1);
}

.completed-module:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.2);
    border-color: rgba(0, 255, 136, 0.6) !important;
}

/* --- Tooltip enhancement --- */
[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 20, 30, 0.95);
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    backdrop-filter: blur(5px);
    border: 1px solid var(--border-glass);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    animation: fadeInTooltip 0.2s ease-out forwards;
}

@keyframes fadeInTooltip {
    from {
        opacity: 0;
        transform: translate(-50%, 10px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}