:root {
    --bg: #f7f7fb;
    --surface: #ffffff;
    --surface-soft: #f1efff;

    --text: #242338;
    --text-secondary: #6f6d80;
    --border: #e8e7f0;

    --primary: #635bff;
    --primary-dark: #5148e8;
    --primary-soft: #eeecff;

    --success: #35b779;
    --success-soft: #e9f8f1;

    --warning: #f0a43c;
    --warning-soft: #fff4e4;

    --shadow: 0 10px 30px rgba(42, 38, 90, 0.07);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

.container {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
}

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

.student-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    min-height: 72px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: var(--text);
}

.student-name {
    padding: 9px 15px;

    background: var(--primary-soft);
    color: var(--primary-dark);

    border-radius: 999px;

    font-size: 14px;
    font-weight: 700;
}

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

.student-main {
    padding-top: 48px;
    padding-bottom: 70px;
}

.welcome {
    margin-bottom: 30px;
}

.welcome h1 {
    margin: 0 0 8px;

    font-size: clamp(30px, 4vw, 42px);
    line-height: 1.12;
    letter-spacing: -1.2px;
}

.welcome p {
    margin: 0;

    color: var(--text-secondary);
    font-size: 18px;
}

/* =========================
   COURSE CARD
   ========================= */

.course-card {
    position: relative;

    padding: 32px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow);

    margin-bottom: 42px;
}

.course-card::before {
    content: "";

    position: absolute;
    top: 0;
    left: 0;
    right: 0;

    height: 5px;

    background: linear-gradient(
        90deg,
        var(--primary),
        #8d7cff
    );

    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.course-card h2 {
    margin: 0 0 8px;

    font-size: 27px;
    letter-spacing: -0.5px;
}

.course-card > p {
    margin: 0 0 26px;

    color: var(--text-secondary);
}

/* =========================
   PROGRESS
   ========================= */

.progress {
    margin-bottom: 26px;
}

.progress-label {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 9px;

    font-size: 14px;
}

.progress-label strong {
    color: var(--primary);
}

.progress-bar {
    width: 100%;
    height: 10px;

    overflow: hidden;

    background: #e9e8f2;
    border-radius: 999px;
}

.progress-fill {
    height: 100%;

    background: linear-gradient(
        90deg,
        var(--primary),
        #887dff
    );

    border-radius: inherit;

    transition: width 0.3s ease;
}

.progress p {
    margin: 9px 0 0;

    color: var(--text-secondary);
    font-size: 13px;
}

/* =========================
   BUTTONS
   ========================= */

.continue-button,
.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 48px;

    padding: 0 22px;

    border: 0;
    border-radius: 13px;

    background: var(--primary);
    color: white;

    font-weight: 700;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.continue-button:hover,
.primary-button:hover {
    background: var(--primary-dark);

    transform: translateY(-1px);

    box-shadow: 0 8px 20px rgba(99, 91, 255, 0.22);
}

.primary-button:disabled {
    opacity: 0.55;
    cursor: default;
    transform: none;
    box-shadow: none;
}

/* =========================
   MODULES
   ========================= */

.modules-section > h2 {
    margin: 0 0 20px;

    font-size: 25px;
    letter-spacing: -0.5px;
}

.module {
    margin-bottom: 24px;

    padding: 26px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.module h3 {
    margin: 0 0 5px;

    font-size: 20px;
}

.module > p {
    margin: 0 0 20px;

    color: var(--text-secondary);
}

/* =========================
   LESSON LIST
   ========================= */

.lessons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lesson {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    padding: 17px 18px;

    background: #fafafe;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.lesson:hover {
    background: var(--primary-soft);
    border-color: #d9d5ff;
    transform: translateY(-1px);
}

.lesson-info {
    min-width: 0;
}

.lesson-info h4 {
    margin: 0 0 4px;

    font-size: 16px;
}

.lesson-info h4 a {
    color: var(--text);
}

.lesson-info h4 a:hover {
    color: var(--primary);
}

.lesson-info p {
    margin: 0;

    color: var(--text-secondary);
    font-size: 14px;
}

.lesson-status {
    flex-shrink: 0;

    padding: 7px 11px;

    border-radius: 999px;

    font-size: 12px;
    font-weight: 700;
}

.status-completed {
    background: var(--success-soft);
    color: #21875b;
}

.status-in-progress {
    background: var(--warning-soft);
    color: #b56a14;
}

.status-not-started {
    background: #efeff5;
    color: #777588;
}

.course-completed {
    padding: 14px 16px;

    background: var(--success-soft);
    color: #21875b;

    border-radius: var(--radius-sm);

    font-weight: 700;
}

/* =========================
   LOADING
   ========================= */

.loading {
    color: var(--text-secondary);
}

/* =========================
   LESSON PAGE
   ========================= */

header:not(.student-header) {
    padding: 24px 20px;

    background: var(--surface);

    border-bottom: 1px solid var(--border);
}

header:not(.student-header) h1 {
    width: min(900px, 100%);
    margin: 0 auto;

    font-size: 21px;
}

main {
    width: min(900px, calc(100% - 40px));

    margin: 0 auto;

    padding-top: 34px;
    padding-bottom: 70px;
}

main > p:first-child {
    margin-bottom: 28px;
}

main > p:first-child a {
    color: var(--primary);
    font-weight: 700;
}

#lesson {
    padding: 32px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow);
}

