/* =============================================================================
   آکادمی هوشمند — استایل اختصاصی (RTL)
   -----------------------------------------------------------------------------
   Tailwind از CDN بارگذاری می‌شود؛ این فایل فقط چیزهایی است که Tailwind پوشش
   نمی‌دهد: فونت سلف‌هاست، گلاس‌مورفیسم، انیمیشن‌ها، اسکرول‌بار و اصلاحات RTL.
   ========================================================================== */

/* ---------------------------------------------------------------- فونت فارسی */
/* فونت خودمیزبان (بدون وابستگی به Google Fonts) برای پایداری در ایران */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* -------------------------------------------------------------------- پایه */
:root {
    --lms-primary: #6366f1;
    --lms-primary-2: #8b5cf6;
    --lms-glow: rgba(99, 102, 241, .35);
    --lms-radius: 1.25rem;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', 'Vazir', 'Segoe UI', Tahoma, sans-serif;
    font-feature-settings: 'ss01';
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.lms-page-shell {
    max-width: none;
    min-width: 0;
}

.lms-page-shell > main {
    min-width: 0;
}

img,
video,
canvas,
iframe {
    max-width: 100%;
}

.table-wrap,
.overflow-x-auto {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

main .table-wrap,
main .overflow-x-auto {
    border-radius: 1rem;
}

main table:not([role='presentation']) {
    border-collapse: separate;
    border-spacing: 0;
    line-height: 1.75;
}

main .table-lms,
main table.table {
    width: 100%;
    min-width: 42rem;
}

main .table-lms th,
main .table-lms td,
main table.table th,
main table.table td {
    padding: .9rem 1rem;
    vertical-align: middle;
    text-align: right;
}

main .table-lms thead th,
main table.table thead th {
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.6;
    white-space: nowrap;
    color: rgb(71 85 105);
    background: rgba(148, 163, 184, .1);
    border-bottom: 1px solid rgba(148, 163, 184, .3);
}

main .table-lms tbody td,
main table.table tbody td {
    border-bottom: 1px solid rgba(148, 163, 184, .16);
}

main .table-lms tbody tr:last-child td,
main table.table tbody tr:last-child td {
    border-bottom: 0;
}

main .table-lms tbody tr:hover,
main table.table tbody tr:hover {
    background: rgba(99, 102, 241, .06);
}

.dark main .table-lms thead th,
.dark main table.table thead th {
    color: rgb(203 213 225);
    background: rgba(30, 41, 59, .72);
    border-bottom-color: rgba(148, 163, 184, .24);
}

.dark main .table-lms tbody td,
.dark main table.table tbody td {
    border-bottom-color: rgba(148, 163, 184, .14);
}

/* در RTL، اعداد و کدها همیشه چپ‌به‌راست نمایش داده شوند */
.ltr {
    direction: ltr;
    text-align: left;
    unicode-bidi: embed;
}

.num {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

/* -------------------------------------------------- نور پس‌زمینه (گرادیان نرم) */
.bg-aurora {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.bg-aurora::before,
.bg-aurora::after {
    content: '';
    position: absolute;
    width: 45rem;
    height: 45rem;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .35;
    animation: aurora-float 18s ease-in-out infinite alternate;
}

.bg-aurora::before {
    background: radial-gradient(circle at 30% 30%, #6366f1, transparent 65%);
    top: -18rem;
    right: -12rem;
}

.bg-aurora::after {
    background: radial-gradient(circle at 70% 70%, #ec4899, transparent 65%);
    bottom: -20rem;
    left: -14rem;
    animation-delay: -8s;
}

.dark .bg-aurora::before { opacity: .28; }
.dark .bg-aurora::after { opacity: .22; }

@keyframes aurora-float {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(-4rem, 3rem, 0) scale(1.12); }
}

/* ----------------------------------------------------------- گلس‌مورفیسم */
.glass {
    background: rgba(255, 255, 255, .72);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, .55);
}

.dark .glass {
    background: rgba(17, 24, 39, .62);
    border-color: rgba(148, 163, 184, .16);
}

.glass-strong {
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, .7);
}

.dark .glass-strong {
    background: rgba(15, 23, 42, .92);
    border-color: rgba(148, 163, 184, .18);
}

/* کارت‌های اصلی: سایه نرم + گوشه‌های گرد + هاور ملایم */
.card {
    border-radius: var(--lms-radius);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 48px -24px var(--lms-glow);
}

.gradient-text {
    background: linear-gradient(120deg, #6366f1, #a855f7 45%, #ec4899);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.gradient-primary {
    background-image: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
}

.gradient-warm {
    background-image: linear-gradient(135deg, #f59e0b 0%, #f97316 55%, #ef4444 100%);
}

/* ----------------------------------------------------------------- انیمیشن */
[data-animate] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .6s cubic-bezier(.22, 1, .36, 1), transform .6s cubic-bezier(.22, 1, .36, 1);
    will-change: opacity, transform;
}

[data-animate].is-visible {
    opacity: 1;
    transform: none;
}

@keyframes lms-pop {
    0%   { transform: scale(.8); opacity: 0; }
    60%  { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(1); }
}

.animate-pop { animation: lms-pop .45s cubic-bezier(.22, 1, .36, 1) both; }

@keyframes lms-float-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

.animate-in { animation: lms-float-in .5s ease both; }

@keyframes lms-pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(99, 102, 241, .5); }
    70%  { box-shadow: 0 0 0 12px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.pulse-ring { animation: lms-pulse-ring 2s infinite; }

@keyframes lms-flame {
    0%, 100% { transform: scale(1) rotate(-2deg); }
    50%      { transform: scale(1.12) rotate(2deg); }
}

.flame-anim { animation: lms-flame 1.6s ease-in-out infinite; }

/* --------------------------------------------------------- نوار پیشرفت */
.progress-track {
    background: rgba(148, 163, 184, .22);
    border-radius: 999px;
    overflow: hidden;
    height: .5rem;
}

.progress-bar {
    height: 100%;
    border-radius: 999px;
    background-image: linear-gradient(90deg, #6366f1, #8b5cf6 60%, #ec4899);
    transition: width 1.1s cubic-bezier(.22, 1, .36, 1);
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(120deg, rgba(255, 255, 255, .35), transparent 60%);
    animation: shimmer 2.4s linear infinite;
}

@keyframes shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

/* --------------------------------------------------------------- کانفتی */
.confetti-piece {
    position: fixed;
    width: 10px;
    height: 14px;
    top: -20px;
    z-index: 90;
    border-radius: 3px;
    pointer-events: none;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0%   { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(105vh) rotate(720deg); opacity: .9; }
}

/* ------------------------------------------------------- حلقه امتیاز/SVG */
.ring-progress circle {
    transition: stroke-dashoffset 1.2s cubic-bezier(.22, 1, .36, 1);
}

/* ------------------------------------------------------------ اسکرول‌بار */
.scrollbar-slim::-webkit-scrollbar { width: 8px; height: 8px; }
.scrollbar-slim::-webkit-scrollbar-track { background: transparent; }
.scrollbar-slim::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, .45);
    border-radius: 999px;
}
.scrollbar-slim::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, .7); }

/* ------------------------------------------------------------- منوی کنار */
.nav-item {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .625rem .875rem;
    border-radius: .875rem;
    font-size: .9rem;
    font-weight: 500;
    color: rgb(71 85 105);
    transition: background-color .2s ease, color .2s ease, transform .2s ease;
}

.dark .nav-item { color: rgb(203 213 225); }

.nav-item:hover {
    background: rgba(99, 102, 241, .1);
    color: #4f46e5;
    transform: translateX(-2px);
}

.dark .nav-item:hover { color: #c7d2fe; }

.nav-active {
    background: linear-gradient(135deg, rgba(99, 102, 241, .16), rgba(168, 85, 247, .14));
    color: #4f46e5 !important;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, .25);
}

.dark .nav-active { color: #c7d2fe !important; }

/* ----------------------------------------------------------------- فرم‌ها */
.input {
    width: 100%;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, .45);
    background: rgba(255, 255, 255, .85);
    padding: .75rem 1rem;
    font-size: .925rem;
    color: rgb(15 23 42);
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.dark .input {
    background: rgba(15, 23, 42, .75);
    border-color: rgba(100, 116, 139, .5);
    color: rgb(226 232 240);
}

.dark input:not([type='checkbox']):not([type='radio']):not([type='range']),
.dark textarea,
.dark select {
    padding: .75rem 1rem;
    border: 1px solid rgba(148, 163, 184, .38);
    border-radius: 1rem;
    background-color: rgba(15, 23, 42, .82);
    color: rgb(226 232 240);
    color-scheme: dark;
}

.dark input:not([type='checkbox']):not([type='radio']):not([type='range'])::placeholder,
.dark textarea::placeholder {
    color: rgba(203, 213, 225, .68);
}

.dark input:not([type='checkbox']):not([type='radio']):not([type='range']):focus,
.dark textarea:focus,
.dark select:focus {
    outline: none;
    border-color: rgba(129, 140, 248, .9);
    background-color: rgba(15, 23, 42, .96);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .2);
}

.dark select option {
    background: #0f172a;
    color: rgb(226 232 240);
}

.input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .18);
}

