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

:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #667085;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --border: #e5e7eb;
    --shadow: 0 20px 45px rgba(15, 23, 42, .08);
    --radius: 18px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Anjoman', Tahoma, Arial, sans-serif;
    background: linear-gradient(135deg, #eef4ff 0%, #f7fafc 50%, #eefaf4 100%);
    color: var(--text);
    min-height: 100vh;
}

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

.app-shell { min-height: 100vh; display: flex; }

.sidebar {
    width: 280px;
    background: #0f172a;
    color: white;
    padding: 22px;
    position: fixed;
    inset: 0 auto 0 0;
    right: 0;
    overflow-y: auto;
}

.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.brand-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #38bdf8, #2563eb);
    font-weight: 900;
}
.brand strong { display:block; font-size: 17px; }
.brand small { color:#cbd5e1; font-size: 12px; }

.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a {
    padding: 13px 14px;
    border-radius: 14px;
    color: #e5e7eb;
    transition: .2s;
}
.sidebar nav a:hover,
.sidebar nav a.active {
    background: rgba(255,255,255,.12);
    color: #fff;
}

.content {
    width: 100%;
    margin-right: 280px;
    padding: 26px;
}

.public-content { width: 100%; }

.topbar {
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,.7);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin-bottom: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.topbar h1 { margin: 0 0 6px; font-size: 24px; }
.topbar p { margin: 0; color: var(--muted); }

.pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-size: 13px;
}

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
    background: var(--card);
    border: 1px solid rgba(226,232,240,.8);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 18px;
}
.card h2, .card h3 { margin-top: 0; }
.card p { color: var(--muted); line-height: 1.9; }

.stat { position: relative; overflow: hidden; }
.stat span { color: var(--muted); font-size: 14px; }
.stat strong { display:block; font-size: 32px; margin-top: 8px; }
.stat:after {
    content: '';
    position:absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    left: -25px;
    bottom: -35px;
    background: rgba(37,99,235,.09);
}

form .row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-group { margin-bottom: 14px; }
label { display:block; margin-bottom: 7px; color: #334155; font-size: 14px; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 12px 13px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    outline: none;
}

input[type="radio"],
input[type="checkbox"] {
    width: auto;
    min-width: 16px;
    height: 16px;
    padding: 0;
    margin: 0;
    accent-color: var(--primary);
    box-shadow: none;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,.08); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 13px;
    padding: 11px 16px;
    font-family: inherit;
    cursor: pointer;
    color: white;
    background: var(--primary);
    transition: .2s;
    margin: 2px;
}
.btn:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-light { background: #e2e8f0; color: #0f172a; }
.btn-light:hover { background: #cbd5e1; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-warning { background: var(--warning); }
.btn-warning:hover { background: #b45309; }
.btn-sm { padding: 8px 11px; font-size: 12px; border-radius: 10px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: right; padding: 13px 12px; border-bottom: 1px solid var(--border); }
th { color: #475569; background: #f8fafc; }
tr:hover td { background: #fbfdff; }

.badge { padding: 6px 10px; border-radius: 999px; font-size: 12px; display:inline-flex; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-muted { background: #f1f5f9; color: #475569; }

.alert {
    padding: 13px 16px;
    border-radius: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; color: #166534; border-color:#bbf7d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border-color:#fecaca; }
.alert-warning { background: #fffbeb; color:#92400e; border-color:#fde68a; }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
}
.login-card {
    width: 100%;
    max-width: 430px;
    background: rgba(255,255,255,.9);
    border-radius: 26px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,.8);
    padding: 28px;
}
.login-card h1 { margin-top: 0; text-align:center; }
.login-card p { color: var(--muted); text-align:center; line-height:1.8; }

.hero {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 30px;
}
.hero-inner { max-width: 980px; text-align: center; }
.hero h1 { font-size: clamp(32px, 6vw, 58px); margin: 0 0 15px; }
.hero p { color: var(--muted); font-size: 17px; line-height: 2; }
.hero-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

.exam-info-card {
    padding: 14px 18px;
}
.exam-info-card h2 {
    margin-bottom: 6px;
    font-size: 20px;
}
.exam-info-card p {
    margin: 0 0 8px;
    line-height: 1.7;
}

.question-card {
    border: 1px solid #dbe3ef;
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 14px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 10px 26px rgba(15, 23, 42, .055);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}
.question-card strong {
    grid-column: 1 / -1;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 10px;
    margin-bottom: 2px;
    padding: 2px 2px 8px;
    font-size: 16px;
    line-height: 1.8;
    color: #0f172a;
}
.option-box {
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
    margin: 0;
    background: #fff;
    display: flex;
    align-items: center;
    gap: 9px;
    color: #334155;
    line-height: 1.8;
    cursor: pointer;
    transition: .18s ease;
}
.option-box:hover {
    border-color: #93c5fd;
    background: #f8fbff;
    transform: translateY(-1px);
}
.option-box:has(input:checked),
.option-box.selected-option {
    border-color: var(--primary);
    background: #eff6ff;
    color: #1e40af;
    box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.timer { font-size: 20px; color: var(--danger); font-weight: bold; }
.check-list { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check-list label { background:#f8fafc; padding: 10px; border-radius: 12px; margin: 0; }
.empty { text-align:center; color:var(--muted); padding: 25px; }

@media (max-width: 900px) {
    .sidebar { position: static; width: 100%; }
    .app-shell { display:block; }
    .content { margin-right:0; padding: 16px; }
    .grid-2, .grid-3, .grid-4, form .row, .check-list, .question-card { grid-template-columns: 1fr; }
    .topbar { align-items:flex-start; flex-direction:column; }
}

.muted-note { color: var(--muted); font-size: 13px; text-align:center; margin-top: 16px; }

/* Jalali date picker */
.jalali-picker-wrapper {
    position: relative;
    width: 100%;
}

.jalali-picker-wrapper input[readonly] {
    cursor: pointer;
    background: #fff;
    padding-left: 48px;
}

.jalali-picker-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 11px;
    background: #eff6ff;
    color: #1d4ed8;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 17px;
    line-height: 1;
}

.jalali-picker-btn:hover {
    background: #dbeafe;
}

.jalali-calendar-panel {
    position: absolute;
    z-index: 9999;
    top: calc(100% + 8px);
    left: 0;
    width: 310px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .18);
    padding: 14px;
    direction: rtl;
}

.jcal-head,
.jcal-actions,
.jcal-time {
    display: flex;
    align-items: center;
    gap: 8px;
}

.jcal-head {
    justify-content: space-between;
    margin-bottom: 12px;
}

.jcal-title {
    font-weight: 800;
    color: #111827;
}

.jcal-nav {
    width: 34px;
    height: 34px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.jcal-nav:hover { background: #eff6ff; color: #1d4ed8; }

.jcal-week,
.jcal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.jcal-week {
    color: #64748b;
    font-size: 12px;
    text-align: center;
    margin-bottom: 6px;
}

.jcal-day {
    height: 34px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    font-family: inherit;
}

.jcal-day:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.jcal-day.active {
    background: #2563eb;
    color: #fff;
}

.jcal-time {
    justify-content: space-between;
    margin-top: 12px;
    padding: 10px;
    border-radius: 14px;
    background: #f8fafc;
}

.jcal-time label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #475569;
}

.jcal-time input {
    width: 70px;
    height: 36px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    text-align: center;
    direction: ltr;
}

.jcal-actions {
    justify-content: flex-end;
    margin-top: 12px;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .jalali-calendar-panel {
        width: 280px;
        right: 0;
        left: auto;
    }
}
