:root {
    --red-900: #5a0000;
    --red-800: #7f0000;
    --red-700: #a40000;
    --red-600: #bf0000;
    --red-500: #e00000;
    --red-400: #ff2a2a;

    --bg-soft: #f6f7fb;
    --bg-soft-2: #fff7f7;
    --card: #ffffff;
    --card-2: #fffafa;
    --text: #1f1720;
    --muted: #7c7480;
    --border: #f0dddd;
    --shadow: 0 12px 32px rgba(84, 0, 0, 0.12);
    --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.08);

    --sidebar-grad: linear-gradient(180deg, #181a24 0%, #30060a 40%, #730000 100%);
    --auth-grad: linear-gradient(135deg, #6e0000 0%, #bf0000 45%, #ff0909 100%);
}

body.theme-emerald {
    --red-900: #064e3b;
    --red-800: #047857;
    --red-700: #059669;
    --red-600: #10b981;
    --red-500: #14b8a6;
    --red-400: #2dd4bf;
    --bg-soft: #f3faf7;
    --bg-soft-2: #ecfdf5;
    --border: #d1fae5;
    --shadow: 0 12px 32px rgba(6, 95, 70, 0.12);
    --sidebar-grad: linear-gradient(180deg, #10201c 0%, #064e3b 46%, #0f766e 100%);
    --auth-grad: linear-gradient(135deg, #064e3b 0%, #0f766e 48%, #14b8a6 100%);
}

body.theme-indigo {
    --red-900: #312e81;
    --red-800: #3730a3;
    --red-700: #4338ca;
    --red-600: #4f46e5;
    --red-500: #6366f1;
    --red-400: #818cf8;
    --bg-soft: #f5f7ff;
    --bg-soft-2: #eef2ff;
    --border: #dbe2ff;
    --shadow: 0 12px 32px rgba(49, 46, 129, 0.12);
    --sidebar-grad: linear-gradient(180deg, #171827 0%, #312e81 48%, #4f46e5 100%);
    --auth-grad: linear-gradient(135deg, #312e81 0%, #4f46e5 50%, #818cf8 100%);
}

body.theme-gold {
    --red-900: #713f12;
    --red-800: #92400e;
    --red-700: #b45309;
    --red-600: #d97706;
    --red-500: #f59e0b;
    --red-400: #fbbf24;
    --bg-soft: #fffaf0;
    --bg-soft-2: #fffbeb;
    --border: #fdecc8;
    --shadow: 0 12px 32px rgba(146, 64, 14, 0.13);
    --sidebar-grad: linear-gradient(180deg, #241b12 0%, #713f12 48%, #d97706 100%);
    --auth-grad: linear-gradient(135deg, #713f12 0%, #d97706 50%, #fbbf24 100%);
}

body.theme-rose {
    --red-900: #831843;
    --red-800: #9d174d;
    --red-700: #be185d;
    --red-600: #db2777;
    --red-500: #ec4899;
    --red-400: #f472b6;
    --bg-soft: #fff5f9;
    --bg-soft-2: #fdf2f8;
    --border: #fbcfe8;
    --shadow: 0 12px 32px rgba(157, 23, 77, 0.13);
    --sidebar-grad: linear-gradient(180deg, #24121b 0%, #831843 48%, #db2777 100%);
    --auth-grad: linear-gradient(135deg, #831843 0%, #db2777 50%, #f472b6 100%);
}

html, body {
    margin: 0;
    padding: 0;
    font-family: "Inter", "Roboto", "Poppins", "Segoe UI", Arial, sans-serif;
    color: var(--text);
    background: var(--bg-soft);
}

a {
    text-decoration: none;
}

.page-shell {
    min-height: 100vh;
}

/* ===========================
   AUTH PAGES
=========================== */

.auth-page {
    min-height: 100vh;
    background: var(--auth-grad);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.auth-page::before,
.auth-page::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.auth-page::before {
    background:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,0.08), transparent 22%),
        radial-gradient(circle at 80% 10%, rgba(255,255,255,0.05), transparent 18%),
        radial-gradient(circle at 70% 80%, rgba(255,255,255,0.06), transparent 24%);
    mix-blend-mode: screen;
}

.auth-page::after {
    background:
        linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.05) 45%, transparent 46%),
        linear-gradient(145deg, transparent 0%, rgba(255,255,255,0.04) 55%, transparent 56%);
    opacity: 0.9;
}

.auth-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 390px;
    background: rgba(255,255,255,0.96);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 24px;
    box-shadow: 0 18px 48px rgba(45, 0, 0, 0.28);
    padding: 34px 28px 26px;
}

.auth-eyebrow {
    font-size: 12px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--red-800);
    font-weight: 700;
    margin-bottom: 10px;
}

.auth-title {
    font-size: 24px;
    line-height: 1.2;
    font-weight: 700;
    margin: 0 0 8px;
    color: #24151a;
}

.auth-subtitle {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 22px;
}

.form-label-sattva {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
    color: #281a1e;
}

.form-control-sattva,
.form-select-sattva {
    width: 100%;
    height: 46px;
    border: 1px solid #eadcdc;
    border-radius: 14px;
    background: #fff;
    padding: 0 14px;
    font-size: 14px;
    color: #24151a;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.form-control-sattva:focus,
.form-select-sattva:focus,
.form-control:focus,
.form-select:focus {
    border-color: #f1a8a8;
    box-shadow: 0 0 0 4px rgba(224, 0, 0, 0.08);
    outline: none;
}

.form-text-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0 18px;
    font-size: 14px;
}

.remember-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
}

.auth-link {
    color: var(--red-800);
    font-weight: 600;
}

.btn-sattva {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 14px;
    height: 46px;
    padding: 0 18px;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-sattva-primary {
    width: 100%;
    color: #fff;
    background: linear-gradient(90deg, var(--red-500), var(--red-400));
    box-shadow: 0 10px 18px rgba(224, 0, 0, 0.18);
}

.btn-sattva-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
}

.btn-blue {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #ffffff;
}

.btn-blue:hover,
.btn-blue:focus {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    color: #ffffff;
}

.auth-footer {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin-top: 18px;
}

.validation-summary-errors,
.field-validation-error,
.text-danger {
    color: #c00000 !important;
    font-size: 13px;
    margin-top: 6px;
}

/* ===========================
   ADMIN LAYOUT
=========================== */

.admin-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px 1fr;
    background: #f7f7fb;
}

.admin-sidebar {
    background: var(--sidebar-grad);
    color: #fff;
    padding: 22px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    box-sizing: border-box;
}

.admin-sidebar .eyebrow {
    font-size: 12px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.7);
    margin-bottom: 10px;
}

.admin-brand {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 34px;
    color: #fff;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
}

.site-brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    object-fit: cover;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    flex-shrink: 0;
}

