/* =========================================================
   Online School Dashboard - Premium UI V2 (Final Version)
   RTL / Vazirmatn / Local Assets / No CDN
========================================================= */

/* =========================
   Font Definitions
========================= */
@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;
}

@font-face {
    font-family: "bootstrap-icons";
    src: url("../bootstrap-icons/fonts/bootstrap-icons.woff2") format("woff2"),
         url("../bootstrap-icons/fonts/bootstrap-icons.woff") format("woff");
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

/* =========================
   Root Variables
========================= */
:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: rgba(255, 255, 255, 0.76);
    --surface-glass: rgba(255, 255, 255, 0.88);
    --surface-glass-strong: rgba(255, 255, 255, 0.94);

    --text: #172033;
    --title: #101828;
    --muted: #7c8799;
    --muted-2: #98a2b3;
    --text-light: #526071;

    --primary: #4361ee;
    --primary-2: #5b7cfa;
    --primary-3: #243bdb;
    --primary-soft: #eef2ff;
    --primary-soft-2: #e0e7ff;
    --primary-gradient: linear-gradient(135deg, #4361ee, #5b7cfa);
    --primary-gradient-alt: linear-gradient(135deg, #243bdb, #4361ee);

    --purple: #7c3aed;
    --purple-soft: #f3e8ff;
    --purple-gradient: linear-gradient(135deg, #5b7cfa, #7c3aed);

    --green: #10b981;
    --green-2: #059669;
    --green-soft: #ecfdf5;
    --green-gradient: linear-gradient(180deg, #10b981, #059669);

    --orange: #f59e0b;
    --orange-soft: #fff7ed;

    --red: #ef4444;
    --red-soft: #fef2f2;

    --blue: #0ea5e9;
    --blue-soft: #eef9ff;
    --blue-gradient: linear-gradient(180deg, #5b7cfa, #4361ee);

    --border: rgba(148, 163, 184, 0.22);
    --border-soft: rgba(226, 232, 240, 0.8);
    --border-strong: rgba(255, 255, 255, 0.88);
    --border-glass: rgba(255, 255, 255, 0.92);

    --shadow-xs: 0 4px 16px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 18px 45px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 26px 60px rgba(67, 97, 238, 0.18);
    --shadow-card-hover: 0 20px 34px rgba(0, 0, 0, 0.12);
    --shadow-card-active: 0 14px 28px rgba(67, 97, 238, 0.22);
    --shadow-card-glass: inset 0 1px 0 rgba(255,255,255,0.25), 0 24px 42px rgba(0,0,0,0.10);

    --radius-xs: 10px;
    --radius-sm: 14px;
    --radius-md: 18px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --radius-2xl: 34px;
    --radius-round: 999px;

    --sidebar-width: 292px;
    --header-height: 76px;

    --transition: all 0.25s ease;
    --transition-fast: all 0.18s ease;
    --transition-hover: transform 0.25s ease, box-shadow 0.25s ease;
}

/* =========================
   Reset & Base
========================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    margin: 0;
    padding: 0;
    direction: rtl;
    min-height: 100vh;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    font-weight: 400;
    line-height: 1.7;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(67, 97, 238, 0.12), transparent 32%),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.10), transparent 30%),
        var(--bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(67, 97, 238, 0.16);
    color: var(--title);
}

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

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

img {
    display: block;
    max-width: 100%;
    height: auto;
}

button,
input,
select,
textarea {
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    outline: none;
}

button {
    border: none;
    cursor: pointer;
    background: none;
}

input,
select,
textarea {
    color: var(--text);
}

ul,
ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0 0 0.6rem;
    line-height: 1.45;
    color: var(--title);
    font-weight: 800;
    letter-spacing: -0.4px;
}

h1 { font-size: 2.1rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.4rem; }
h4 { font-size: 1.15rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

p {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.9;
}

strong,
b {
    font-weight: 700;
}

small {
    font-size: 0.82rem;
    color: var(--muted);
}

hr {
    border: 0;
    height: 1px;
    background: var(--border-soft);
    margin: 1rem 0;
}

/* =========================
   Utilities
========================= */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--green) !important; }
.text-danger  { color: var(--red) !important; }
.text-warning { color: var(--orange) !important; }
.text-muted   { color: var(--muted) !important; }

.bg-primary-soft { background: var(--primary-soft) !important; }
.bg-success-soft { background: var(--green-soft) !important; }
.bg-danger-soft  { background: var(--red-soft) !important; }
.bg-warning-soft { background: var(--orange-soft) !important; }

.fw-400 { font-weight: 400 !important; }
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }

.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-xl { border-radius: var(--radius-xl) !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.d-flex { display: flex !important; }
.d-grid { display: grid !important; }
.d-none { display: none !important; }
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.gap-8 { gap: 8px !important; }
.gap-12 { gap: 12px !important; }
.gap-16 { gap: 16px !important; }
.gap-20 { gap: 20px !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }
.text-center { text-align: center !important; }

.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-8 { margin-bottom: 8px !important; }
.mb-12 { margin-bottom: 12px !important; }
.mb-16 { margin-bottom: 16px !important; }
.mb-20 { margin-bottom: 20px !important; }
.mb-24 { margin-bottom: 24px !important; }

/* =========================
   App Layout
========================= */
.app-shell {
    display: flex;
    flex-direction: row;
    gap: 18px;
    min-height: 100vh;
    padding: 18px;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--surface-glass);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-xl);
    padding: 20px;
    position: sticky;
    top: 18px;
    height: calc(100vh - 36px);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    overflow: hidden;
    transition: var(--transition);
}

.sidebar::before {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(67, 97, 238, 0.08);
    top: -70px;
    right: -80px;
    pointer-events: none;
    z-index: 0;
}

.sidebar::after {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.06);
    bottom: -80px;
    left: -60px;
    pointer-events: none;
    z-index: 0;
}

