:root {
    --bg: #04060d;
    --font-vazir: 'Vazirmatn', Tahoma, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body.student-panel-page {
    margin: 0;
    font-family: var(--font-vazir);
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

.student-panel-page { min-height: 100vh; background: #04060d; }

.student-panel {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.student-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
    background: rgba(10, 15, 30, 0.95);
    border-left: 1px solid rgba(99, 102, 241, 0.2);
    overflow-y: auto;
}

.student-sidebar__brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: #f1f5f9;
    margin-bottom: 1.5rem;
}

.student-sidebar__brand .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: .75rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(34, 211, 238, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.35);
    font-size: 1.2rem;
    flex-shrink: 0;
}

.student-sidebar__brand strong { display: block; font-size: .95rem; }
.student-sidebar__brand small { display: block; color: #94a3b8; font-size: .72rem; }

.student-sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    flex: 1;
}

.student-sidebar__nav a {
    display: block;
    padding: .65rem .85rem;
    border-radius: .65rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: .88rem;
    transition: background .15s, color .15s;
}

.student-sidebar__nav a:hover,
.student-sidebar__nav a.active {
    background: rgba(99, 102, 241, 0.18);
    color: #f8fafc;
}

.student-sidebar__foot {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,.06);
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.student-sidebar__link {
    color: #94a3b8;
    font-size: .82rem;
    text-decoration: none;
}

.student-sidebar__logout {
    width: 100%;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.08);
    color: #fca5a5;
    border-radius: .55rem;
    padding: .55rem;
    cursor: pointer;
    font-family: var(--font-vazir);
}

.student-main {
    min-width: 0;
    padding: 1.25rem 1.5rem 2rem;
}

.student-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.student-topbar__head {
    flex: 1;
    min-width: 0;
}

.student-topbar__title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 900;
    color: #f1f5f9;
}

.student-topbar__sub {
    margin: .35rem 0 0;
    color: #94a3b8;
    font-size: .88rem;
}

.student-topbar__user {
    text-align: left;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: .75rem;
    padding: .55rem .85rem;
}

.student-topbar__user span { display: block; color: #e2e8f0; font-weight: 700; font-size: .9rem; }
.student-topbar__user small { color: #94a3b8; font-size: .78rem; }

.student-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: .65rem;
    border: 1px solid rgba(99, 102, 241, 0.35);
    background: rgba(15, 23, 42, 0.9);
    color: #e2e8f0;
    font-size: 1.25rem;
    cursor: pointer;
    flex-shrink: 0;
    font-family: var(--font-vazir);
}

.student-sidebar-backdrop {
    display: none;
}

.student-content { max-width: 1100px; }

.sp-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .85rem;
    margin-bottom: 1.25rem;
}