.site-brand-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav a {
    color: rgba(255,255,255,0.92);
    padding: 14px 12px;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

/* Grouped menu styles */
.sidebar-nav .menu-group {
    display: flex;
    flex-direction: column;
}

.sidebar-nav .group-title {
    color: rgba(255,255,255,0.55);
    padding: 12px 12px 6px 12px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 2px;
    margin-top: 18px;
}

.sidebar-nav .group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-nav .group-header .group-title {
    margin: 0;
    padding: 0;
}

.sidebar-nav .group-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 6px;
    margin-top: 6px;
}

.sidebar-nav .group-links a {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 15px;
}

/* Collapse/expand toggle button */
.sidebar-nav .group-toggle {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.92);
    padding: 10px 12px;
    font-weight: 700;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-radius: 10px;
}

.sidebar-nav .group-toggle:hover {
    background: rgba(255,255,255,0.04);
}

.sidebar-nav .toggle-icon {
    transition: transform 0.18s ease;
    font-size: 12px;
    opacity: 0.9;
}

.menu-group.collapsed .group-links {
    display: none;
}

.menu-group.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.admin-main {
    background: #f6f7fb;
    min-width: 0;
}

.admin-topbar {
    height: 92px;
    background: rgba(255,255,255,0.92);
    border-bottom: 1px solid #f1e6e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(10px);
}

.topbar-left .eyebrow {
    font-size: 12px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--red-800);
    font-weight: 700;
    margin-bottom: 6px;
}

.topbar-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-pill {
    padding: 10px 18px;
    border-radius: 999px;
    background: #fff0f0;
    color: var(--red-900);
    font-weight: 600;
    border: 1px solid #f4d9d9;
}

.btn-pill {
    border: none;
    border-radius: 14px;
    padding: 11px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-pill-primary {
    background: linear-gradient(90deg, var(--red-500), var(--red-400));
    color: #fff;
    box-shadow: 0 8px 18px rgba(224,0,0,0.18);
}

.btn-pill-primary:hover {
    transform: translateY(-1px);
}

.btn-pill-secondary {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.06);
}

/* Sidebar icon + label layout */
.sidebar-nav a.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.92);
}

.sidebar-nav a.nav-link .icon {
    width: 34px;
    text-align: center;
    font-size: 18px;
    line-height: 1;
}

.sidebar-nav a.nav-link .label {
    display: inline-block;
}

/* Collapsed sidebar */
.admin-layout.sidebar-collapsed {
    grid-template-columns: 64px 1fr;
}
.admin-layout.sidebar-collapsed .admin-sidebar {
    width: 64px;
}

.admin-layout.sidebar-collapsed .sidebar-nav a.nav-link {
    justify-content: center;
}

