/**
 * TESTCIVIQUE - MON ESPACE CLIENT
 * Styles pour la page tableau de bord utilisateur
 */

/* ===================================
   VARIABLES
   =================================== */
:root {
    /* PALETTE */
    --cyan: #00D4FF;
    --cyan-dark: #0090AD;
    --deep-blue: #0F172A;
    --surface: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --text-light: #94A3B8;
    --border: #E2E8F0;

    /* DESIGN VARIABLES */
    --glass: rgba(255, 255, 255, 0.85);
    --blur: blur(20px);
    --shadow-soft: 0 20px 40px -10px rgba(15, 23, 42, 0.05);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.15);
    --radius-lg: 24px;
}

/* ===================================
   LAYOUT PRINCIPAL
   =================================== */
.main-wrapper {
    max-width: 1100px;
    margin: 40px auto 0;
    padding: 0 30px 60px 30px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
    align-items: start;
}

/* ===================================
   SIDEBAR INFO (Gauche)
   =================================== */
.side-info {
    position: sticky;
    top: 70px;
}

.welcome-block {
    margin-bottom: 30px;
}

.welcome-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: 300;
    line-height: 1.1;
    color: var(--deep-blue);
    letter-spacing: -1px;
}

.welcome-title strong {
    font-weight: 600;
    background: linear-gradient(135deg, var(--deep-blue) 0%, #475569 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===================================
   LEVEL CARD
   =================================== */
.level-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 30px -5px rgba(0,0,0,0.05);
    border: 1px solid rgba(0, 212, 255, 0.2);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.level-card.empty {
    border-color: var(--border);
}

.level-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(0,212,255,0.2) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.level-card.empty::before {
    background: none;
}

.lc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.lc-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.lc-rank {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--deep-blue);
    background: rgba(0, 212, 255, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    color: var(--cyan-dark);
}

.lc-rank.empty {
    background: #F1F5F9;
    color: var(--text-muted);
}

.xp-bar-container {
    width: 100%;
    height: 8px;
    background: #F1F5F9;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cyan) 0%, var(--cyan-dark) 100%);
    border-radius: 10px;
}

.lc-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.lc-next-lvl {
    color: var(--deep-blue);
    font-weight: 700;
}

/* EMPTY STATE - Level Card */
.empty-xp-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    text-align: center;
    gap: 10px;
    opacity: 0.5;
}

.empty-xp-icon {
    width: 40px;
    height: 40px;
    color: var(--text-muted);
}

.empty-xp-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 180px;
}

/* ===================================
   KPI LIST
   =================================== */
.kpi-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.kpi-list.empty {
    opacity: 0.6;
}

.kpi-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.kpi-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.kpi-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--deep-blue);
}

.kpi-val.empty {
    color: var(--text-light);
}

.kpi-icon {
    color: var(--cyan);
    width: 18px;
    height: 18px;
}

.kpi-icon.empty {
    color: var(--text-light);
}

/* ===================================
   MAIN CONTENT (Droite)
   =================================== */
.content-area {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* ===================================
   HERO CARD
   =================================== */
.hero-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 280px;
    transition: 0.4s ease;
    border: 1px solid rgba(255,255,255,0.5);
}

.hero-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px -15px rgba(0, 212, 255, 0.15);
}

.hero-deco {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0,212,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-tag {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(0, 212, 255, 0.1);
    color: var(--cyan-dark);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 30px;
    margin-bottom: 20px;
    width: fit-content;
}

.hero-tag.start {
    background: #DCFCE7;
    color: #166534;
}

.hero-content h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.hero-content p {
    color: var(--text-muted);
    max-width: 400px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.hero-footer {
    margin-top: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.progress-circle-wrap {
    display: flex;
    align-items: center;
    gap: 15px;
}

.prog-text {
    display: flex;
    flex-direction: column;
}

.prog-text span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.prog-text strong {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--deep-blue);
}

.btn-play {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--deep-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.3);
    transition: 0.3s;
    border: none;
    cursor: pointer;
}

.btn-play:hover {
    background: var(--cyan);
    transform: scale(1.1);
    box-shadow: 0 0 30px var(--cyan);
    color: var(--deep-blue);
}

.btn-play svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.btn-start-large {
    padding: 14px 28px;
    background: var(--deep-blue);
    color: white;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.3s;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.2);
}

