@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/vazirmatn/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}


/* =========================
   Variables
========================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;

    --text: #172033;
    --text-muted: #64748b;

    --background: #f5f7fb;
    --surface: #ffffff;

    --border: #e2e8f0;

    --success: #16a34a;
    --danger: #dc2626;

    --radius: 14px;
    --shadow: 0 4px 18px rgba(15, 23, 42, 0.06);

    --container: 1100px;
}


/* =========================
   Reset
========================= */

* {
    box-sizing: border-box;
}

html {
    direction: rtl;
}

body {
    margin: 0;
    padding: 0;

    background: var(--background);
    color: var(--text);

    font-family: 'Vazirmatn', sans-serif;
    font-size: 15px;
    line-height: 1.8;

    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

button,
input,
textarea,
select {
    font-family: inherit;
}


/* =========================
   Container
========================= */

.container {
    width: min(
        calc(100% - 32px),
        var(--container)
    );

    margin-inline: auto;
}


/* =========================
   Header
========================= */

.site-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 {
    display: flex;
    align-items: center;
    gap: 12px;

    color: var(--text);
}

.brand:hover {
    color: var(--text);
}

.brand-mark {
    width: 48px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    overflow: visible;
}

.brand-mark img {
    display: block;

    width: 48px;
    height: auto;

    max-width: 100%;
    max-height: 34px;

    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;

    line-height: 1.4;
}

.brand-title {
    font-size: 16px;
    font-weight: 700;
}

.brand-name {
    color: var(--text-muted);
    font-size: 12px;
}


/* =========================
   Header Navigation
========================= */

.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-nav a {
    padding: 7px 12px;

    border-radius: 9px;

    color: var(--text-muted);

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

.header-nav a:hover {
    background: var(--primary-light);
    color: var(--primary);
}


/* =========================
   Main
========================= */

.site-main {
    padding: 40px 0 60px;
}

.page-title {
    margin: 0 0 8px;

    font-size: 26px;
    line-height: 1.5;
    font-weight: 700;
}

.page-description {
    margin: 0 0 28px;

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


/* =========================
   Card
========================= */

.card {
    background: var(--surface);

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

    box-shadow: var(--shadow);

    padding: 24px;
}


/* =========================
   Form
========================= */

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;

    margin-bottom: 7px;

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

.form-control {
    width: 100%;

    min-height: 46px;

    padding: 9px 13px;

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

    background: #fff;
    color: var(--text);

    font-size: 14px;

    outline: none;

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

.form-control:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, .10);
}


/* =========================
   Buttons
========================= */

.btn {
    min-height: 44px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 8px 18px;

    border: 0;
    border-radius: 10px;

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

    cursor: pointer;

    transition:
        background .15s ease,
        transform .1s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}


/* =========================
   Alerts
========================= */

.alert {
    padding: 12px 15px;

    margin-bottom: 20px;

    border-radius: 10px;

    font-size: 14px;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}


/* =========================
   Footer
========================= */

.site-footer {
    padding: 25px 0;

    border-top: 1px solid var(--border);

    color: var(--text-muted);

    font-size: 13px;

    text-align: center;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 9px;
}

.footer-links a {
    color: var(--text-muted);

    transition: color .15s ease;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-copyright {
    margin-top: 9px;

    color: var(--text-muted);

    font-size: 12px;
    line-height: 1.8;
}

.footer-copyright a {
    color: inherit;

    font-weight: 500;

    transition: color .15s ease;
}

.footer-copyright a:hover {
    color: var(--primary);
}

.footer-enamad {
    margin-top: 16px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-enamad img {
    display: block;

    width: 70px;
    height: auto;

    cursor: pointer;
}


/* =========================
   Mobile
========================= */

@media (max-width: 700px) {

    .container {
        width: min(
            calc(100% - 24px),
            var(--container)
        );
    }

    .header-inner {
        min-height: 64px;
    }

    .brand-mark {
        width: 42px;
        height: 30px;
    }

    .brand-mark img {
        width: 42px;

        max-width: 100%;
        max-height: 30px;
    }

    .brand-title {
        font-size: 15px;
    }

    .header-nav a {
        padding: 6px 8px;
        font-size: 13px;
    }

    .site-main {
        padding: 28px 0 45px;
    }

    .page-title {
        font-size: 22px;
    }

    .card {
        padding: 18px;
        border-radius: 12px;
    }

    .btn {
        min-height: 46px;
    }
}


/* =========================
   Authentication
========================= */

.auth-page {
    width: 100%;
    max-width: 480px;

    margin: 20px auto 0;
}

.auth-card {
    padding: 32px;
}

.auth-header {
    margin-bottom: 26px;
}

.auth-header .page-title {
    margin-bottom: 6px;
}

.auth-header .page-description {
    margin-bottom: 0;
}

.captcha-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.captcha-question {
    min-width: 105px;
    height: 46px;

    display: flex;
    align-items: center;
    justify-content: center;

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

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

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

.captcha-input {
    flex: 1;
}

.btn-full {
    width: 100%;
}

.auth-links {
    margin-top: 24px;
    padding-top: 20px;

    border-top: 1px solid var(--border);

    display: flex;
    flex-direction: column;

    align-items: center;
    gap: 7px;

    text-align: center;

    font-size: 13px;
}

.auth-links span {
    margin-top: 8px;
    color: var(--text-muted);
}


/* =========================
   Authentication - Mobile
========================= */

@media (max-width: 700px) {

    .auth-page {
        margin-top: 8px;
    }

    .auth-card {
        padding: 22px 18px;
    }

    .captcha-question {
        min-width: 95px;
    }
}


/* ========================================
   Account Page
======================================== */

.account-page {
    padding: 20px 0 40px;
}

.account-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 32px;
}

.account-welcome {
    display: inline-block;

    margin-bottom: 6px;

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

    color: var(--primary);
}

.account-header h1 {
    margin: 0 0 8px;

    font-size: 28px;
    line-height: 1.4;
}

.account-header p {
    margin: 0;

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

.account-section {
    margin-bottom: 28px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 16px;
}

.section-heading h2 {
    margin: 0 0 5px;

    font-size: 20px;
}

.section-heading p {
    margin: 0;

    color: var(--text-muted);

    font-size: 14px;
}


/* ========================================
   Course Card
======================================== */

.course-list {
    display: flex;
    flex-direction: column;

    gap: 12px;
}

.course-card {
    display: flex;
    align-items: center;

    gap: 18px;

    padding: 16px;

    background: var(--surface);

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

    box-shadow: var(--shadow);

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

.course-card:hover {
    transform: translateY(-2px);

    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.09);
}


/* ========================================
   Course Image
======================================== */

.course-card-image {
    width: 220px;

    aspect-ratio: 16 / 9;

    flex: 0 0 220px;

    overflow: hidden;

    border-radius: 10px;

    background: var(--background);
}

.course-card-image img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}

.course-card-image-placeholder {
    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 15px;

    color: var(--text-muted);

    font-size: 12px;

    text-align: center;
}


/* ========================================
   Course Information
======================================== */

.course-card-content {
    min-width: 0;

    flex: 1;
}

.course-book {
    display: block;

    margin-bottom: 5px;

    color: var(--text-muted);

    font-size: 13px;
    font-weight: 500;
}

.course-title {
    margin: 0 0 8px;

    color: var(--text);

    font-size: 18px;
    line-height: 1.5;
}

.course-description {
    margin: 0 0 10px;

    color: var(--text-muted);

    font-size: 13px;
    line-height: 1.8;

    display: -webkit-box;

    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;

    overflow: hidden;
}

.course-meta {
    display: flex;
    flex-wrap: wrap;

    gap: 12px;

    color: var(--text-muted);

    font-size: 12px;
}


/* ========================================
   Course Action
======================================== */

.course-card-action {
    flex-shrink: 0;
}

.course-card-action .btn {
    white-space: nowrap;
}


/* ========================================
   Empty State
======================================== */

.empty-state {
    padding: 45px 20px;

    text-align: center;

    background: var(--surface);

    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.empty-state-icon {
    margin-bottom: 12px;

    font-size: 38px;
}

.empty-state h3 {
    margin: 0 0 8px;

    font-size: 18px;
}

.empty-state p {
    max-width: 500px;

    margin: 0 auto 20px;

    color: var(--text-muted);

    font-size: 14px;
    line-height: 1.8;
}


/* ========================================
   Account Information
======================================== */

.account-info {
    padding: 24px;
}

.account-info-grid {
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 16px;
}

.account-info-item {
    padding: 16px;

    background: var(--background);

    border-radius: 10px;
}

.account-info-label {
    display: block;

    margin-bottom: 7px;

    color: var(--text-muted);

    font-size: 13px;
}

.account-info-item strong {
    display: block;

    font-size: 15px;
    line-height: 1.6;

    overflow-wrap: anywhere;
}


/* ========================================
   Account Page - Mobile
======================================== */

@media (max-width: 700px) {

    .account-page {
        padding-top: 10px;
    }

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

    .account-header h1 {
        font-size: 23px;
    }

    .section-heading h2 {
        font-size: 18px;
    }


    /* Course Card */

    .course-card {
        align-items: stretch;

        flex-direction: column;

        gap: 14px;

        padding: 14px;
    }


    /* Course Image */

    .course-card-image {
        width: 100%;
        height: auto;

        flex: none;

        aspect-ratio: 16 / 9;
    }


    /* Course Information */

    .course-title {
        font-size: 17px;
    }

    .course-description {
        font-size: 13px;
    }

    .course-meta {
        gap: 8px;
    }


    /* Course Action */

    .course-card-action {
        width: 100%;
    }

    .course-card-action .btn {
        width: 100%;
    }


    /* Account Information */

    .account-info {
        padding: 18px;
    }

    .account-info-grid {
        grid-template-columns: 1fr;

        gap: 10px;
    }
}


/* ========================================
   Chapter Page
======================================== */

.chapter-page {
    padding: 10px 0 45px;
}

.chapter-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 8px;

    margin-bottom: 22px;

    color: var(--text-muted);

    font-size: 13px;
}

.chapter-breadcrumb a {
    color: var(--primary);

    font-weight: 500;
}

.chapter-breadcrumb strong {
    color: var(--text);

    font-weight: 600;
}

.chapter-header {
    margin-bottom: 28px;

    padding-bottom: 24px;

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

.chapter-book {
    display: block;

    margin-bottom: 6px;

    color: var(--primary);

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

.chapter-header h1 {
    margin: 0 0 10px;

    font-size: 28px;
    line-height: 1.45;
}

.chapter-header p {
    max-width: 760px;

    margin: 0 0 14px;

    color: var(--text-muted);

    font-size: 15px;
    line-height: 2;
}

.chapter-access {
    display: inline-flex;
    align-items: center;

    padding: 7px 11px;

    background: var(--primary-light);

    border-radius: 8px;

    color: var(--primary-dark);

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


/* ========================================
   Chapter Layout
======================================== */

.chapter-layout {
    display: grid;

    grid-template-columns: 280px minmax(0, 1fr);

    gap: 22px;

    align-items: start;
}

.chapter-sidebar {
    position: sticky;

    top: 20px;
}

.chapter-sidebar-inner {
    padding: 18px;

    background: var(--surface);

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

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

.chapter-sidebar h2 {
    margin: 0 0 14px;

    padding-bottom: 13px;

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

    font-size: 17px;
}

.chapter-item-list {
    display: flex;
    flex-direction: column;

    gap: 5px;
}

.chapter-item-link {
    display: flex;
    align-items: flex-start;

    gap: 10px;

    padding: 9px;

    border-radius: 9px;

    color: var(--text);

    font-size: 13px;
    line-height: 1.6;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.chapter-item-link:hover {
    background: var(--primary-light);

    color: var(--primary-dark);
}

.chapter-item-number {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 25px;
    height: 25px;

    flex: 0 0 25px;

    border-radius: 7px;

    background: var(--background);

    color: var(--text-muted);

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

.chapter-item-title {
    padding-top: 2px;
}


/* ========================================
   Chapter Content
======================================== */

.chapter-content {
    display: flex;
    flex-direction: column;

    gap: 18px;

    min-width: 0;
}

.content-item {
    padding: 22px;

    scroll-margin-top: 20px;
}

.content-item-header {
    display: flex;
    align-items: center;

    gap: 12px;

    margin-bottom: 18px;
}

.content-item-header h2 {
    margin: 0;

    font-size: 18px;
    line-height: 1.5;
}

.content-item-number {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;

    flex: 0 0 32px;

    border-radius: 9px;

    background: var(--primary-light);

    color: var(--primary);

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

.content-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-height: 260px;

    padding: 30px;

    background: var(--background);

    border: 1px dashed var(--border);
    border-radius: 10px;

    text-align: center;
}

.content-placeholder-icon {
    margin-bottom: 12px;

    font-size: 35px;
}

.content-placeholder p {
    margin: 0;

    color: var(--text-muted);

    font-size: 14px;
}

.external-content {
    padding: 20px;

    background: var(--background);

    border-radius: 10px;
}

.external-content p {
    margin: 0 0 16px;

    color: var(--text-muted);

    font-size: 14px;
}

.chapter-empty-state {
    margin-top: 10px;
}


/* ========================================
   Access Denied
======================================== */

.access-denied-page {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 55vh;

    padding: 30px 0;
}

.access-denied-card {
    width: 100%;
    max-width: 500px;

    padding: 42px 25px;

    text-align: center;
}

.access-denied-icon {
    margin-bottom: 14px;

    font-size: 42px;
}

.access-denied-card h1 {
    margin: 0 0 10px;

    font-size: 21px;
}

.access-denied-card p {
    margin: 0 0 22px;

    color: var(--text-muted);

    font-size: 14px;
}


/* ========================================
   Chapter Page - Mobile
======================================== */

@media (max-width: 800px) {

    .chapter-page {
        padding-top: 5px;
    }

    .chapter-header h1 {
        font-size: 23px;
    }

    .chapter-layout {
        display: flex;
        flex-direction: column;

        gap: 16px;
    }

    .chapter-sidebar {
        position: static;

        width: 100%;
    }

    .chapter-sidebar-inner {
        padding: 15px;
    }

    .chapter-item-list {
        display: grid;

        grid-template-columns: 1fr 1fr;

        gap: 5px;
    }

    .content-item {
        padding: 17px;
    }

    .content-item-header h2 {
        font-size: 17px;
    }
}


@media (max-width: 500px) {

    .chapter-item-list {
        grid-template-columns: 1fr;
    }

    .chapter-header {
        margin-bottom: 20px;

        padding-bottom: 20px;
    }

    .content-placeholder {
        min-height: 210px;

        padding: 20px;
    }
}