/* =============================================
   FLEXCAMPUS - STUDENT INTERFACE
   ============================================= */

:root {
    --primary: #0d3865;
    --primary-dark: #092847;
    --primary-light: #1a4a7a;
    --secondary: #6dcbdd;
    --secondary-light: #8ed8e6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-800: #1e293b;
    --border: var(--gray-200);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* =============================================
   LOGIN PAGE
   ============================================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 4px;
}

.login-header p {
    color: var(--gray-500);
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: all 0.2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--secondary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 100%);
    color: var(--primary-dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(109, 203, 221, 0.4);
}

.btn-block {
    width: 100%;
}

.error-message {
    color: var(--danger);
    font-size: 14px;
    margin-top: 16px;
    text-align: center;
}

/* =============================================
   STUDENT APP LAYOUT
   ============================================= */

.student-app {
    min-height: 100vh;
    display: flex;
    --sidebar-width: 260px;
}

/* =============================================
   TOP BAR
   ============================================= */

.top-bar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: 56px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 90;
    transition: left 0.3s ease;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-bar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-600);
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 34px;
    height: 34px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 7px;
    transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

.toggle-bar {
    display: block;
    width: 16px;
    height: 2px;
    background: var(--gray-500);
    border-radius: 1px;
    transition: all 0.2s;
}

.sidebar-toggle-btn:hover .toggle-bar {
    background: var(--primary);
}

/* =============================================
   SIDEBAR
   ============================================= */

.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.student-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
}

.student-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    border-radius: 50%;
    font-size: 16px;
}

.student-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--gray-600);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--gray-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(13, 56, 101, 0.08), rgba(109, 203, 221, 0.12));
    color: var(--primary);
    font-weight: 600;
}

.nav-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-500);
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.06);
    border-color: var(--danger);
    color: var(--danger);
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 95;
    backdrop-filter: blur(2px);
}

/* =============================================
   SIDEBAR COLLAPSED STATE
   ============================================= */

.student-app.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

.student-app.sidebar-collapsed .top-bar {
    left: 0;
}

.student-app.sidebar-collapsed .main-content {
    margin-left: 0;
    max-width: 100vw;
}

/* =============================================
   MAIN CONTENT
   ============================================= */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-top: 56px;
    padding: 32px 40px;
    min-height: calc(100vh - 56px);
    overflow-x: hidden;
    max-width: calc(100vw - var(--sidebar-width));
    box-sizing: border-box;
    transition: margin-left 0.3s ease, max-width 0.3s ease;
}

.content-header {
    margin-bottom: 24px;
}

.content-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.content-header p {
    color: var(--gray-500);
    font-size: 15px;
}

/* =============================================
   VIEWS
   ============================================= */

.view {
    display: none;
    flex: 1;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px;
}

.btn-back {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 20px;
    padding: 0;
}

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

/* =============================================
   PAGE HEADER
   ============================================= */

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 8px;
}

.page-header p {
    color: var(--gray-500);
}

/* =============================================
   FORMATIONS LIST
   ============================================= */

.formations-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.formation-card-student {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s;
}

.formation-card-student:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.formation-card-top {
    padding: 24px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.formation-card-info h3 {
    font-size: 20px;
    margin-bottom: 4px;
}

.formation-card-info p {
    font-size: 14px;
    opacity: 0.9;
}

.formation-progress-circle {
    width: 60px;
    height: 60px;
    position: relative;
}

.formation-progress-circle svg {
    transform: rotate(-90deg);
}

.formation-progress-circle .progress-bg {
    fill: none;
    stroke: rgba(255,255,255,0.3);
    stroke-width: 6;
}

.formation-progress-circle .progress-fill {
    fill: none;
    stroke: white;
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s;
}

.formation-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: 700;
}

.formation-card-bottom {
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
}

.formation-stats {
    display: flex;
    gap: 24px;
}

.formation-stat {
    text-align: center;
}

.formation-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.formation-stat-label {
    font-size: 12px;
    color: var(--gray-500);
}

.btn-continue {
    background: var(--secondary);
    color: var(--primary-dark);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
}

/* =============================================
   FORMATION DETAIL
   ============================================= */

.formation-header {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.formation-header h1 {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 8px;
}

.formation-header p {
    color: var(--gray-500);
}

.progression-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

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

.progression-header h3 {
    font-size: 16px;
    color: var(--gray-800);
}

.progression-percentage {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.progression-bar {
    height: 12px;
    background: var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
}

.progression-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary) 0%, var(--success) 100%);
    border-radius: 6px;
    transition: width 0.5s ease;
}

.progression-stats {
    display: flex;
    gap: 24px;
    margin-top: 16px;
}

.progression-stat {
    text-align: center;
    flex: 1;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}

.progression-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.progression-stat-label {
    font-size: 12px;
    color: var(--gray-500);
}

/* =============================================
   BLOCS ACCORDION
   ============================================= */