.input::placeholder { color: rgba(100, 116, 139, .8); }

.input-error {
    border-color: #f43f5e !important;
    box-shadow: 0 0 0 4px rgba(244, 63, 94, .15) !important;
}

.label {
    display: block;
    margin-bottom: .4rem;
    font-size: .85rem;
    font-weight: 500;
    color: rgb(51 65 85);
}

.dark .label { color: rgb(203 213 225); }

/* چک‌باکس و رادیو با رنگ برند */
input[type='checkbox'],
input[type='radio'] {
    accent-color: #6366f1;
}

/* ---------------------------------------------------------------- دکمه‌ها */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border-radius: 1rem;
    padding: .7rem 1.25rem;
    font-size: .9rem;
    font-weight: 600;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, color .18s ease;
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn:active { transform: scale(.97); }

.btn-primary {
    background-image: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    box-shadow: 0 12px 28px -14px rgba(99, 102, 241, .9);
}

.btn-primary:hover { box-shadow: 0 18px 34px -14px rgba(99, 102, 241, 1); }

.btn-ghost {
    background: rgba(148, 163, 184, .14);
    color: rgb(51 65 85);
}

.dark .btn-ghost { color: rgb(226 232 240); }
.btn-ghost:hover { background: rgba(148, 163, 184, .24); }

