

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary:      #1a56db;
    --primary-dark: #1040a8;
    --primary-light:#e8f0fe;
    --success:      #0d9f6e;
    --success-light:#d1fae5;
    --danger:       #e02424;
    --danger-light: #fee2e2;
    --warning:      #d97706;
    --warning-light:#fef3c7;
    --gray-50:      #f9fafb;
    --gray-100:     #f3f4f6;
    --gray-200:     #e5e7eb;
    --gray-300:     #d1d5db;
    --gray-500:     #6b7280;
    --gray-700:     #374151;
    --gray-900:     #111827;
    --white:        #ffffff;
    --purple:       #7c3aed;
    --purple-light: #ede9fe;
    --radius:       12px;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
    --shadow:       0 4px 16px rgba(0,0,0,.10);
    --shadow-lg:    0 8px 32px rgba(0,0,0,.14);
    --sidebar-w:    260px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    direction: rtl;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

.login-page {
    background: linear-gradient(135deg, #1a56db 0%, #0d3b8e 60%, #07235c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper {
    width: 100%;
    max-width: 430px;
    padding: 24px;
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    padding: 44px 40px;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    font-size: 52px;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.login-logo p {
    color: var(--gray-500);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 7px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 14px;
    color: var(--gray-900);
    transition: border-color .2s;
    background: var(--white);
    direction: rtl;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

.form-group textarea { resize: vertical; min-height: 90px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 10px;
    border: none;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}

.btn-primary   { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26,86,219,.3); }

.btn-success   { background: var(--success); color: var(--white); }
.btn-success:hover { filter: brightness(1.08); }

.btn-danger    { background: var(--danger); color: var(--white); }
.btn-danger:hover  { filter: brightness(1.08); }

.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }

.btn-purple { background: var(--purple); color: var(--white); }
.btn-purple:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: var(--white); }

.btn-block { width: 100%; padding: 13px; font-size: 16px; }
.btn-sm    { padding: 6px 14px; font-size: 13px; }

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 18px;
    font-weight: 500;
}
.alert-error   { background: var(--danger-light);  color: var(--danger);  border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #6ee7b7; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fcd34d; }

.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    background: var(--gray-900);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    text-align: center;
}

.sidebar-brand .brand-icon { font-size: 36px; margin-bottom: 8px; }
.sidebar-brand h2 { font-size: 16px; font-weight: 700; }
.sidebar-brand p  { font-size: 12px; color: rgba(255,255,255,.4); margin-top: 2px; }

.sidebar-nav { padding: 16px 12px; flex: 1; }

.nav-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,.3);
    padding: 12px 8px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 10px;
    margin-bottom: 3px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,.7);
    transition: all .18s;
    cursor: pointer;
}