.admin-layout.sidebar-collapsed .sidebar-nav a.nav-link .label {
    display: none;
}

.admin-layout.sidebar-collapsed .group-toggle .toggle-icon {
    display: none;
}

.admin-content {
    padding: 28px;
}

.section-card {
    background: #fff;
    border: 1px solid #f2e7e7;
    border-radius: 26px;
    box-shadow: var(--shadow-soft);
    padding: 24px;
}

.section-card + .section-card {
    margin-top: 22px;
}

.section-eyebrow {
    font-size: 12px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--red-800);
    font-weight: 700;
    margin-bottom: 8px;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px;
}

.section-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.kpi-card {
    background: #fff;
    border: 1px solid #f2e7e7;
    border-radius: 22px;
    padding: 22px;
    box-shadow: var(--shadow-soft);
}

.kpi-label {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 16px;
    font-weight: 500;
}

.kpi-value {
    font-size: 42px;
    font-weight: 800;
    color: #220f13;
    line-height: 1;
}

.kpi-accent {
    width: 56px;
    height: 5px;
    background: linear-gradient(90deg, var(--red-500), var(--red-400));
    border-radius: 999px;
    margin-top: 18px;
}

.page-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
}

.page-actions-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sattva-table-wrap {
    background: #fff;
    border: 1px solid #f3e6e6;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.sattva-table {
    width: 100%;
    border-collapse: collapse;
}

.sattva-table thead {
    background: #fff4f4;
}

.sattva-table th {
    text-align: left;
    padding: 16px 18px;
    font-size: 13px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--red-900);
    font-weight: 700;
}

.sattva-table td {
    padding: 18px;
    border-top: 1px solid #f4ecec;
    vertical-align: top;
}

.empty-state {
    text-align: center;
    padding: 42px 20px;
}

.empty-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-subtitle {
    color: var(--muted);
}

.status-badge {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.status-active {
    background: #ecf9f0;
    color: #228b48;
}

.status-inactive {
    background: #fff1f1;
    color: #b80000;
}

.action-links {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.action-links a,
.action-links button {
    color: var(--red-800);
    font-weight: 700;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.sattva-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.form-card {
    background: #fff;
    border: 1px solid #f1e6e6;
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    padding: 24px;
}

.form-actions {
    margin-top: 22px;
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-secondary-sattva {
    background: #f2eeee;
    color: #2c2225;
}

.btn-secondary-sattva:hover {
    background: #ece6e6;
}

.btn-max-400 {
    max-width: 400px;
    width: 100%;
}

/* ===========================
   EXAM / USER PAGES
=========================== */

.user-topbar {
    background: rgba(255,255,255,0.95);
    border-bottom: 1px solid #f0e6e6;
    height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 30;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 26px;
}

.user-brand {
    font-size: 20px;
    font-weight: 800;
    color: var(--red-700);
    letter-spacing: 1px;
}

.user-shell {
    min-height: 100vh;
    background: linear-gradient(180deg, #fff8f8 0%, #fff4f4 100%);
}

.hero-red {
    background: linear-gradient(135deg, #a50000 0%, #d60000 50%, #c40000 100%);
    color: #fff;
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.exam-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.exam-stat {
    background: #fffafa;
    border: 1px solid #f3e4e4;
    border-radius: 20px;
    padding: 18px 20px;
}

.exam-stat-label {
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--red-900);
    font-weight: 700;
    margin-bottom: 10px;
}

.exam-stat-value {
    font-size: 24px;
    font-weight: 700;
}

.question-card {
    background: #fff;
    border: 1px solid #f1e6e6;
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    padding: 22px;
}

.question-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.question-chip {
    background: #fff1f1;
    color: var(--red-900);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 700;
}

.option-list {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}

.option-item {
    border: 1px solid #f1e3e3;
    background: #fffafa;
    border-radius: 18px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.exam-actions {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-top: 22px;
}

.alert {
    border-radius: 16px !important;
    border: 1px solid #f1dddd !important;
}

/* ===========================
   RESPONSIVE
=========================== */

@media (max-width: 1100px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sattva-form-grid,
    .exam-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        height: auto;
        position: relative;
    }

    .admin-topbar {
        height: auto;
        padding: 18px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-actions {
        flex-direction: column;
        align-items: flex-start;
    }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.data-table th {
    background: #f5f5f5;
    text-align: left;
    padding: 12px;
    font-weight: 600;
}

.data-table td {
    padding: 12px;
    border-top: 1px solid #eee;
}

.btn-action {
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    margin-right: 5px;
}

.btn-action.blue { background: #3b82f6; color: white; }
.btn-action.green { background: #10b981; color: white; }
.btn-action.yellow { background: #f59e0b; color: white; }
.btn-action.red { background: #ef4444; color: white; }