.sp-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (max-width: 960px) {
    .student-panel { grid-template-columns: 1fr; }

    .student-nav-toggle { display: inline-flex; }

    .student-topbar {
        align-items: center;
        flex-wrap: nowrap;
        gap: .65rem;
    }

    .student-topbar__head {
        order: 0;
    }

    .student-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 280;
        background: rgba(0, 0, 0, 0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

    .student-sidebar-backdrop.is-open {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .student-sidebar {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        width: min(280px, 88vw);
        height: 100dvh;
        z-index: 300;
        transform: translate3d(100%, 0, 0);
        transition: transform .25s ease;
        border-inline-end: 1px solid rgba(99, 102, 241, 0.25);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
        visibility: hidden;
        pointer-events: none;
    }

    .student-sidebar.is-open {
        transform: translate3d(0, 0, 0);
        visibility: visible;
        pointer-events: auto;
    }

    .student-sidebar__nav {
        display: flex;
        flex-direction: column;
        grid-template-columns: unset;
    }

    .sp-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .sp-cards { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .student-main { padding: .85rem .75rem 1.25rem; }
    .sp-grid-4, .sp-grid-2 { grid-template-columns: 1fr; }
    .student-topbar__title { font-size: 1rem; line-height: 1.35; }
    .student-topbar__sub { font-size: .8rem; }
    .student-topbar__user { display: none; }
    .sp-video { min-height: 200px; }
    .sp-card { padding: .95rem; }
    .sp-btn { min-height: 44px; }
    .ticket-msg--mine { margin-inline-start: 0; }
    .ticket-msg--support { margin-inline-end: 0; }
    .sp-list li,
    .sp-row {
        flex-direction: column;
        align-items: flex-start;
        gap: .35rem;
    }
}

.student-panel-page {
    overflow-x: hidden;
}

.sp-card {
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 1rem;
    padding: 1.1rem 1.15rem;
}

.sp-card h2, .sp-card h3 {
    margin: 0 0 .85rem;
    font-size: 1rem;
    color: #e2e8f0;
}

.sp-stat {
    text-align: center;
}

.sp-stat__val {
    display: block;
    font-size: 1.5rem;
    font-weight: 900;
    color: #22d3ee;
    margin-bottom: .25rem;
}

.sp-stat__label {
    font-size: .78rem;
    color: #94a3b8;
}

.sp-list { list-style: none; padding: 0; margin: 0; }

.sp-list li,
.sp-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .7rem 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
    font-size: .88rem;
}

.sp-list li:last-child,
.sp-row:last-child { border-bottom: none; }

.sp-muted { color: #94a3b8; font-size: .82rem; }

.sp-badge {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
}

.sp-badge--ok { background: rgba(34,197,94,.15); color: #86efac; }
.sp-badge--warn { background: rgba(234,179,8,.15); color: #fde047; }
.sp-badge--err { background: rgba(239,68,68,.15); color: #fca5a5; }
.sp-badge--info { background: rgba(99,102,241,.15); color: #a5b4fc; }

.sp-badge--level {
    background: rgba(34, 211, 238, 0.12);
    color: #67e8f9;
    border: 1px solid rgba(34, 211, 238, 0.28);
}

.sp-education-levels {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.35rem 0 0.5rem;
}

.sp-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
    gap: 1rem;
}

.sp-course-card {
    display: flex;
    flex-direction: column;
    gap: .65rem;
}

.sp-content-thumb {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.25);
    margin-bottom: .5rem;
    display: block;
}

.sp-content-thumb--hero.sp-content-thumb--hidden {
    display: none !important;
}

.sp-media-block .sp-video {
    margin-top: 0;
}

.sp-content-thumb--hero {
    max-height: 280px;
    border-radius: 14px;
    margin-bottom: 1rem;
}

.sp-course-card h3 {
    margin: 0;
    font-size: 1rem;
    color: #f1f5f9;
}

.sp-course-card p {
    margin: 0;
    color: #94a3b8;
    font-size: .85rem;
    line-height: 1.6;
    flex: 1;
}

.sp-price {
    font-size: 1.05rem;
    font-weight: 800;
    color: #22d3ee;
}

.sp-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: .35rem;
}

.sp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .55rem 1rem;
    border-radius: .6rem;
    font-size: .84rem;
    font-family: var(--font-vazir);
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.sp-btn--primary {
    background: linear-gradient(135deg, #6366f1, #22d3ee);
    color: #041018;
    font-weight: 800;
}

.sp-btn--ghost {
    background: transparent;
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #c7d2fe;
}

.sp-btn--danger {
    background: rgba(239,68,68,.12);
    border: 1px solid rgba(239,68,68,.35);
    color: #fca5a5;
}

.sp-search {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
}

.sp-search input {
    flex: 1;
    padding: .65rem .85rem;
    border-radius: .6rem;
    border: 1px solid rgba(99, 102, 241, 0.3);
    background: rgba(4, 6, 13, 0.6);
    color: #f1f5f9;
    font-family: var(--font-vazir);
}

.sp-content-body {
    color: #cbd5e1;
    line-height: 1.85;
    font-size: .92rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.sp-content-body img { max-width: 100%; height: auto; border-radius: .75rem; }
.sp-content-body table { display: block; max-width: 100%; overflow-x: auto; }
.sp-content-body pre,
.sp-content-body .katex-display {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sp-table-wrap { overflow-x: auto; }

.sp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .86rem;
}

.sp-table th,
.sp-table td {
    padding: .65rem .5rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    text-align: right;
}

.sp-table th { color: #94a3b8; font-weight: 600; }

.sp-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #94a3b8;
}

.sp-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .85rem;
}

@media (max-width: 640px) { .sp-form-grid { grid-template-columns: 1fr; } }

.sp-form-grid label {
    display: block;
    font-size: .8rem;
    color: #94a3b8;
    margin-bottom: .3rem;
}

.sp-form-grid input,
.sp-form-grid select,
.sp-form-grid textarea {
    width: 100%;
    padding: .65rem .8rem;
    border-radius: .6rem;
    border: 1px solid rgba(99, 102, 241, 0.3);
    background: rgba(4, 6, 13, 0.6);
    color: #f1f5f9;
    font-family: var(--font-vazir);
}

.sp-form-grid .full { grid-column: 1 / -1; }

.sp-pagination { margin-top: 1rem; }
.sp-pagination nav { display: flex; justify-content: center; }

.sp-video {
    aspect-ratio: 16/9;
    width: 100%;
    border: none;
    border-radius: .75rem;
    background: #000;
    display: block;
    margin: 1rem 0;
}

.sp-premium-lock {
    margin: 1rem 0;
    padding: 1rem 1.1rem;
    border-radius: .75rem;
    border: 1px solid rgba(251, 191, 36, 0.45);
    background: rgba(251, 191, 36, 0.08);
    color: #fde68a;
}

.sp-premium-lock .sp-actions {
    margin-top: .75rem;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.sp-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1rem;
}

.ticket-thread { display: flex; flex-direction: column; gap: .85rem; }

.ticket-msg {
    border-radius: .85rem;
    padding: .9rem 1rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.ticket-msg--mine { background: rgba(99, 102, 241, 0.12); margin-left: 1.5rem; }
.ticket-msg--support { background: rgba(15, 23, 42, 0.9); margin-right: 1.5rem; border-color: rgba(34, 211, 238, 0.25); }

.ticket-msg__head {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .5rem;
    font-size: .82rem;
}

.ticket-msg__head strong { color: #e2e8f0; }
.ticket-msg__head span { color: #94a3b8; }

.ticket-msg__body { color: #cbd5e1; line-height: 1.75; font-size: .9rem; }

.ticket-msg__files { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .65rem; }

.ticket-file {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .65rem;
    border-radius: .5rem;
    background: rgba(4, 6, 13, 0.5);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
    text-decoration: none;
    font-size: .78rem;
}

.ticket-file small { color: #64748b; }