.nav-item:hover { background: rgba(255,255,255,.08); color: var(--white); }
.nav-item.active { background: var(--primary); color: var(--white); box-shadow: 0 4px 12px rgba(26,86,219,.4); }
.nav-item .icon  { font-size: 18px; width: 22px; text-align: center; }

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.main-content {
    margin-right: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-user  { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar-user .avatar {
    width: 36px; height: 36px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 16px;
}

.page-body { padding: 28px; flex: 1; }

.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: visible;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h3 { font-size: 16px; font-weight: 700; }
.card-body  { padding: 22px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: var(--shadow); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}

.stat-info { flex: 1; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--gray-500); }

.bg-blue   { background: var(--primary-light); }
.bg-gray   { background: var(--gray-300);}
.bg-green  { background: var(--success-light); }
.bg-orange { background: var(--warning-light); }
.bg-red    { background: var(--danger-light);  }
.bg-purple { background: var(--purple-light); }

.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    background: var(--gray-50);
    padding: 13px 16px;
    text-align: right;
    font-weight: 700;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-blue   { background: var(--primary-light); color: var(--primary); }
.badge-green  { background: var(--success-light); color: var(--success); }
.badge-orange { background: var(--warning-light); color: var(--warning); }

.student-layout { min-height: 100vh; background: linear-gradient(135deg,#e8f0fe 0%,#f3f4f6 100%); }

.student-header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.student-header .brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; }
.student-header .user-info { display: flex; align-items: center; gap: 14px; font-size: 14px; }

.student-body {
    max-width: 960px;
    margin: 0 auto;
    padding: 48px 24px;
}

.welcome-text {
    text-align: center;
    margin-bottom: 48px;
}
.welcome-text h2 { font-size: 28px; font-weight: 800; color: var(--gray-900); }
.welcome-text p  { font-size: 16px; color: var(--gray-500); margin-top: 8px; }

.main-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    max-width: 700px;
    margin: 0 auto;
}

.main-btn {
    background: var(--white);
    border: 3px solid var(--gray-200);
    border-radius: 20px;
    padding: 44px 28px;
    text-align: center;
    cursor: pointer;
    transition: all .25s;
    box-shadow: var(--shadow-sm);
}

.main-btn:hover {
    border-color: var(--primary);
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.main-btn.written:hover { border-color: #1a56db; }
.main-btn.practical:hover { border-color: #0d9f6e; }

.main-btn .btn-icon { font-size: 56px; margin-bottom: 16px; }
.main-btn h3 { font-size: 20px; font-weight: 800; color: var(--gray-900); }
.main-btn p  { font-size: 14px; color: var(--gray-500); margin-top: 6px; }

.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.subject-card {
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 24px;
    cursor: pointer;
    transition: all .2s;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.subject-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.subject-card .s-icon { font-size: 36px; margin-bottom: 12px; }
.subject-card h4 { font-size: 15px; font-weight: 700; color: var(--gray-900); }
.subject-card .count { font-size: 12px; color: var(--gray-500); margin-top: 5px; }

.quiz-layout { max-width: 780px; margin: 0 auto; padding: 32px 20px; }

.quiz-progress-bar {
    background: var(--gray-200);
    border-radius: 99px;
    height: 8px;
    margin-bottom: 28px;
    overflow: hidden;
}

.quiz-progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #4f8ef7);
    border-radius: 99px;
    transition: width .4s;
}

.quiz-counter {
    text-align: center;
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 6px;
    font-weight: 600;
}

.question-card {
    background: var(--white);
    border-radius: 16px;
    padding: 34px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.question-text {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.9;
    color: var(--gray-900);
    margin-bottom: 28px;
}

.options-list { display: flex; flex-direction: column; gap: 12px; }

.option-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    cursor: pointer;
    transition: all .18s;
    font-size: 15px;
    font-weight: 500;
    background: var(--white);
    width: 100%;
    text-align: right;
    direction: rtl;
}

.option-item:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-light); }
.option-item .opt-label {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
}

.option-item.correct  { border-color: var(--success); background: var(--success-light); }
.option-item.wrong    { border-color: var(--danger);  background: var(--danger-light);  }
.option-item.correct .opt-label { background: var(--success); color: white; }
.option-item.wrong   .opt-label { background: var(--danger);  color: white; }
.option-item:disabled { cursor: default; }

.quiz-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.files-list { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }

.file-item {
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all .2s;
    box-shadow: var(--shadow-sm);
}

.file-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.file-item .file-icon { font-size: 28px; flex-shrink: 0; }
.file-item .file-info { flex: 1; }
.file-item .file-info h4 { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.file-item .file-info span { font-size: 12px; color: var(--gray-500); }

.image-preview {
    width: 100%;
    border-radius: var(--radius);
    margin-top: 12px;
    border: 2px solid var(--gray-200);
    max-height: 400px;
    object-fit: contain;
}

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn .2s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--white);
    border-radius: 18px;
    padding: 30px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    animation: slideUp .25s;
}

@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 14px;
}

.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close { font-size: 22px; cursor: pointer; color: var(--gray-500); line-height: 1; }
.modal-close:hover { color: var(--danger); }

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 22px;
    border-top: 1px solid var(--gray-200);
    padding-top: 16px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 20px;
}

.breadcrumb a { color: var(--primary); font-weight: 600; }
.breadcrumb .sep { color: var(--gray-300); }

.result-card {
    background: var(--white);
    border-radius: 20px;
    padding: 48px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    margin: 60px auto;
}

.result-card .result-icon { font-size: 72px; margin-bottom: 20px; }
.result-card h2 { font-size: 26px; font-weight: 800; margin-bottom: 10px; }
.result-card .score { font-size: 48px; font-weight: 900; color: var(--primary); margin: 16px 0; }
.result-card p { font-size: 15px; color: var(--gray-500); margin-bottom: 28px; }