.btn-start-large:hover {
    background: var(--cyan);
    color: var(--deep-blue);
    box-shadow: 0 0 25px rgba(0, 212, 255, 0.4);
    transform: translateY(-2px);
}

/* ===================================
   GRILLE ACTIONS
   =================================== */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.quick-card {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    padding: 22px;
    border-radius: 16px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: 0.3s;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.quick-card.locked {
    opacity: 0.75;
    cursor: default;
}

.quick-card:not(.locked):hover {
    background: white;
    border-color: var(--cyan);
    transform: translateY(-3px);
}

.qc-icon-box {
    width: 42px;
    height: 42px;
    color: var(--deep-blue);
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-card.locked .qc-icon-box {
    color: var(--text-light);
}

.duotone-svg {
    width: 36px;
    height: 36px;
    stroke-width: 1.5;
}

.duo-fill {
    fill: var(--cyan);
    opacity: 0.15;
}

.quick-card.locked .duo-fill {
    fill: var(--text-light);
    opacity: 0.1;
}

.duo-stroke {
    stroke: currentColor;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.quick-card:not(.locked):hover .qc-icon-box {
    color: var(--cyan-dark);
}

.qc-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.2px;
}

.quick-card.locked .qc-title {
    color: var(--text-muted);
}

.qc-arrow {
    position: absolute;
    top: 22px;
    right: 22px;
    font-size: 1.2rem;
    color: var(--border);
    transition: 0.3s;
}

.quick-card:not(.locked):hover .qc-arrow {
    color: var(--cyan);
    transform: translateX(3px);
}

.lock-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 16px;
    height: 16px;
    color: var(--text-light);
    opacity: 0.5;
}

/* ===================================
   SECTION MODULES AVEC TABS
   =================================== */
.modules-container {
    margin-top: 10px;
}

.section-header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--deep-blue);
}

.link-more {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: 0.2s;
}

.link-more:hover {
    color: var(--cyan);
}

.link-more.disabled {
    color: var(--text-light);
    cursor: default;
}

/* TAB SWITCHER STYLE */
.exam-tabs {
    display: flex;
    background: white;
    padding: 5px;
    border-radius: 12px;
    border: 1px solid var(--border);
    width: 100%;
}

.tab-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    background: rgba(0, 212, 255, 0.1);
    color: var(--cyan-dark);
}

/* CONTENU DES TABS */
.tab-content {
    display: none;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.module-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.module-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 20px 25px;
    border-radius: 16px;
    border: 1px solid transparent;
    transition: 0.3s;
    cursor: pointer;
}

.module-item:hover {
    border-color: var(--cyan);
    box-shadow: 0 10px 30px -5px rgba(0,0,0,0.05);
    transform: translateX(5px);
}

.module-item.locked {
    opacity: 0.6;
    cursor: default;
}

.module-item.locked:hover {
    border-color: transparent;
    transform: none;
    box-shadow: none;
}

.mi-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 0;
}

.mi-icon {
    width: 48px;
    height: 48px;
    background: #F1F5F9;
    color: var(--text-muted);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
    flex-shrink: 0;
}

.module-item:not(.locked):hover .mi-icon {
    background: var(--cyan);
    color: white;
}

.mi-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.mi-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

.mi-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mi-status {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 10px;
}

.status-done {
    background: #DCFCE7;
    color: #166534;
}

.status-progress {
    background: rgba(0, 212, 255, 0.1);
    color: var(--cyan-dark);
}

.status-lock {
    background: #F1F5F9;
    color: #94A3B8;
}

.status-start {
    background: var(--deep-blue);
    color: white;
}