.blocs-accordion {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bloc-accordion-item {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.bloc-accordion-header {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.bloc-accordion-header:hover {
    background: var(--gray-50);
}

.bloc-badge {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-weight: 700;
    border-radius: var(--radius-sm);
}

.bloc-info {
    flex: 1;
}

.bloc-info h3 {
    font-size: 16px;
    color: var(--gray-800);
    margin-bottom: 2px;
}

.bloc-info p {
    font-size: 13px;
    color: var(--gray-500);
}

.bloc-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bloc-progress-bar {
    width: 100px;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.bloc-progress-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s;
}

.bloc-progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-600);
    min-width: 40px;
}

.bloc-toggle {
    font-size: 20px;
    color: var(--gray-400);
    transition: transform 0.3s;
}

.bloc-accordion-item.open .bloc-toggle {
    transform: rotate(180deg);
}

.bloc-accordion-content {
    display: none;
    padding: 0 24px 24px;
}

.bloc-accordion-item.open .bloc-accordion-content {
    display: block;
}

/* =============================================
   MODULES LIST IN BLOC
   ============================================= */

.modules-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.module-card-student {
    display: flex;
    align-items: center;
    padding: 16px;
    background: var(--gray-50);
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.module-card-student:hover {
    background: var(--white);
    border-color: var(--secondary);
}

.module-card-student.completed {
    border-color: var(--success);
}

.module-icon-wrapper {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: var(--white);
    border-radius: var(--radius-sm);
    margin-right: 16px;
}

.module-card-info {
    flex: 1;
}

.module-card-info h4 {
    font-size: 15px;
    color: var(--gray-800);
    margin-bottom: 2px;
}

.module-card-info p {
    font-size: 13px;
    color: var(--gray-500);
}

.module-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.module-card-progress {
    text-align: right;
}

.module-card-progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.module-card-progress-label {
    font-size: 11px;
    color: var(--gray-500);
}

.module-card-status {
    font-size: 20px;
}

/* =============================================
   MODULE DETAIL VIEW
   ============================================= */

.module-header {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.module-header-top {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
}

.module-header-icon {
    font-size: 48px;
}

.module-header-info h1 {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 4px;
}

.module-header-info p {
    color: var(--gray-500);
}

.module-objectives {
    background: var(--gray-50);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-top: 16px;
}

.module-objectives h4 {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.module-objectives p {
    color: var(--gray-700);
}

/* =============================================
   EXERCISES LIST
   ============================================= */

.exercises-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.exercise-card-student {
    display: flex;
    align-items: center;
    padding: 20px;
    background: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.exercise-card-student:hover {
    border-color: var(--secondary);
    transform: translateX(4px);
}

.exercise-card-student.completed {
    border-left: 4px solid var(--success);
}

.exercise-number {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    color: var(--gray-600);
    font-weight: 600;
    border-radius: 50%;
    margin-right: 16px;
}

.exercise-card-student.completed .exercise-number {
    background: var(--success);
    color: white;
}

.exercise-info {
    flex: 1;
}

.exercise-info h4 {
    font-size: 15px;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.exercise-info p {
    font-size: 13px;
    color: var(--gray-500);
}

.exercise-meta {
    display: flex;
    gap: 16px;
    align-items: center;
}

.exercise-meta-item {
    font-size: 13px;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 4px;
}

.difficulty-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.difficulty-badge.débutant {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.difficulty-badge.intermédiaire {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.difficulty-badge.avancé {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.exercise-points {
    text-align: right;
}

.exercise-points-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.exercise-points-label {
    font-size: 11px;
    color: var(--gray-500);
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1024px) {
    .main-content {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .student-app {
        --sidebar-width: 260px;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    /* On mobile: sidebar-collapsed is default (hidden),
       removing the class SHOWS the sidebar */
    .student-app:not(.sidebar-collapsed) .sidebar {
        transform: translateX(-100%);
    }

    .student-app.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .student-app.sidebar-open .sidebar-overlay {
        display: block;
    }

    .top-bar {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        max-width: 100vw;
        padding: 20px 16px;
    }

    .container {
        padding: 0 16px;
    }

    .content-header h1 {
        font-size: 22px;
    }

    .formation-card-top {
        flex-direction: column;
        gap: 16px;
    }

    .formation-progress-circle {
        align-self: flex-end;
    }

    .bloc-accordion-header {
        flex-wrap: wrap;
    }

    .bloc-progress {
        width: 100%;
        margin-top: 12px;
    }

    .module-card-student {
        flex-wrap: wrap;
    }

    .module-card-meta {
        width: 100%;
        margin-top: 12px;
        justify-content: space-between;
    }

    .exercise-card-student {
        flex-wrap: wrap;
    }

    .exercise-meta {
        width: 100%;
        margin-top: 12px;
    }
}

/* =============================================
   SCROLLBAR
   ============================================= */

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}