.btn-danger {
    background: rgba(244, 63, 94, .14);
    color: #e11d48;
    border-color: rgba(244, 63, 94, .28);
}

.btn-danger:hover { background: rgba(244, 63, 94, .22); }

.btn-sm { padding: .45rem .85rem; font-size: .8rem; border-radius: .85rem; }
.btn-xs { padding: .3rem .6rem; font-size: .72rem; border-radius: .7rem; }

/* ------------------------------------------------------------ جدول‌ها */
.table-lms { width: 100%; border-collapse: separate; border-spacing: 0; }

.table-lms thead th {
    font-size: .78rem;
    font-weight: 600;
    color: rgb(100 116 139);
    text-align: right;
    padding: .75rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, .3);
    white-space: nowrap;
}

.table-lms tbody td {
    padding: .85rem 1rem;
    font-size: .875rem;
    border-bottom: 1px solid rgba(148, 163, 184, .16);
    vertical-align: middle;
}

.table-lms tbody tr:hover { background: rgba(99, 102, 241, .05); }

/* --------------------------------------------------------------- نشان‌ها */
.badge-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    --tw-ring-offset-width: 0px;
    box-shadow: inset 0 0 0 1px currentColor;
}

/* ظرف تیتر صفحات: فاصله و راست‌چین اجباری */
.page-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: rgb(15 23 42);
}

.dark .page-title { color: rgb(241 245 249); }

/* --------------------------------------------------- استایل پرینت (کارنامه) */
@media print {
    .no-print { display: none !important; }
    body { background: #fff !important; }
}

/* ------------------------------------------------- موبایل: مخفی‌کردن extras */
@media (max-width: 640px) {
    .hide-mobile { display: none !important; }

    .lms-page-shell {
        display: block;
        padding-left: .75rem;
        padding-right: .75rem;
    }

    .lms-page-shell > main {
        width: 100%;
    }

    main .table-lms,
    main table.table {
        min-width: 38rem;
    }

    main .table-lms th,
    main .table-lms td,
    main table.table th,
    main table.table td {
        padding: .75rem .85rem;
    }
}

/* احترام به تنظیم کاهش انیمیشن کاربر */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
    [data-animate] { opacity: 1; transform: none; }
}

/* =============================================================================
   تنظیمات جامع تم، فونت، اندازه قلم و دسترس‌پذیری
   ========================================================================== */

/* ------------------------------------------------------------- تم سپیا / مطالعه */
html.theme-sepia body {
    background-color: #fbf0d9 !important;
    color: #433422 !important;
}
html.theme-sepia .glass,
html.theme-sepia .card,
html.theme-sepia .bg-white,
html.theme-sepia .bg-slate-50,
html.theme-sepia .bg-slate-800 {
    background-color: #f4e4c1 !important;
    color: #3b2b17 !important;
    border-color: #e5cd9e !important;
}
html.theme-sepia a { color: #8c4c00 !important; }

/* -------------------------------------------------------- تم کنتراست بالا */
html.theme-high-contrast body {
    background-color: #000000 !important;
    color: #ffffff !important;
}
html.theme-high-contrast .glass,
html.theme-high-contrast .card,
html.theme-high-contrast .bg-white,
html.theme-high-contrast .bg-slate-50,
html.theme-high-contrast .bg-slate-800 {
    background-color: #0d0d0d !important;
    color: #ffff00 !important;
    border: 2px solid #ffff00 !important;
}
html.theme-high-contrast a {
    color: #00ffff !important;
    text-decoration: underline !important;
}
html.theme-high-contrast button {
    border: 2px solid #ffffff !important;
}

/* ------------------------------------------------------------- فونت‌های انتخابی */
body.font-vazir, html[data-font="vazir"] body {
    font-family: 'Vazirmatn', Tahoma, sans-serif !important;
}
body.font-yekan, html[data-font="yekan"] body {
    font-family: 'Yekan', 'Shabnam', 'Vazirmatn', sans-serif !important;
}
body.font-sahel, html[data-font="sahel"] body {
    font-family: 'Sahel', 'Vazirmatn', serif !important;
}
body.font-system, html[data-font="system"] body {
    font-family: Tahoma, Arial, sans-serif !important;
}

/* ------------------------------------------------------------- مقیاس اندازه قلم */
html.text-scale-sm { font-size: 14px; }
html.text-scale-md { font-size: 16px; }
html.text-scale-lg { font-size: 18px; }
html.text-scale-xl { font-size: 20px; }

/* ------------------------------------------------------------- کاهش اجباری حرکت */
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
}