#lesson h2 {
    margin: 0 0 8px;

    font-size: 30px;
    line-height: 1.2;
    letter-spacing: -0.7px;
}

#lesson-description {
    margin: 0 0 24px;

    color: var(--text-secondary);
}

#lesson-content {
    margin-bottom: 34px;

    padding: 20px;

    background: var(--primary-soft);

    border-radius: var(--radius-md);

    color: #48436e;
}

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

#exercises {
    margin-top: 10px;
}

#exercises > h3 {
    margin: 0 0 18px;

    font-size: 22px;
}

#exercise-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lesson-exercise {
    padding: 22px;

    background: #fafafe;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.lesson-exercise h4 {
    margin: 0 0 12px;

    color: var(--primary);

    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exercise-question {
    margin: 0 0 16px;

    font-size: 17px;
    font-weight: 600;
}

.exercise-answer {
    width: 100%;

    min-height: 48px;

    padding: 0 14px;

    margin-bottom: 12px;

    background: white;

    border: 1px solid #dcdbe7;
    border-radius: 12px;

    color: var(--text);

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.exercise-answer:focus {
    border-color: var(--primary);

    box-shadow: 0 0 0 4px rgba(99, 91, 255, 0.1);
}

.exercise-answer:disabled {
    background: #f1f1f5;
}

.exercise-result {
    min-height: 24px;

    margin-top: 12px;

    font-size: 14px;
    font-weight: 700;
}

#lesson-result {
    margin-top: 20px;

    padding: 15px 17px;

    background: var(--success-soft);
    color: #21875b;

    border-radius: var(--radius-sm);

    font-weight: 700;
}

/* =========================
   MOBILE
   ========================= */

@media (max-width: 700px) {
    .container {
        width: min(100% - 24px, 1120px);
    }

    .student-main {
        padding-top: 30px;
    }

    .welcome h1 {
        font-size: 30px;
    }

    .welcome p {
        font-size: 16px;
    }

    .course-card,
    .module,
    #lesson {
        padding: 22px;
        border-radius: 18px;
    }

    .lesson {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .lesson-status {
        align-self: flex-start;
    }

    .continue-button,
    .primary-button {
        width: 100%;
    }

    .lesson-exercise {
        padding: 18px;
    }
}
/* =========================
   NEW LESSON PAGE
   ========================= */

.lesson-main {
    width: min(900px, calc(100% - 40px));
    margin: 0 auto;

    padding-top: 34px;
    padding-bottom: 70px;
}

.back-link {
    display: inline-flex;
    align-items: center;

    margin-bottom: 24px;

    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
}

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


/* =========================
   LESSON HERO
   ========================= */

.lesson-hero {
    position: relative;

    margin-bottom: 24px;
    padding: 34px;

    overflow: hidden;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow);
}

.lesson-hero::before {
    content: "";

    position: absolute;

    top: 0;
    left: 0;
    right: 0;

    height: 5px;

    background: linear-gradient(
        90deg,
        var(--primary),
        #8d7cff
    );
}

.lesson-label {
    margin-bottom: 10px;

    color: var(--primary);

    font-size: 12px;
    font-weight: 800;

    letter-spacing: 1px;
}

.lesson-hero h1 {
    margin: 0 0 10px;

    font-size: clamp(30px, 4vw, 40px);
    line-height: 1.15;

    letter-spacing: -1px;
}

.lesson-hero p {
    margin: 0;

    color: var(--text-secondary);
    font-size: 17px;
}


/* =========================
   LESSON CARDS
   ========================= */

.lesson-card {
    margin-bottom: 24px;
    padding: 28px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: var(--radius-lg);

    box-shadow: var(--shadow);
}

.lesson-card-header {
    display: flex;
    align-items: center;

    gap: 14px;

    margin-bottom: 22px;
}

.lesson-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 46px;
    height: 46px;

    flex-shrink: 0;

    background: var(--primary-soft);

    border-radius: 14px;

    font-size: 22px;
}

.lesson-card-header h2 {
    margin: 0 0 3px;

    font-size: 21px;
    letter-spacing: -0.4px;
}

.lesson-card-header p {
    margin: 0;

    color: var(--text-secondary);
    font-size: 14px;
}


/* =========================
   LESSON CONTENT
   ========================= */

