/* EduAstroBD UI - Bootstrap 5 base with a calm navy / teal brand. */
:root {
    --brand: #1d3c78;
    --brand-2: #0f9d8a;
    --accent: #f59e0b;
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --hover: #f1f4fa;
    --brand-soft: #e8eefb;
    --brand-ink: #1d3c78;
    --line: #e3e7ef;
    --text: #1f2937;
    --text-2: #374151;
    --muted: #6b7280;
    --icon: #64748b;
    --sidebar-w: 248px;
    --topbar-h: 56px;
    --bs-primary: #1d3c78;
    --bs-primary-rgb: 29, 60, 120;
    --bs-link-color: #1d3c78;
    --bs-link-color-rgb: 29, 60, 120;
}

body {
    font-family: "Inter", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
}

.bn, [lang="bn"] { font-family: "Hind Siliguri", "Inter", sans-serif; }

.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: #16305f; --bs-btn-hover-border-color: #16305f; --bs-btn-active-bg: #122851; }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); }
.text-accent { color: var(--brand-2); }
.text-bg-brand { background: var(--brand); color: #fff; }

/* ---------- App shell ---------- */
.topbar {
    position: sticky; top: 0; z-index: 1030;
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.topbar .brand { color: var(--brand-ink); font-size: 1.1rem; }
.topbar .org-name { max-width: 280px; }
.avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--brand); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 600;
}
.role-teacher .avatar { background: var(--brand-2); }
.role-student .avatar { background: #7c3aed; }
.role-super_admin .avatar { background: #b91c1c; }

.shell { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--line);
}
@media (min-width: 992px) {
    .sidebar { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; flex-shrink: 0; }
}
.content { flex: 1; min-width: 0; padding: 1.25rem; }
@media (min-width: 1200px) { .content { padding: 1.75rem 2rem; } }

.nav-menu { padding: .5rem 0 2rem; }
.nav-menu .nav-title {
    font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted); padding: 1rem 1.25rem .35rem;
}
.nav-menu a {
    display: flex; align-items: center; gap: .65rem;
    padding: .45rem 1.25rem; margin: 1px .5rem;
    border-radius: 8px; color: var(--text-2); text-decoration: none; font-size: .92rem;
}
.nav-menu a i { font-size: 1.05rem; color: var(--icon); }
.nav-menu a:hover { background: var(--hover); }
.nav-menu a.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav-menu a.active i { color: var(--brand-ink); }

