:root {
    --bg: #f6f8fc;
    --surface: #ffffff;
    --surface-2: #eef3ff;
    --text: #172033;
    --muted: #6b7280;
    --line: #dbe3ef;
    --green: #36b37e;
    --blue: #2f80ed;
    --yellow: #f7b731;
    --coral: #ff6b6b;
    --violet: #6c5ce7;
    --shadow: 0 18px 45px rgba(35, 47, 75, 0.12);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 16% 10%, rgba(47, 128, 237, 0.13), transparent 26%),
        radial-gradient(circle at 90% 8%, rgba(54, 179, 126, 0.13), transparent 24%),
        var(--bg);
    letter-spacing: 0;
}

a {
    text-decoration: none;
}

img {
    max-width: 100%;
}

.dark-mode {
    --bg: #111827;
    --surface: #182235;
    --surface-2: #243149;
    --text: #f7fafc;
    --muted: #b7c2d3;
    --line: #2e3b53;
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

.auth-body {
    min-height: 100vh;
}

.auth-shell {
    width: min(1120px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.75fr);
    gap: 28px;
    align-items: center;
    padding: 28px 0;
}

.auth-visual,
.auth-card,
.panel,
.stat-card,
.learning-card,
.admin-card,
.quiz-card {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(219, 227, 239, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.dark-mode .auth-visual,
.dark-mode .auth-card,
.dark-mode .panel,
.dark-mode .stat-card,
.dark-mode .learning-card,
.dark-mode .admin-card,
.dark-mode .quiz-card {
    background: rgba(24, 34, 53, 0.92);
}

.auth-visual {
    min-height: 620px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    position: relative;
}

.brand-lockup,
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    font-weight: 900;
}

.brand-lockup img,
.sidebar-brand img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.brand-lockup small {
    display: block;
    color: var(--muted);
    font-weight: 600;
}

.mascot-panel {
    position: relative;
    padding: 32px;
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(54, 179, 126, 0.96), rgba(47, 128, 237, 0.92)),
        url("../assets/img/dreamina-2026-07-13-9973-The\ cute\ ant\ head\ blinks\ its\ big\ eyes\ an...gif") center/cover;
    color: #fff;
    overflow: hidden;
}

.mascot-panel h1 {
    max-width: 560px;
    font-size: 4rem;
    line-height: 1.02;
    margin-bottom: 18px;
    font-weight: 900;
}

.mascot-panel p {
    max-width: 520px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 1.05rem;
}

.mini-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.mini-stats span,
.xp-pill,
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    color: inherit;
    font-weight: 800;
}

.auth-card {
    padding: 28px;
}

.fw-black {
    font-weight: 900;
}

.form-control,
.form-select {
    border-radius: var(--radius);
    border-color: var(--line);
    padding: 0.78rem 0.9rem;
}




.btn {
    border-radius: var(--radius);
    font-weight: 800;
}

.btn-primary {
    background: linear-gradient(135deg, var(--green), var(--blue));
    border: 0;
}

.btn-warning {
    background: var(--yellow);
    border: 0;
    color: #1f2937;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 50;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-nav a,
.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    padding: 11px 12px;
    border-radius: var(--radius);
    font-weight: 800;
}

.sidebar-nav a:hover,
.sidebar-nav a.active,
.sidebar-logout:hover {
    color: var(--text);
    background: var(--surface-2);
}

.sidebar-nav a.active {
    box-shadow: inset 4px 0 0 var(--green);
}

.sidebar-logout {
    margin-top: auto;
}

.content-shell {
    min-width: 0;
}

.topbar {
    min-height: 92px;
    padding: 20px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(246, 248, 252, 0.84);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.dark-mode .topbar {
    background: rgba(17, 24, 39, 0.84);
}

.topbar h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 900;
}

.eyebrow {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius);
    display: inline-grid;
    place-items: center;
}

.notif-wrap {
    position: relative;
}

.notif-dot {
    position: absolute;
    top: -5px;
    right: -6px;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    background: var(--coral);
    color: #fff;
    font-size: 0.72rem;
    display: grid;
    place-items: center;
    z-index: 2;
}

.notif-dropdown {
    position: absolute;
    right: 0;
    top: 52px;
    width: min(360px, calc(100vw - 40px));
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: none;
    z-index: 200;
}

.notif-dropdown.open {
    display: block;
}

.notif-dropdown-head {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--line);
}

.notif-dropdown-body {
    max-height: 300px;
    overflow: auto;
    padding: 10px;
}

.notif-item {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    color: inherit;
}

.notif-item:hover {
    background: var(--surface-2);
    border-color: rgba(47, 128, 237, 0.18);
    text-decoration: none;
}

.notif-item-left {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: rgba(247, 183, 49, 0.18);
    color: var(--text);
    font-weight: 900;
}

.notif-item-title {
    font-weight: 900;
    line-height: 1.2;
}

.notif-item-title span {
    margin-left: 6px;
    font-size: 0.68rem;
    color: var(--blue);
}

.notif-item-title.is-read {
    opacity: 0.75;
    font-weight: 800;
}

.notif-item-message {
    color: var(--muted);
    font-size: 0.92rem;
    margin-top: 3px;
}

.notif-item-time {
    color: var(--muted);
    font-size: 0.78rem;
    margin-top: 6px;
}

.notif-empty {
    padding: 16px 6px;
    text-align: center;
    font-weight: 800;
}

.notif-loading {
    padding: 16px 6px;
    text-align: center;
    font-weight: 800;
}

.notif-dropdown-foot {
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    background: rgba(238, 243, 255, 0.5);
}

.dark-mode .notif-dropdown-foot {
    background: rgba(36, 49, 73, 0.55);
}