.main-content {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* =========================
   Sidebar Brand
========================= */
.sidebar-brand {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 13px;
    padding-bottom: 22px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.brand-logo {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.35rem;
    background: var(--primary-gradient);
    box-shadow: 0 14px 28px rgba(67, 97, 238, 0.28);
    flex-shrink: 0;
}

.brand-text h1 {
    font-size: 1.08rem;
    margin: 0 0 4px;
}

.brand-text span {
    font-size: 0.78rem;
    color: var(--muted);
}

/* =========================
   Sidebar Menu
========================= */
.sidebar-menu {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow-y: auto;
    padding-left: 4px;
}

.sidebar-menu::-webkit-scrollbar {
    width: 6px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.32);
    border-radius: 20px;
}

.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}

.menu-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    margin: 12px 8px 10px;
}

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item a,
.menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    padding: 12px 14px;
    border-radius: 16px;
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 600;
    position: relative;
    transition: var(--transition);
}

.menu-item a:hover,
.menu-link:hover {
    background: rgba(67, 97, 238, 0.08);
    color: var(--primary);
    transform: translateX(-2px);
}

.menu-item.active a,
.menu-link.active {
    color: var(--primary);
    background: linear-gradient(135deg, rgba(67, 97, 238, 0.14), rgba(91, 124, 250, 0.10));
    box-shadow: inset 0 0 0 1px rgba(67, 97, 238, 0.10);
}

.menu-item.active a::before,
.menu-link.active::before {
    content: "";
    position: absolute;
    right: 0;
    top: 10px;
    bottom: 10px;
    width: 4px;
    border-radius: 10px;
    background: var(--primary-gradient);
}

.menu-icon,
.menu-item i,
.menu-link i {
    width: 22px;
    min-width: 22px;
    font-size: 1.05rem;
    text-align: center;
}

.menu-text {
    flex: 1;
    text-align: right;
}

.menu-badge {
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: var(--radius-round);
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.76rem;
    font-weight: 700;
}

.sidebar-footer {
    position: relative;
    z-index: 2;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(255,255,255,0.65);
    border-radius: 18px;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: #dbe4ff;
    flex-shrink: 0;
}

.user-meta h6 {
    margin: 0 0 2px;
    font-size: 0.92rem;
}

.user-meta span {
    font-size: 0.78rem;
    color: var(--muted);
}

/* =========================
   Topbar
========================= */
.topbar {
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 18px;
    border-radius: var(--radius-xl);
    background: var(--surface-glass-strong);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-heading h2 {
    margin: 0;
    font-size: 1.35rem;
}

.page-heading p {
    margin: 2px 0 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.icon-btn,
.topbar-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-xs);
    transition: var(--transition-fast);
}

.icon-btn:hover,
.topbar-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    color: var(--primary);
}

.search-box {
    position: relative;
    width: 320px;
    max-width: 100%;
}

.search-box input {
    width: 100%;
    height: 48px;
    border-radius: 16px;
    border: 1px solid var(--border-soft);
    background: #fff;
    padding: 0 46px 0 16px;
    font-size: 0.92rem;
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
}