/* ===================================
   FOOTER OVERRIDES
   =================================== */
body footer {
    padding-top: 30px !important;
    padding-bottom: 30px !important;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 900px) {
    .main-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
        margin-top: 90px;
        padding: 0 20px 30px 20px;
    }

    .side-info {
        position: static;
        display: flex;
        align-items: flex-end;
        justify-content: space-between;
        width: 100%;
        flex-wrap: wrap;
    }

    .welcome-block {
        margin-bottom: 0;
        width: 100%;
    }

    /* ON AFFICHE LE LEVEL CARD SUR TABLETTE/MOBILE */
    .level-card {
        display: block;
        width: 100%;
        margin-top: 20px;
        margin-bottom: 20px;
    }

    /* ON AFFICHE LA LISTE KPI SUR TABLETTE/MOBILE */
    .kpi-list {
        display: flex;
        flex-direction: row;
        gap: 15px;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
    }

    .kpi-item {
        min-width: 150px;
        border-bottom: none;
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        background: white;
    }
}

@media (max-width: 600px) {
    .main-wrapper {
        margin-top: 40px;
        padding: 0 20px;
    }

    .side-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .welcome-title {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }

    /* Welcome title sur une seule ligne en mobile */
    .welcome-title br {
        display: none;
    }

    /* TABS EN SCROLL SUR MOBILE */
    .exam-tabs {
        overflow-x: auto;
        justify-content: flex-start;
        padding: 4px;
    }

    .tab-btn {
        flex: 0 0 auto;
    }

    /* TRANSFORMER LES KPI EN GRILLE SUR MOBILE */
    .kpi-list {
        display: grid;
        grid-template-columns: 1fr 1fr; /* 2 colonnes */
        gap: 12px;
        width: 100%;
        overflow: visible; /* Pas de scroll */
    }

    .kpi-item {
        width: 100%;
        min-width: 0; /* Important pour le grid */
        padding: 12px;
        border: 1px solid white;
        box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    }

    .kpi-label {
        font-size: 0.75rem;
        margin-bottom: 6px;
    }

    .kpi-val {
        font-size: 1rem;
    }

    /* Footer mobile stacking */
    body footer {
        padding-top: 25px !important;
        padding-bottom: 25px !important;
    }

    body footer > div {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    body footer > div > div:first-child {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-bottom: 16px;
    }

    body footer a {
        display: block;
        margin: 0 !important;
    }

    .hero-card {
        padding: 16px;
        min-height: auto;
        max-width: 100%;
        box-sizing: border-box;
    }

    .hero-content h2 {
        font-size: 1.2rem;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    .hero-content p {
        font-size: 0.85rem;
        overflow-wrap: break-word;
        word-wrap: break-word;
        line-height: 1.5;
    }

    .hero-footer {
        flex-wrap: wrap;
        gap: 12px;
    }

    .btn-play {
        width: 48px;
        height: 48px;
    }

    .btn-start-large {
        font-size: 0.85rem;
        padding: 10px 16px;
    }

    .quick-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .quick-card {
        flex-direction: row;
        align-items: center;
        padding: 14px;
    }

    .qc-title {
        font-size: 0.85rem;
    }

    .qc-arrow {
        top: 50%;
        transform: translateY(-50%);
        right: 14px;
    }

    .quick-card:not(.locked):hover .qc-arrow {
        transform: translateY(-50%) translateX(3px);
    }

    .section-header {
        margin-bottom: 12px;
    }

    .module-list {
        gap: 10px;
    }

    .module-item {
        padding: 12px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .mi-left {
        gap: 10px;
    }

    .mi-icon {
        width: 36px;
        height: 36px;
    }

    .mi-icon svg {
        width: 18px;
        height: 18px;
    }

    .mi-info h3 {
        font-size: 0.85rem;
        line-height: 1.2;
    }

    .mi-info p {
        font-size: 0.7rem;
    }

    .mi-status {
        font-size: 0.6rem;
        padding: 4px 6px;
        margin-left: 6px;
    }
}