.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-20 { margin-bottom: 20px; }
.d-flex { display: flex; }
.gap-10 { gap: 10px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); font-size: 13px; }
.fw-700 { font-weight: 700; }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-500);
}
.empty-state .e-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

@media (max-width: 768px) {

    .sidebar { transform: translateX(100%); transition: transform .28s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 99;
    }
    .sidebar-backdrop.open { display: block; }

    .hamburger-btn {
        display: flex !important;
        align-items: center; justify-content: center;
        width: 38px; height: 38px;
        background: var(--primary-light);
        border: none; border-radius: 8px;
        font-size: 20px; cursor: pointer;
        margin-left: 10px;
    }

    .main-content { margin-right: 0; }
    .topbar { padding: 12px 16px; }
    .topbar-title { font-size: 15px; }
    .page-body { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-value { font-size: 22px; }
    .table-wrap { font-size: 13px; }
    thead th, tbody td { padding: 10px 10px; }
    .card-header { padding: 14px 16px; flex-wrap: wrap; gap: 8px; }
    .card-body   { padding: 16px; }
    .main-buttons { grid-template-columns: 1fr; gap: 16px; }
    .main-btn { padding: 32px 20px; }
    .main-btn .btn-icon { font-size: 44px; }
    .main-btn h3 { font-size: 18px; }
    .student-body { padding: 24px 16px; }
    .welcome-text { margin-bottom: 28px; }
    .welcome-text h2 { font-size: 22px; }
    .subject-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .subject-card { padding: 18px 14px; }
    .student-header { padding: 12px 16px; }
    .student-header .brand { font-size: 16px; }
    .quiz-layout { padding: 16px 14px; }
    .question-card { padding: 22px 18px; }
    .question-text { font-size: 15px; }
    .option-item { font-size: 14px; padding: 12px 14px; }
    .result-card { padding: 32px 20px; margin: 30px auto; }
    .result-card .score { font-size: 40px; }
    .login-card { padding: 32px 24px; }
    .file-item { flex-wrap: wrap; gap: 10px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .subject-grid { grid-template-columns: 1fr; }
    .topbar-title { font-size: 14px; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .quiz-nav { flex-wrap: wrap; gap: 8px; }
    .quiz-nav .btn { flex: 1; min-width: 100px; }
    .student-header .user-info { gap: 8px; }
    .main-btn { padding: 26px 16px; }
    .breadcrumb { font-size: 12px; flex-wrap: wrap; }
    .modal { padding: 22px 16px; }
    .modal-footer { flex-wrap: wrap; }
    table { font-size: 12px; }
    thead th, tbody td { padding: 8px 8px; }
    .hide-mobile { display: none !important; }
}

.cs-wrap {
    position: relative;
    width: 100%;
}
.cs-wrap.cs-inline { width: auto; }
.cs-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 14px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    background: var(--white);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 14px;
    color: var(--gray-900);
    cursor: pointer;
    user-select: none;
    transition: border-color .15s;
    direction: rtl;
    text-align: right;
}
.cs-trigger:hover { border-color: var(--gray-300); }
.cs-wrap.cs-open .cs-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.cs-trigger .cs-arrow {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--gray-500);
    border-bottom: 2px solid var(--gray-500);
    transform: rotate(45deg);
    margin-top: -4px;
    transition: transform .15s;
}
.cs-wrap.cs-open .cs-trigger .cs-arrow {
    transform: rotate(225deg);
    margin-top: 4px;
    border-color: var(--primary);
}
.cs-trigger .cs-label.cs-placeholder { color: var(--gray-500); }
.cs-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    max-height: 280px;
    overflow-y: auto;
    z-index: 500;
    padding: 6px;
    opacity: 0;
    transform: translateY(-4px) scale(.98);
    pointer-events: none;
    transition: opacity .1s ease, transform .1s ease;
}
.cs-wrap.cs-open .cs-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.cs-option {
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 14px;
    color: var(--gray-900);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cs-option:hover, .cs-option.cs-active {
    background: var(--primary-light);
    color: var(--primary-dark);
}
.cs-option.cs-selected {
    font-weight: 700;
    color: var(--primary);
}
.cs-option.cs-placeholder { color: var(--gray-500); }
.cs-native-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