.search-box input:focus {
    border-color: rgba(67, 97, 238, 0.35);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.10);
}

.search-box i,
.search-box .search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.95rem;
}

.notification-dot {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 10px;
    height: 10px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid #fff;
}

/* =========================
   Cards
========================= */
.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    transition: var(--transition-hover);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

.card.glass {
    background: var(--surface-glass);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-card-glass);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.card-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.83rem;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    position: relative;
    z-index: 1;
}

.card-footer {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}

/* =========================
   Grid Layouts
========================= */
.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));
}

.grid-sidebar {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.9fr);
    gap: 18px;
}

/* =========================
   Stat Cards
========================= */
.stat-card {
    position: relative;
    padding: 22px;
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(255,255,255,0.88));
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: auto auto -60px -40px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(67, 97, 238, 0.06);
}

.stat-card .stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.2rem;
    box-shadow: 0 14px 28px rgba(67, 97, 238, 0.18);
}

.stat-card.primary .stat-icon { background: var(--primary-gradient); }
.stat-card.success .stat-icon { background: var(--green-gradient); }
.stat-card.purple .stat-icon  { background: var(--purple-gradient); }
.stat-card.orange .stat-icon  { background: linear-gradient(180deg, #f59e0b, #ea580c); }

.stat-card .stat-label {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    line-height: 1.2;
    font-weight: 800;
    color: var(--title);
    margin-bottom: 8px;
}

.stat-card .stat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.82rem;
}

.trend-up,
.trend-down {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-round);
    font-weight: 700;
    font-size: 0.76rem;
}

.trend-up {
    color: var(--green-2);
    background: var(--green-soft);
}

.trend-down {
    color: var(--red);
    background: var(--red-soft);
}

/* =========================
   Hero / Welcome Box
========================= */
.hero-card {
    position: relative;
    padding: 28px;
    border-radius: var(--radius-2xl);
    background: var(--primary-gradient);
    color: #fff;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.hero-card::before,
.hero-card::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.10);
}

.hero-card::before {
    width: 260px;
    height: 260px;
    top: -120px;
    left: -80px;
}

.hero-card::after {
    width: 180px;
    height: 180px;
    bottom: -80px;
    right: -40px;
}

.hero-card h2,
.hero-card h3,
.hero-card p,
.hero-card small {
    color: #fff;
    position: relative;
    z-index: 1;
}

.hero-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

/* =========================
   Buttons
========================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: 0.92rem;
    font-weight: 700;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    pointer-events: none;
}

.btn-primary {
    color: #fff;
    background: var(--primary-gradient);
    box-shadow: 0 12px 24px rgba(67, 97, 238, 0.22);
}

.btn-primary:hover {
    box-shadow: 0 16px 28px rgba(67, 97, 238, 0.28);
}

.btn-secondary {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: rgba(67, 97, 238, 0.10);
}

.btn-light {
    color: var(--text);
    background: #fff;
    border-color: var(--border-soft);
    box-shadow: var(--shadow-xs);
}

.btn-success {
    color: #fff;
    background: var(--green-gradient);
}

.btn-danger {
    color: #fff;
    background: linear-gradient(180deg, #ef4444, #dc2626);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: rgba(67, 97, 238, 0.24);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-soft);
}

.btn-sm {
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.84rem;
    border-radius: 12px;
}

.btn-lg {
    min-height: 50px;
    padding: 0 22px;
    font-size: 0.98rem;
}

/* =========================
   Forms
========================= */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--title);
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--muted);
}

.form-control,
.form-select,
textarea.form-control {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--border-soft);
    background: #fff;
    color: var(--text);
    font-size: 0.92rem;
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.form-control::placeholder,
.form-select::placeholder,
textarea.form-control::placeholder {
    color: #9aa4b2;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    border-color: rgba(67, 97, 238, 0.35);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.10);
}

.form-control.is-invalid,
.form-select.is-invalid,
textarea.form-control.is-invalid {
    border-color: rgba(239, 68, 68, 0.42);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.08);
}

.invalid-feedback {
    margin-top: 6px;
    color: var(--red);
    font-size: 0.8rem;
}

.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
    gap: 10px;
}

.input-icon {
    position: relative;
}

.input-icon .form-control {
    padding-right: 44px;
}

.input-icon i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 0.95rem;
}

/* =========================
   Checkbox / Radio / Switch
========================= */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 52px;
    height: 30px;
}

