:root {
    --bg: #050713;
    --bg-elevated: #101322;
    --sidebar-bg: #070814;
    --sidebar-accent: #a855f7;
    --sidebar-accent-soft: rgba(168, 85, 247, 0.18);
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --border-soft: #1f2933;
    --radius-lg: 16px;
    --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.6);
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html, body {
    height: 100%;
    margin: 0;
    background: var(--bg) !important;
}

body {
    font-family: var(--font-main);
    color: var(--text-main);
}

body.app-body {
    background: var(--bg) !important;
}

.app-shell,
.main {
    background: var(--bg) !important;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* LAYOUT */

body.app-body {
    background: var(--bg);
    color: var(--text-main);
    font-family: var(--font-main);
}

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-right: 1px solid var(--border-soft);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo img {
    height: 40px;
}

.sidebar-logo span {
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 14px;
}

.nav-section {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 999px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

/* .nav-item.active {
    background: var(--sidebar-accent-soft);
    color: var(--text-main);
    position: relative;
} */

/* .nav-item.active::before {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 999px;
    border: 1px solid rgba(168, 85, 247, 0.7); 
    pointer-events: none;
} */


.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px 32px;
}

.topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.user-pill {
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
    font-size: 13px;
    color: var(--text-muted);
}

/* HEADER */

.content-header {
    margin-bottom: 20px;
}

.content-header h1 {
    font-size: 28px;
    letter-spacing: 0.04em;
    text-transform: none;
    margin-bottom: 4px;
}

.content-header p {
    font-size: 14px;
    color: var(--text-muted);
}

/* STATS ROW */

.cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-soft);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 26px;
    font-weight: 600;
}

.stat-subtext {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

.page-actions {
    display: flex;
    justify-content: flex-end;
}

/* BUTTONS */

.button-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    background: var(--sidebar-accent);
    color: #fdf2ff;
    border: 1px solid transparent;
    box-shadow: 0 14px 30px rgba(168, 85, 247, 0.6);
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

.button-primary:hover {
    background: #c084fc;
    transform: translateY(-1px);
    box-shadow: 0 18px 40px rgba(168, 85, 247, 0.7);
}

.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    background: transparent;
    color: #e5e7eb;
    border: 1px solid rgba(148, 163, 184, 0.5);
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

.button-secondary:hover {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.9);
    transform: translateY(-1px);
}

/* DASHBOARD ANALYTICS (cards under stats) */

.dashboard-section {
    margin-top: 8px;
}

.analytics-row {
    margin-top: 4px;
}

.analytics-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analytics-heading {
    font-size: 14px;
    font-weight: 600;
}

.analytics-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* Top scores list inside stat-card */

.top-scores-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.top-score-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
    font-size: 13px;
}

.top-score-rank {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--text-muted);
}

.top-score-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.top-score-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-score-quiz {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-score-metric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}

.top-score-metric strong {
    font-size: 13px;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-top: 4px;
}

.metric-label {
    color: var(--text-muted);
}

.metric-value {
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.empty-state-small {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* TABLES */

.table-card {
    margin-top: 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 16px 18px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 8px 8px;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
}

th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tbody tr:hover td {
    background: rgba(15, 23, 42, 0.7);
}

/* FORMS */

.form-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 20px 22px;
    max-width: 560px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #1f2933;
    background: #020617;
    color: #f9fafb;
    font-size: 14px;
}

.form-group textarea {
    min-height: 90px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--sidebar-accent);
    box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.6);
}

/* ERRORS */

.error-msg {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.4);
    color: #fecaca;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 12px;
}