/* ---------- Page pieces ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.page-head .sub { color: var(--muted); font-size: .9rem; }
.page-head .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

.card { --bs-card-bg: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.card-header { background: var(--surface); border-bottom: 1px solid var(--line); font-weight: 600; }

.stat { padding: 1rem 1.1rem; }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.55rem; font-weight: 700; color: var(--text); }
.stat .icon {
    width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
    background: var(--brand-soft); color: var(--brand-ink); font-size: 1.2rem;
}
.stat .icon.teal { background: #e0f5f1; color: var(--brand-2); }
.stat .icon.amber { background: #fef3c7; color: #b45309; }
.stat .icon.red { background: #fee2e2; color: #b91c1c; }

.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .55rem .65rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.table-card { overflow-x: auto; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty i { font-size: 2rem; display: block; margin-bottom: .5rem; color: var(--line); }

.form-label { font-weight: 500; font-size: .88rem; }
.req::after { content: " *"; color: #dc2626; }

.marks-input { width: 74px; text-align: right; }
.att-btn .btn { min-width: 38px; }

.badge-status { font-weight: 600; }
.status-SUBMITTED { background: #e0e7ff; color: #3730a3; }
.status-VERIFIED { background: #dbeafe; color: #1e40af; }
.status-SELECTED { background: #dcfce7; color: #166534; }
.status-ADMITTED { background: #bbf7d0; color: #14532d; }
.status-WAITING { background: #fef3c7; color: #92400e; }
.status-REJECTED { background: #fee2e2; color: #991b1b; }

.grade-F { color: #b91c1c; font-weight: 700; }
.grade-Aplus { color: #15803d; font-weight: 700; }

.lesson-body img { max-width: 100%; height: auto; }
.lesson-body table { border-collapse: collapse; }
.lesson-body td, .lesson-body th { border: 1px solid var(--line); padding: .35rem .5rem; }

/* ---------- Public pages ---------- */
.public { background: var(--surface); }
.public-nav { border-bottom: 1px solid var(--line); background: var(--surface); }
.public-nav .navbar-brand { color: var(--brand-ink); }
.hero {
    background: linear-gradient(135deg, #102a5c 0%, #1d3c78 55%, #0f9d8a 100%);
    color: #fff; padding: 4.5rem 0 4rem;
}
.hero h1 { font-weight: 800; font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.15; }
.hero .lead { color: #dbe4ff; }
.feature { padding: 1.25rem; border: 1px solid var(--line); border-radius: 14px; height: 100%; background: var(--surface); }
.feature i { font-size: 1.6rem; color: var(--brand-2); }
.price-card { border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem; height: 100%; background: var(--surface); }
.price-card.featured { border: 2px solid var(--brand-ink); box-shadow: 0 8px 24px rgba(29,60,120,.12); }
.price-card .price { font-size: 2rem; font-weight: 800; }
.public-footer { border-top: 1px solid var(--line); }
.auth-card { max-width: 420px; margin: 3rem auto; }
.wizard-step { border-left: 3px solid var(--brand); padding-left: 1rem; margin-bottom: 1.5rem; }
.wizard-step h2 { font-size: 1.05rem; font-weight: 700; }


/* ---------- Landing page ---------- */
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
.hero-lg { padding: 4.5rem 0 5rem; }
.hero-pill { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: .35rem .9rem; display: inline-block; font-size: .88rem; }
.hero-checks li { color: #dbe4ff; }
.hero-checks i { color: #fbbf24; margin-right: .35rem; }
.landing-mock { background: #fff; color: #1f2937; border-radius: 14px; overflow: hidden; border: 1px solid rgba(255,255,255,.3); font-size: .8rem; }
.landing-mock .mock-bar { display: flex; align-items: center; gap: 6px; padding: .55rem .8rem; background: #eef1f7; border-bottom: 1px solid #e3e7ef; }
.landing-mock .mock-bar > span { width: 10px; height: 10px; border-radius: 50%; background: #f87171; }
.landing-mock .mock-bar > span:nth-child(2) { background: #fbbf24; }
.landing-mock .mock-bar > span:nth-child(3) { background: #34d399; }
.landing-mock .mock-url { margin-left: .6rem; flex: 1; background: #fff; border-radius: 6px; padding: .1rem .6rem; color: #6b7280; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.landing-mock .mock-body { padding: .9rem; background: #f4f6fb; }
.landing-mock .mock-stat, .landing-mock .mock-card { background: #fff; border: 1px solid #e3e7ef; border-radius: 10px; padding: .6rem .7rem; }
.landing-mock .mock-stat .l { color: #6b7280; font-size: .66rem; text-transform: uppercase; letter-spacing: .04em; }
.landing-mock .mock-stat .v { font-size: 1.15rem; font-weight: 700; }
.landing-mock .mock-title { font-weight: 600; margin-bottom: .4rem; }
.landing-mock .mock-row { display: grid; grid-template-columns: 2.4rem 1fr 3rem 3rem 3rem; padding: .32rem 0; border-top: 1px solid #eef1f7; }
.landing-mock .mock-row.head { color: #6b7280; font-size: .66rem; text-transform: uppercase; border-top: 0; }
.landing-mock .small-card { font-size: .74rem; line-height: 1.45; }
.landing-mock .mock-muted { color: #6b7280; }
.key-facts .kf-value { font-size: 1.45rem; font-weight: 800; color: var(--brand-ink); }
.key-facts .kf-label { font-size: .82rem; color: var(--muted); }
.section-kicker { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-2); margin-bottom: .35rem; }
.section-title { font-weight: 800; font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: .6rem; }
.section-alt { background: var(--bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.type-tile { border: 1px solid var(--line); border-radius: 14px; padding: 1rem .5rem; background: var(--surface); height: 100%; }
.type-tile i { font-size: 1.6rem; color: var(--brand-ink); display: block; margin-bottom: .35rem; }
.type-tile div { font-weight: 600; }
.type-tile small { color: var(--muted); }
.feature h3 { font-weight: 700; }
.feature-list { list-style: none; padding-left: 0; margin-bottom: 0; font-size: .86rem; }
.feature-list li { position: relative; padding-left: 1.4rem; margin-bottom: .3rem; color: var(--text-2); }
.feature-list li::before { content: "\F26E"; font-family: "bootstrap-icons"; position: absolute; left: 0; top: 0; color: var(--brand-2); }
.step { position: relative; padding: 1.25rem; border: 1px solid var(--line); border-radius: 14px; height: 100%; background: var(--surface); }
.step-no { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-bottom: .75rem; }
.role-card { padding: 1.25rem; border: 1px solid var(--line); border-radius: 14px; height: 100%; background: var(--surface); }
.role-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; background: var(--brand-soft); color: var(--brand-ink); }
.role-icon.teal { background: #e0f5f1; color: #0f9d8a; }
.role-icon.amber { background: #fef3c7; color: #b45309; }
.role-icon.violet { background: #ede9fe; color: #6d28d9; }
.bd-point { display: flex; gap: .75rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; height: 100%; background: var(--surface); }
.bd-point > i { font-size: 1.4rem; color: var(--brand-2); }
.guardian-band { background: linear-gradient(120deg, #0f9d8a, #1d3c78); color: #fff; }
.info-panel { padding: 1.75rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.cta-band { padding: 3rem 1.5rem; border-radius: 20px; color: #fff; background: linear-gradient(135deg, #102a5c 0%, #1d3c78 55%, #0f9d8a 100%); }
.public-footer { background: var(--bg); }
.public-footer .footer-brand { color: var(--brand-ink); }
.accordion-button { font-weight: 600; }
[data-bs-theme="dark"] .role-icon.teal { background: #10403b; color: #4fd1bd; }
[data-bs-theme="dark"] .role-icon.amber { background: #3d2e0b; color: #fbbf24; }
[data-bs-theme="dark"] .role-icon.violet { background: #2e1f5c; color: #c4b5fd; }
[data-bs-theme="dark"] .guardian-band { background: linear-gradient(120deg, #0b6d60, #142b57); }
[data-bs-theme="dark"] .cta-band { background: linear-gradient(135deg, #0a1733 0%, #142b57 55%, #0b6d60 100%); }
[data-bs-theme="dark"] .accordion { --bs-accordion-bg: var(--surface); --bs-accordion-border-color: var(--line); --bs-accordion-active-bg: #1f3366; --bs-accordion-active-color: #dbe4ff; }

/* ---------- Rich text (editor + rendered content) ---------- */
.lesson-body { overflow-wrap: anywhere; }
.lesson-body > :last-child { margin-bottom: 0; }
.lesson-body blockquote { border-left: 3px solid var(--line); padding-left: .75rem; color: var(--muted); }
.lesson-body pre, .lesson-body .ql-code-block-container { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; white-space: pre-wrap; }
.lesson-body .ql-align-center { text-align: center; }
.lesson-body .ql-align-right { text-align: right; }
.lesson-body .ql-align-justify { text-align: justify; }
.lesson-body .ql-indent-1 { padding-left: 2em; }
.lesson-body .ql-indent-2 { padding-left: 4em; }
.lesson-body .ql-indent-3 { padding-left: 6em; }
.lesson-body li[data-list="bullet"] { list-style-type: disc; }
.lesson-body ol:has(> li[data-list="bullet"]) { padding-left: 1.5rem; }
.rich-inline { display: inline-block; vertical-align: top; }
.rich-inline > p { margin-bottom: .2rem; }

.rte { border-radius: 8px; background: var(--surface); }
.rte .ql-toolbar.ql-snow { border-color: var(--line); border-radius: 8px 8px 0 0; background: var(--surface-2); }
.rte .ql-container.ql-snow { border-color: var(--line); border-radius: 0 0 8px 8px; font-family: inherit; font-size: .95rem; }
.rte .ql-editor { min-height: inherit; color: var(--text); }
.rte .ql-editor.ql-blank::before { color: var(--muted); font-style: normal; }
.rte.is-invalid .ql-container.ql-snow, .rte.is-invalid .ql-toolbar.ql-snow { border-color: #dc3545; }
.rte > div:last-child { min-height: inherit; }

/* ---------- Theme toggle / install ---------- */
.theme-toggle { width: 34px; height: 31px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }

/* =====================================================================================
 * Dark mode: Bootstrap 5.3 handles its own components through data-bs-theme="dark";
 * these rules re-colour the app's own pieces.
 * ===================================================================================== */
[data-bs-theme="dark"] {
    color-scheme: dark;
    --bg: #0d1424;
    --surface: #151e33;
    --surface-2: #1a2540;
    --hover: #1e2a47;
    --brand-soft: #1f3366;
    --brand-ink: #8fb0ff;
    --line: #26314a;
    --text: #e5e9f2;
    --text-2: #cfd6e4;
    --muted: #9aa4b8;
    --icon: #8b97ad;
    --bs-body-bg: #0d1424;
    --bs-body-color: #e5e9f2;
    --bs-secondary-bg: #151e33;
    --bs-tertiary-bg: #1a2540;
    --bs-border-color: #26314a;
    --bs-link-color: #8fb0ff;
    --bs-link-color-rgb: 143, 176, 255;
    --bs-link-hover-color: #b5ccff;
    --bs-link-hover-color-rgb: 181, 204, 255;
    --bs-primary-text-emphasis: #b5ccff;
    --bs-primary-bg-subtle: #1f3366;
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-bg: #2f5bb3; --bs-btn-border-color: #2f5bb3; --bs-btn-hover-bg: #3a6ad0; --bs-btn-hover-border-color: #3a6ad0; --bs-btn-active-bg: #284f9d; --bs-btn-disabled-bg: #2f5bb3; --bs-btn-disabled-border-color: #2f5bb3; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #8fb0ff; --bs-btn-border-color: #4a6fbd; --bs-btn-hover-bg: #2f5bb3; --bs-btn-hover-border-color: #2f5bb3; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #284f9d; }
[data-bs-theme="dark"] .btn-light { --bs-btn-bg: #1e2a47; --bs-btn-border-color: #2b3958; --bs-btn-color: #e5e9f2; --bs-btn-hover-bg: #26345a; --bs-btn-hover-border-color: #33446c; --bs-btn-hover-color: #fff; --bs-btn-active-bg: #2b3a62; --bs-btn-active-color: #fff; }
[data-bs-theme="dark"] .btn-outline-dark { --bs-btn-color: #e5e9f2; --bs-btn-border-color: #5b6880; --bs-btn-hover-bg: #e5e9f2; --bs-btn-hover-color: #0d1424; --bs-btn-hover-border-color: #e5e9f2; }
[data-bs-theme="dark"] .text-bg-light { background-color: #1e2a47 !important; color: #dbe3f2 !important; }
[data-bs-theme="dark"] .text-muted { color: var(--muted) !important; }
[data-bs-theme="dark"] .card { box-shadow: none; }
[data-bs-theme="dark"] .table { --bs-table-color: var(--text); --bs-table-border-color: var(--line); --bs-table-hover-bg: rgba(255,255,255,.035); --bs-table-striped-bg: rgba(255,255,255,.025); }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { background-color: #10192d; border-color: #2b3958; }
[data-bs-theme="dark"] .form-control:disabled, [data-bs-theme="dark"] .form-control[readonly] { background-color: #1a2540; }
[data-bs-theme="dark"] .form-control:focus, [data-bs-theme="dark"] .form-select:focus { border-color: #4a6fbd; box-shadow: 0 0 0 .2rem rgba(74,111,189,.25); }
[data-bs-theme="dark"] .dropdown-menu { --bs-dropdown-bg: #18223a; --bs-dropdown-border-color: #2b3958; --bs-dropdown-link-hover-bg: #22305a; }
[data-bs-theme="dark"] .list-group { --bs-list-group-bg: var(--surface); --bs-list-group-border-color: var(--line); }
[data-bs-theme="dark"] .offcanvas { --bs-offcanvas-bg: var(--surface); }
[data-bs-theme="dark"] .text-accent { color: #33c7b2; }
[data-bs-theme="dark"] .stat .icon.teal { background: #10403b; color: #4fd1bd; }
[data-bs-theme="dark"] .stat .icon.amber { background: #3d2e0b; color: #fbbf24; }
[data-bs-theme="dark"] .stat .icon.red { background: #431717; color: #f87171; }
[data-bs-theme="dark"] .status-SUBMITTED { background: #262a5c; color: #c7d2fe; }
[data-bs-theme="dark"] .status-VERIFIED { background: #1c3260; color: #bfdbfe; }
[data-bs-theme="dark"] .status-SELECTED { background: #12402a; color: #bbf7d0; }
[data-bs-theme="dark"] .status-ADMITTED { background: #14532d; color: #dcfce7; }
[data-bs-theme="dark"] .status-WAITING { background: #45330c; color: #fde68a; }
[data-bs-theme="dark"] .status-REJECTED { background: #4c1717; color: #fecaca; }
[data-bs-theme="dark"] .grade-F { color: #f87171; }
[data-bs-theme="dark"] .grade-Aplus { color: #4ade80; }
[data-bs-theme="dark"] .alert-warning { --bs-alert-bg: #3a2e0e; --bs-alert-border-color: #5c4914; --bs-alert-color: #fde68a; }
[data-bs-theme="dark"] .alert-info { --bs-alert-bg: #0f2f3f; --bs-alert-border-color: #164b63; --bs-alert-color: #bae6fd; }
[data-bs-theme="dark"] .alert-success { --bs-alert-bg: #0f3324; --bs-alert-border-color: #175238; --bs-alert-color: #bbf7d0; }
[data-bs-theme="dark"] .alert-danger { --bs-alert-bg: #3b1316; --bs-alert-border-color: #5f1d22; --bs-alert-color: #fecaca; }
[data-bs-theme="dark"] .hero { background: linear-gradient(135deg, #0a1733 0%, #142b57 55%, #0b6d60 100%); }
[data-bs-theme="dark"] .rte .ql-snow .ql-stroke { stroke: #cfd6e4; }
[data-bs-theme="dark"] .rte .ql-snow .ql-fill, [data-bs-theme="dark"] .rte .ql-snow .ql-stroke.ql-fill { fill: #cfd6e4; }
[data-bs-theme="dark"] .rte .ql-snow .ql-picker { color: #cfd6e4; }
[data-bs-theme="dark"] .rte .ql-snow .ql-picker-options { background: #18223a; border-color: #2b3958; }
[data-bs-theme="dark"] .rte .ql-snow.ql-toolbar button:hover .ql-stroke,
[data-bs-theme="dark"] .rte .ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: #8fb0ff; }
[data-bs-theme="dark"] .rte .ql-snow.ql-toolbar button:hover .ql-fill,
[data-bs-theme="dark"] .rte .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: #8fb0ff; }
[data-bs-theme="dark"] .rte .ql-snow .ql-tooltip { background: #18223a; border-color: #2b3958; color: var(--text); box-shadow: none; }
[data-bs-theme="dark"] .rte .ql-snow .ql-tooltip input[type=text] { background: #10192d; border-color: #2b3958; color: var(--text); }
[data-bs-theme="dark"] .landing-mock, [data-bs-theme="dark"] .landing-mock .mock-row { border-color: #2b3958; }
@media (prefers-reduced-motion: no-preference) {
    body, .topbar, .sidebar, .card { transition: background-color .2s ease, border-color .2s ease; }
}
.card-footer.bg-body, .card-header.bg-body { background-color: var(--surface) !important; }