.switch input {
    display: none;
}

.switch-slider {
    width: 100%;
    height: 100%;
    background: #d7deea;
    border-radius: var(--radius-round);
    position: relative;
    transition: var(--transition-fast);
}

.switch-slider::before {
    content: "";
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    transition: var(--transition-fast);
}

.switch input:checked + .switch-slider {
    background: var(--primary);
}

.switch input:checked + .switch-slider::before {
    right: 26px;
}

/* =========================
   Tables
========================= */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-xl);
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 760px;
}

.table thead th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    text-align: right;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
    white-space: nowrap;
}

.table thead th:first-child {
    border-top-right-radius: 16px;
}

.table thead th:last-child {
    border-top-left-radius: 16px;
}

.table tbody td {
    padding: 15px 16px;
    font-size: 0.9rem;
    color: var(--text);
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
    background: #fff;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover td {
    background: #fbfcff;
}

.table .name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: var(--radius-round);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
}

.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--green-soft); color: var(--green-2); }
.badge-warning { background: var(--orange-soft); color: #c2410c; }
.badge-danger  { background: var(--red-soft); color: var(--red); }
.badge-purple  { background: var(--purple-soft); color: var(--purple); }

/* =========================
   List / Activity
========================= */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 16px;
    transition: var(--transition-fast);
}

.activity-item:hover {
    background: rgba(67, 97, 238, 0.05);
}

.activity-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.activity-icon.primary { background: var(--primary-soft); color: var(--primary); }
.activity-icon.success { background: var(--green-soft); color: var(--green-2); }
.activity-icon.warning { background: var(--orange-soft); color: #c2410c; }
.activity-icon.danger  { background: var(--red-soft); color: var(--red); }

.activity-content h6 {
    margin: 0 0 4px;
    font-size: 0.92rem;
}

.activity-content p {
    margin: 0 0 4px;
    font-size: 0.84rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--muted);
}

/* =========================
   Tabs
========================= */
.tabs {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px;
    background: rgba(255,255,255,0.76);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
}

.tab-btn {
    min-height: 40px;
    padding: 0 14px;
    border-radius: 12px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--primary);
    background: rgba(67, 97, 238, 0.08);
}

.tab-btn.active {
    color: var(--primary);
    background: #fff;
    box-shadow: var(--shadow-xs);
}

/* =========================
   Progress
========================= */
.progress {
    width: 100%;
    height: 10px;
    border-radius: var(--radius-round);
    background: #e9eef7;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: inherit;
    background: var(--primary-gradient);
}

.progress-bar.success { background: var(--green-gradient); }
.progress-bar.orange  { background: linear-gradient(135deg, #f59e0b, #f97316); }
.progress-bar.purple  { background: var(--purple-gradient); }

/* =========================
   Calendar / Schedule Blocks
========================= */
.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.schedule-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid var(--border-soft);
    transition: var(--transition-fast);
}

.schedule-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.schedule-time {
    min-width: 74px;
    text-align: center;
    padding: 10px 8px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 800;
    font-size: 0.86rem;
}

.schedule-content {
    flex: 1;
}

.schedule-content h6 {
    margin: 0 0 4px;
}

.schedule-content p {
    margin: 0;
    font-size: 0.82rem;
}

.schedule-status {
    flex-shrink: 0;
}

/* =========================
   Alerts
========================= */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert i {
    font-size: 1rem;
    margin-top: 2px;
}

.alert-primary {
    background: var(--primary-soft);
    color: var(--primary-3);
    border-color: rgba(67, 97, 238, 0.10);
}

.alert-success {
    background: var(--green-soft);
    color: var(--green-2);
    border-color: rgba(16, 185, 129, 0.10);
}

.alert-warning {
    background: var(--orange-soft);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.10);
}

.alert-danger {
    background: var(--red-soft);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.10);
}

/* =========================
   Dropdown
========================= */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 220px;
    background: rgba(255,255,255,0.96);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-md);
    border-radius: 18px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: var(--transition-fast);
    z-index: 30;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.dropdown.open .dropdown-menu,
.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.88rem;
    color: var(--text);
}

.dropdown-item:hover {
    background: rgba(67, 97, 238, 0.08);
    color: var(--primary);
}

/* =========================
   Modal
========================= */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 80;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 18px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    width: 100%;
    max-width: 560px;
    background: rgba(255,255,255,0.98);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transform: translateY(12px) scale(0.98);
    transition: var(--transition-fast);
}