.lesson-content {
    padding: 22px;

    background: var(--primary-soft);

    border-radius: var(--radius-md);

    color: #48436e;

    font-size: 16px;
    line-height: 1.7;
}


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

.exercises-card {
    margin-bottom: 24px;
}

#exercise-list {
    display: flex;
    flex-direction: column;

    gap: 16px;
}

.lesson-exercise {
    padding: 22px;

    background: #fafafe;

    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.lesson-exercise h4 {
    margin: 0 0 12px;

    color: var(--primary);

    font-size: 12px;
    font-weight: 800;

    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.exercise-question {
    margin: 0 0 16px;

    font-size: 17px;
    font-weight: 600;

    line-height: 1.5;
}

.exercise-answer {
    width: 100%;

    min-height: 50px;

    padding: 0 15px;

    margin-bottom: 12px;

    background: white;

    border: 1px solid #dcdbe7;
    border-radius: 12px;

    color: var(--text);

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.exercise-answer::placeholder {
    color: #aaa8b8;
}

.exercise-answer:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 4px rgba(99, 91, 255, 0.1);
}

.exercise-answer:disabled {
    background: #f1f1f5;
}

.exercise-submit {
    min-width: 130px;
}

.exercise-result {
    min-height: 24px;

    margin-top: 12px;

    color: var(--text-secondary);

    font-size: 14px;
    font-weight: 700;
}


/* =========================
   LESSON RESULT
   ========================= */

#lesson-result {
    margin-top: 22px;

    padding: 17px 18px;

    background: var(--success-soft);
    color: #21875b;

    border: 1px solid #d4f0e2;
    border-radius: var(--radius-sm);

    font-weight: 700;
}


/* =========================
   LESSON NAVIGATION
   ========================= */

.lesson-navigation {
    display: flex;

    margin-top: 10px;
}

.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 46px;

    padding: 0 20px;

    background: var(--surface);

    border: 1px solid var(--border);
    border-radius: 13px;

    color: var(--text);

    font-weight: 700;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.secondary-button:hover {
    background: var(--primary-soft);

    border-color: #d9d5ff;

    transform: translateY(-1px);
}


/* =========================
   LESSON MOBILE
   ========================= */

@media (max-width: 700px) {

    .lesson-main {
        width: min(100% - 24px, 900px);

        padding-top: 24px;
        padding-bottom: 50px;
    }

    .lesson-hero,
    .lesson-card {
        padding: 22px;

        border-radius: 18px;
    }

    .lesson-hero h1 {
        font-size: 30px;
    }

    .lesson-hero p {
        font-size: 16px;
    }

    .lesson-card-header {
        align-items: flex-start;
    }

    .lesson-exercise {
        padding: 18px;
    }

    .exercise-submit {
        width: 100%;
    }

    .secondary-button {
        width: 100%;
    }
}

/* =========================
   TEACHER PROGRESS STATS
   ========================= */

.teacher-progress-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.teacher-progress-stat {
    min-width: 0;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.teacher-progress-stat-label {
    margin: 0 0 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

.teacher-progress-stat-value {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

@media (max-width: 700px) {
    .teacher-progress-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .teacher-progress-stat {
        padding: 20px;
    }

    .teacher-progress-stat-value {
        font-size: 28px;
    }
}


/* =========================
   TEACHER LESSON PREVIEW
   ========================= */

#preview-exercises .preview-result-correct {
    padding: 12px 14px;
    background: var(--success-soft);
    color: #21875b;
    border: 1px solid #d4f0e2;
    border-radius: var(--radius-sm);
}

#preview-exercises .preview-result-incorrect {
    padding: 12px 14px;
    background: var(--warning-soft);
    color: #9a5b0b;
    border: 1px solid #f5dfbd;
    border-radius: var(--radius-sm);
}

#preview-exercises .secondary-button {
    margin-top: 4px;
}


/* TEACHER PREVIEW EXPLANATION */
#preview-exercises .preview-explanation {
    margin-top: 12px;
    padding: 14px 16px;
    background: #f4f2ff;
    color: #48436e;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.7;
}


/* =========================
   TEACHER LOGOUT BUTTON
   ========================= */

#teacher-logout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    background: #FDECEC;
    color: #A83232;
    border: 1px solid #F8D5D5;
    border-radius: 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease,
                box-shadow 0.2s ease, transform 0.2s ease;
}

#teacher-logout-button:hover:not(:disabled) {
    background: #FADADA;
    border-color: #F0BEBE;
    box-shadow: 0 3px 10px rgba(168, 50, 50, 0.08);
    transform: translateY(-1px);
}

#teacher-logout-button:focus-visible {
    outline: 3px solid rgba(168, 50, 50, 0.22);
    outline-offset: 3px;
}

#teacher-logout-button:disabled {
    opacity: 0.7;
    cursor: wait;
}