.notification-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(219, 227, 239, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.dark-mode .notification-card {
    background: rgba(24, 34, 53, 0.92);
}

.notification-card:hover {
    color: var(--text);
    border-color: rgba(47, 128, 237, 0.35);
    transform: translateY(-2px);
}

.notification-card.unread {
    border-color: rgba(47, 128, 237, 0.45);
}

.notification-body {
    flex: 1;
    min-width: 0;
}


.user-pill {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 6px 10px 6px 6px;
    max-width: 520px;
}





.user-pill span {
    width: 28px;
    height: 28px;

    border-radius: 50%;
    background: linear-gradient(135deg, var(--yellow), var(--coral));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 900;
}

.app-main {
    padding: 28px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.stat-card,
.panel,
.learning-card,
.admin-card,
.quiz-card {
    padding: 18px;
}

.stat-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.4rem;
}

.bg-green { background: var(--green); }
.bg-blue { background: var(--blue); }
.bg-yellow { background: var(--yellow); color: #1f2937; }
.bg-coral { background: var(--coral); }
.bg-violet { background: var(--violet); }

.stat-card p,
.learning-card p,
.admin-card p {
    color: var(--muted);
    margin-bottom: 4px;
}

.stat-card h2 {
    margin: 0;
    font-weight: 900;
}

.progress {
    height: 12px;
    border-radius: 999px;
    background: var(--surface-2);
}

.progress-bar {
    background: linear-gradient(90deg, var(--green), var(--blue));
}

.learning-card {
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.learning-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 50px rgba(35, 47, 75, 0.16);
}

.subject-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: var(--radius);
    color: #fff;
    font-size: 1.25rem;
}

.table {
    color: var(--text);
}

.table > :not(caption) > * > * {
    background: transparent;
    border-bottom-color: var(--line);
}

.badge-soft {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--line);
}

.rich-editor-source {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.rich-editor {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}

.rich-editor-toolbar button,
.rich-editor-select {
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-weight: 800;
}

.rich-editor-toolbar button {
    width: 36px;
    display: inline-grid;
    place-items: center;
}

.rich-editor-toolbar button:hover,
.rich-editor-select:hover {
    border-color: var(--blue);
}

.rich-editor-select {
    width: 130px;
    padding: 0 8px;
}

.rich-editor-separator {
    width: 1px;
    height: 24px;
    background: var(--line);
    margin: 0 3px;
}

.rich-editor-canvas {
    min-height: 150px;
    padding: 12px 14px;
    outline: 0;
    color: var(--text);
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.rich-editor-canvas:empty::before {
    content: attr(data-placeholder);
    color: var(--muted);
}

.rich-editor-canvas h2,
.rich-editor-canvas h3,
.rich-editor-canvas h4,
.rich-content h2,
.rich-content h3,
.rich-content h4 {
    font-weight: 900;
    margin: 0.6rem 0 0.45rem;
}

.rich-editor-canvas p,
.rich-content p {
    margin-bottom: 0.65rem;
}

.rich-content {
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.rich-content > :last-child {
    margin-bottom: 0;
}

.quiz-question {
    font-size: 1.15rem;
    font-weight: 700;
}

.report-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
}

.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.report-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.report-mini-stat {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    background: rgba(255, 255, 255, 0.5);
}

.dark-mode .report-mini-stat {
    background: rgba(36, 49, 73, 0.5);
}

.report-mini-stat span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.report-mini-stat strong {
    display: block;
    margin-top: 4px;
    font-size: 1.5rem;
    line-height: 1;
}

.score-pill {
    display: inline-flex;
    min-width: 46px;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: rgba(47, 128, 237, 0.12);
    color: var(--text);
    font-weight: 900;
}

.table-clean th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.chapter-lock {
    opacity: 0.55;
    filter: grayscale(0.4);
}

.quiz-step {
    display: none;
    animation: popIn 0.22s ease;
}

.quiz-step.active {
    display: block;
}

.option-tile {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius);
    padding: 12px;
    cursor: pointer;
    transition: transform 0.16s ease, border 0.16s ease;
}

.option-tile:hover {
    transform: translateY(-2px);
    border-color: var(--blue);
}

.option-tile input {
    margin-right: 8px;
}

.answer-correct {
    animation: correctPulse 0.45s ease;
}

.answer-wrong {
    animation: wrongShake 0.38s ease;
}

@keyframes popIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes correctPulse {
    0% { box-shadow: 0 0 0 0 rgba(54, 179, 126, 0.45); }
    100% { box-shadow: 0 0 0 18px rgba(54, 179, 126, 0); }
}

@keyframes wrongShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .mascot-panel h1 {
        font-size: 3.2rem;
    }
}

@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
        padding: 18px 0;
    }

    .auth-visual {
        min-height: 0;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -290px;
        width: 270px;
        transition: left 0.2s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .topbar {
        align-items: flex-start;
        padding: 16px;
    }

    .topbar h1 {
        font-size: 1.45rem;
    }

    .topbar-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .app-main {
        padding: 16px;
    }
}

@media (max-width: 640px) {
    .grid-4,
    .grid-3,
    .grid-2,
    .report-stat-grid,
    .report-hero {
        grid-template-columns: 1fr;
    }

    .report-actions {
        justify-content: stretch;
    }

    .report-actions .btn {
        width: 100%;
    }

    .auth-card,
    .auth-visual,
    .panel,
    .stat-card,
    .learning-card,
    .admin-card,
    .quiz-card {
        padding: 16px;
    }

    .user-pill strong {
        display: none;
    }

    .mascot-panel h1 {
        font-size: 2.1rem;
    }
}