.modal.show .modal-dialog {
    transform: translateY(0) scale(1);
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
}

.modal-header {
    border-bottom: 1px solid var(--border-soft);
}

.modal-footer {
    border-top: 1px solid var(--border-soft);
}

.modal-body {
    padding: 20px;
}

/* =========================
   Empty State
========================= */
.empty-state {
    display: grid;
    place-items: center;
    text-align: center;
    padding: 36px 20px;
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: 22px;
    background: rgba(255,255,255,0.55);
}

.empty-state .empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 1.5rem;
}

.empty-state h5 {
    margin-bottom: 6px;
}

.empty-state p {
    max-width: 420px;
    margin: 0 auto;
}

/* =========================
   Auth / Login Card
========================= */
.auth-wrapper {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    padding: 28px;
    border-radius: 28px;
    background: rgba(255,255,255,0.92);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.auth-logo {
    width: 62px;
    height: 62px;
    margin: 0 auto 16px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--primary-gradient);
    box-shadow: 0 16px 34px rgba(67, 97, 238, 0.28);
}

.auth-title {
    text-align: center;
    margin-bottom: 4px;
}

.auth-subtitle {
    text-align: center;
    margin-bottom: 22px;
}

/* =========================
   Footer
========================= */
.page-footer {
    padding: 8px 6px 18px;
    text-align: center;
    color: var(--muted);
    font-size: 0.82rem;
}

/* =========================
   Bootstrap Icons Helpers
========================= */
.bi {
    font-family: "bootstrap-icons" !important;
    font-style: normal;
    font-weight: normal !important;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

/* =========================
   Persian Datepicker
========================= */
.datepicker-plot-area,
.datepicker-plot-area * {
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif !important;
}

.datepicker-plot-area {
    border: 1px solid var(--border-soft) !important;
    border-radius: 18px !important;
    box-shadow: var(--shadow-md) !important;
    overflow: hidden;
}

.datepicker-plot-area .datepicker-day-view,
.datepicker-plot-area .datepicker-month-view,
.datepicker-plot-area .datepicker-year-view {
    background: #fff !important;
}

.datepicker-plot-area .datepicker-header {
    background: var(--primary-gradient) !important;
    color: #fff !important;
}

.datepicker-plot-area .datepicker-header *,
.datepicker-plot-area .toolbox *,
.datepicker-plot-area .datepicker-calendar-view * {
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif !important;
}

.datepicker-plot-area .datepicker-day-view .table-days td.selected span,
.datepicker-plot-area .datepicker-month-view .month-item.selected,
.datepicker-plot-area .datepicker-year-view .year-item.selected {
    background: var(--primary) !important;
    color: #fff !important;
    border-radius: 12px !important;
}

.datepicker-plot-area .table-days td span:hover,
.datepicker-plot-area .month-item:hover,
.datepicker-plot-area .year-item:hover {
    background: var(--primary-soft) !important;
    color: var(--primary) !important;
    border-radius: 12px !important;
}

/* =========================
   Scrollbar
========================= */
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

*::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.38);
    border-radius: 20px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

/* =========================
   Responsive
========================= */
@media (max-width: 1400px) {
    .grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    :root {
        --sidebar-width: 260px;
    }

    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-sidebar {
        grid-template-columns: 1fr;
    }

    .search-box {
        width: 240px;
    }
}

@media (max-width: 992px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-left,
    .topbar-right {
        justify-content: space-between;
        flex-wrap: wrap;
    }

    .search-box {
        width: 100%;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-shell {
        padding: 12px;
        gap: 12px;
    }

    .sidebar,
    .topbar,
    .card,
    .hero-card,
    .auth-card {
        border-radius: 20px;
    }

    .topbar,
    .card,
    .hero-card {
        padding: 16px;
    }

    .hero-card {
        padding: 22px;
    }

    .page-heading h2 {
        font-size: 1.15rem;
    }

    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .table {
        min-width: 640px;
    }

    .modal-dialog {
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .sidebar {
        padding: 16px;
    }

    .topbar {
        padding: 14px;
    }

    .card,
    .stat-card {
        padding: 16px;
    }

    .btn {
        width: 100%;
    }

    .hero-actions {
        flex-direction: column;
    }

    .input-group {
        flex-direction: column;
    }

    .menu-item a,
    .menu-link {
        min-height: 48px;
        padding: 11px 12px;
    }

    .brand-logo {
        width: 48px;
        height: 48px;
    }
}
