/*!
 * Anesthesiaboard LMS — front-end + admin stylesheet (build-free).
 * This is plain CSS, no Tailwind compilation required. Drop the plugin
 * into wp-content/plugins/ and it works as-is.
 */

[x-cloak] { display: none !important; }

:root {
	--aelms-primary: #0f5fb6;
	--aelms-primary-dark: #0a4a8f;
	--aelms-accent: #06b6d4;
	--aelms-danger: #dc2626;
	--aelms-success: #16a34a;
	--aelms-warning: #f59e0b;
	--aelms-ink: #0f172a;
	--aelms-muted: #64748b;
	--aelms-surface: #f8fafc;
	--aelms-border: #e2e8f0;

	/* Shell tokens */
	--aelms-shell-bg: #f4f6fb;
	--aelms-shell-surface: #ffffff;
	--aelms-shell-sidebar-bg: #ffffff;
	--aelms-shell-header-bg: #ffffff;
	--aelms-shell-border: #e6ebf4;
	--aelms-shell-shadow: 0 1px 0 rgba(15,23,42,0.05);
	--aelms-shell-shadow-soft: 0 6px 24px rgba(15,23,42,0.06);
	--aelms-shell-header-h: 64px;
	--aelms-shell-sidebar-w: 264px;
}

/* ============================================================
 * Theme-independent student shell (WordPress page templates)
 * ============================================================ */

html.aelms-html,
body.aelms-student-shell {
	margin: 0 !important;
	padding: 0 !important;
	background: var(--aelms-shell-bg);
	color: var(--aelms-ink);
	font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
}

/* The root wrapper now just hosts the shell grid; no width clamp. */
.aelms-student-root {
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	max-width: none;
	box-sizing: border-box;
}

/* ============================================================
 * STUDENT SHELL: fixed header + sticky sidebar + scrollable main
 * ============================================================ */

.aelms-shell {
	display: grid;
	grid-template-columns: var(--aelms-shell-sidebar-w) 1fr;
	grid-template-rows: var(--aelms-shell-header-h) 1fr;
	height: 100vh;
	height: 100dvh;
	width: 100%;
	background: var(--aelms-shell-bg);
	color: var(--aelms-ink);
}

.aelms-shell-header {
	grid-column: 1 / -1;
	grid-row: 1;
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 20px;
	background: var(--aelms-shell-header-bg);
	border-bottom: 1px solid var(--aelms-shell-border);
	box-shadow: var(--aelms-shell-shadow);
	z-index: 30;
}
.aelms-shell-brand {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-width: calc(var(--aelms-shell-sidebar-w) - 20px);
	font-weight: 800;
	font-size: 16px;
	color: var(--aelms-ink);
	text-decoration: none;
}
.aelms-shell-brand-mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px; height: 32px;
	border-radius: 10px;
	background: linear-gradient(135deg, var(--aelms-primary), var(--aelms-accent));
	color: #fff;
	font-weight: 800;
	font-size: 14px;
	flex-shrink: 0;
}
.aelms-shell-brand-text { font-weight: 800; letter-spacing: -0.01em; }

.aelms-shell-exam-switch {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	flex-shrink: 1;
	max-width: min(380px, 46vw);
}
.aelms-shell-home-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 10px;
	border: 1px solid var(--aelms-shell-border);
	background: var(--aelms-shell-surface);
	cursor: pointer;
	color: var(--aelms-ink);
	font-size: 18px;
	line-height: 1;
	flex-shrink: 0;
}
.aelms-shell-home-btn:hover { background: var(--aelms-shell-bg); }
.aelms-shell-exam-select {
	flex: 1;
	min-width: 120px;
	width: 100%;
	max-width: 100%;
	height: 38px;
	padding: 0 28px 0 10px;
	border-radius: 10px;
	border: 1px solid var(--aelms-shell-border);
	background: var(--aelms-shell-surface);
	font-family: inherit;
	font-weight: 700;
	font-size: 14px;
	color: var(--aelms-ink);
	cursor: pointer;
}
.aelms-shell-exam-select:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(15,95,182,0.18);
}
.aelms-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.aelms-shell-search {
	flex: 1;
	max-width: 520px;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 0 12px;
	height: 38px;
	border-radius: 10px;
	background: var(--aelms-shell-bg);
	border: 1px solid var(--aelms-shell-border);
	color: var(--aelms-muted);
	font-size: 13px;
}
.aelms-shell-search input {
	flex: 1;
	background: transparent;
	border: none;
	outline: none;
	color: var(--aelms-ink);
	font: inherit;
	min-width: 0;
}
.aelms-shell-search-icon { opacity: 0.6; }

.aelms-shell-actions {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	gap: 10px;
}
.aelms-shell-langselect {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--aelms-muted);
}
.aelms-shell-langselect select {
	height: 36px;
	padding: 0 26px 0 10px;
	border-radius: 8px;
	border: 1px solid var(--aelms-shell-border);
	background: var(--aelms-shell-surface);
	font: inherit;
	color: var(--aelms-ink);
}

.aelms-shell-user {
	position: relative;
}
.aelms-shell-user-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 4px 10px 4px 4px;
	height: 40px;
	background: transparent;
	border: 1px solid transparent;
	border-radius: 999px;
	cursor: pointer;
	color: var(--aelms-ink);
	font: inherit;
	font-weight: 600;
}
.aelms-shell-user-btn:hover { background: var(--aelms-shell-bg); border-color: var(--aelms-shell-border); }
.aelms-shell-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px; height: 32px;
	border-radius: 50%;
	background: linear-gradient(135deg, #1e88e5, #4dd0e1);
	color: #fff;
	font-weight: 700;
	font-size: 13px;
}
.aelms-shell-user-name {
	font-size: 13px;
	max-width: 140px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.aelms-shell-user-menu {
	position: absolute;
	right: 0; top: calc(100% + 8px);
	min-width: 220px;
	background: var(--aelms-shell-surface);
	border: 1px solid var(--aelms-shell-border);
	border-radius: 12px;
	box-shadow: var(--aelms-shell-shadow-soft);
	padding: 6px;
	z-index: 50;
}
.aelms-shell-user-menu a,
.aelms-shell-user-menu button {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 9px 12px;
	border: none;
	background: transparent;
	color: var(--aelms-ink);
	text-decoration: none;
	border-radius: 8px;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	text-align: left;
}
.aelms-shell-user-menu a:hover,
.aelms-shell-user-menu button:hover { background: var(--aelms-shell-bg); }

.aelms-shell-hamburger {
	display: none;
	width: 40px; height: 40px;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 1px solid var(--aelms-shell-border);
	border-radius: 10px;
	color: var(--aelms-ink);
	cursor: pointer;
	font-size: 18px;
}

/* Sidebar */
.aelms-shell-sidebar {
	grid-column: 1;
	grid-row: 2;
	background: var(--aelms-shell-sidebar-bg);
	border-right: 1px solid var(--aelms-shell-border);
	overflow-y: auto;
	padding: 14px 12px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-height: 0;
}
.aelms-nav-section-label {
	font-size: 10px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--aelms-muted);
	padding: 14px 12px 6px;
}
.aelms-nav-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0 12px;
	height: 42px;
	border-radius: 10px;
	color: var(--aelms-ink);
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	background: transparent;
	border: none;
	cursor: pointer;
	font-family: inherit;
	text-align: left;
	width: 100%;
}
.aelms-nav-item:hover { background: var(--aelms-shell-bg); }
.aelms-nav-item.is-active {
	background: rgba(15,95,182,0.08);
	color: var(--aelms-primary);
	font-weight: 700;
}
.aelms-nav-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px; height: 22px;
	flex-shrink: 0;
	color: currentColor;
}
.aelms-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aelms-nav-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--aelms-warning);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
}

.aelms-shell-sidebar-spacer { flex: 1; }
.aelms-shell-sidebar-footer {
	padding: 10px 12px;
	border-top: 1px solid var(--aelms-shell-border);
	font-size: 11px;
	color: var(--aelms-muted);
}

/* Main scroll surface */
.aelms-shell-main {
	grid-column: 2;
	grid-row: 2;
	overflow-y: auto;
	overflow-x: hidden;
	min-height: 0;
	padding: 28px 32px 48px;
	background: var(--aelms-shell-bg);
}
.aelms-shell-main > * { max-width: 1280px; margin-left: auto; margin-right: auto; }
.aelms-shell-main.is-runner {
	padding: 0;
	display: flex;
	flex-direction: column;
}
.aelms-shell-main.is-runner > * {
	max-width: none;
	flex: 1 1 auto;
	min-height: 0;
}

/* Mobile drawer backdrop */
.aelms-shell-backdrop {
	position: fixed;
	inset: var(--aelms-shell-header-h) 0 0 0;
	background: rgba(15,23,42,0.4);
	z-index: 25;
}

/* Responsive */
@media (max-width: 900px) {
	.aelms-shell {
		grid-template-columns: 1fr;
	}
	.aelms-shell-sidebar {
		position: fixed;
		top: var(--aelms-shell-header-h);
		bottom: 0;
		left: 0;
		width: 280px;
		transform: translateX(-100%);
		transition: transform 0.18s ease-out;
		z-index: 26;
		box-shadow: var(--aelms-shell-shadow-soft);
	}
	.aelms-shell-sidebar.is-open { transform: translateX(0); }
	.aelms-shell-main { grid-column: 1; padding: 18px 16px 32px; }
	.aelms-shell-exam-switch { max-width: none; flex: 1; min-width: 0; }
	.aelms-shell-home-btn { width: 34px; height: 34px; font-size: 16px; }
	.aelms-shell-exam-select { font-size: 13px; height: 34px; min-width: 0; }
	.aelms-shell-search { display: none; }
	.aelms-shell-hamburger { display: inline-flex; }
	.aelms-shell-user-name { display: none; }
}

@media (max-width: 480px) {
	.aelms-shell-header { padding: 0 12px; gap: 8px; }
	.aelms-shell-actions { gap: 6px; }
	.aelms-shell-langselect { font-size: 12px; }
	.aelms-shell-langselect select { height: 32px; }
	.aelms-shell-main { padding: 14px 12px 28px; }
	.aelms-page-header h1 { font-size: 22px; }
	.aelms-card { padding: 16px; border-radius: 14px; }
}

/* Legacy SPA chrome (deprecated by shell, kept for any third-party embeds) */
.aelms-app-nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem 1rem;
	margin-bottom: 1rem;
	padding: 0.65rem 1rem;
}
.aelms-app-nav-sep { opacity: 0.35; user-select: none; }
.aelms-nav-lang {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem 0.5rem;
	margin-left: auto;
	font-size: 0.875rem;
}
.aelms-input-inline { padding: 0.35rem 0.5rem; font-size: 0.875rem; max-width: 220px; }
.aelms-score-meter {
	height: 8px;
	background: #e2e8f0;
	border-radius: 999px;
	overflow: hidden;
	margin: 8px 0;
}
.aelms-score-meter-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--aelms-primary), #38bdf8);
}
.aelms-app-pane {
	width: 100%;
}

.aelms-toolbar-row {
	margin: 0 0 0.75rem;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.25rem 0.5rem;
	font-size: 0.9375rem;
}
.aelms-back-link {
	font-weight: 600;
}

/* ============================================================
 * Shared cards / buttons (used by both admin SPA and student UI)
 * ============================================================ */

.aelms-frontend { color: var(--aelms-ink); font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.5; }
.aelms-frontend *,
.aelms-admin-wrap * { box-sizing: border-box; }

.aelms-admin-wrap { background: #f8fafc; min-height: calc(100vh - 32px); }
#aelms-admin-app { padding: 0; }

.aelms-card {
	background: #fff;
	border: 1px solid var(--aelms-shell-border);
	border-radius: 16px;
	box-shadow: 0 1px 2px rgba(15,23,42,0.03), 0 1px 3px rgba(15,23,42,0.05);
	padding: 22px;
	margin-bottom: 18px;
}
.aelms-card-title { margin: 0 0 14px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.aelms-muted { color: var(--aelms-muted); }
.aelms-page-header {
	padding-bottom: 16px;
	margin-bottom: 22px;
	border-bottom: 1px solid var(--aelms-shell-border);
	display: flex;
	flex-wrap: wrap;
	gap: 10px 16px;
	align-items: flex-end;
	justify-content: space-between;
}
.aelms-page-header h1 { margin: 0 0 4px; font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.aelms-page-header p { margin: 0; }

.aelms-btn-primary, .aelms-btn-secondary, .aelms-btn-danger, .aelms-link {
	display: inline-flex; align-items: center; gap: 6px;
	padding: 10px 16px; font-size: 13px; font-weight: 600;
	border-radius: 10px; cursor: pointer; transition: all 0.15s;
	border: none; text-decoration: none;
	font-family: inherit;
}
.aelms-btn-primary:focus-visible, .aelms-btn-secondary:focus-visible, .aelms-btn-danger:focus-visible,
.aelms-input:focus-visible, .aelms-nav-item:focus-visible, .aelms-pill:focus-visible {
	outline: none;
	box-shadow: 0 0 0 3px rgba(15,95,182,0.18);
}
.aelms-btn-primary { background: var(--aelms-primary); color: #fff; }
.aelms-btn-primary:hover { background: var(--aelms-primary-dark); }
.aelms-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.aelms-btn-secondary { background: #fff; color: var(--aelms-ink); border: 1px solid var(--aelms-border); }
.aelms-btn-secondary:hover { background: var(--aelms-surface); }
.aelms-btn-danger { background: var(--aelms-danger); color: #fff; }
.aelms-btn-danger:hover { background: #b91c1c; }
.aelms-link { color: var(--aelms-primary); background: transparent; padding: 4px 0; }

.aelms-input,
.aelms-frontend select.aelms-input {
	display: block; width: 100%;
	padding: 8px 10px; font-size: 13px;
	border: 1px solid var(--aelms-border); border-radius: 8px;
	background: #fff; color: var(--aelms-ink);
	font-family: inherit;
}
.aelms-input:focus { outline: none; border-color: var(--aelms-primary); box-shadow: 0 0 0 3px rgba(15,95,182,0.15); }
.aelms-label { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 600; }

.aelms-grid { display: grid; gap: 12px; }
.aelms-grid-stats    { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.aelms-grid-courses  { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.aelms-grid-subjects { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.aelms-form-grid {
	display: grid; gap: 12px;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	margin-bottom: 16px;
}

.aelms-stat-label { font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--aelms-muted); letter-spacing: 0.05em; }
.aelms-stat-value { font-size: 28px; font-weight: 700; color: var(--aelms-ink); margin-top: 4px; }

.aelms-course-card {
	display: block; padding: 18px; border-radius: 14px; background: #fff;
	border: 1px solid var(--aelms-border); text-decoration: none; color: var(--aelms-ink);
	border-left: 5px solid var(--brand, var(--aelms-primary));
	transition: box-shadow 0.15s, transform 0.15s;
}
.aelms-course-card:hover { box-shadow: 0 4px 12px rgba(15,23,42,0.08); transform: translateY(-1px); }
.aelms-course-card.is-locked { opacity: 0.7; }
.aelms-course-name { font-weight: 700; font-size: 18px; margin-bottom: 6px; }

.aelms-subject-card { padding: 14px; border: 1px solid var(--aelms-border); border-radius: 10px; background: var(--aelms-surface); }
.aelms-subject-name { font-weight: 700; margin-bottom: 6px; }

.aelms-data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.aelms-data-table thead tr { background: var(--aelms-surface); border-bottom: 1px solid var(--aelms-border); }
.aelms-data-table th, .aelms-data-table td { padding: 8px 10px; text-align: left; }
.aelms-data-table tbody tr { border-bottom: 1px solid #f1f5f9; }

.aelms-bar { display: inline-block; vertical-align: middle; width: 120px; height: 8px; background: var(--aelms-border); border-radius: 999px; overflow: hidden; margin-right: 8px; }
.aelms-bar-fill { height: 100%; background: linear-gradient(90deg, var(--aelms-primary), var(--aelms-accent)); }

.aelms-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--aelms-surface); color: var(--aelms-ink); border: 1px solid var(--aelms-border); margin-right: 4px; cursor: pointer; }
.aelms-pill.is-active { background: var(--aelms-primary); color: #fff; border-color: var(--aelms-primary); }

.aelms-alert-danger { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.aelms-alert-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }

.aelms-spinner { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--aelms-border); border-top-color: var(--aelms-primary); animation: aelms-spin 0.7s linear infinite; vertical-align: middle; margin-right: 6px; }
@keyframes aelms-spin { to { transform: rotate(360deg); } }

/* ============================================================
 * QUIZ RUNNER
 * ============================================================ */

.aelms-runner { background: var(--aelms-surface); overflow: hidden; height: 100%; }
.aelms-runner-shell {
	display: flex;
	flex-direction: column;
	min-height: 0;
	height: 100%;
}

.aelms-runner-topbar {
	position: sticky; top: 0; z-index: 10;
	display: flex; align-items: center; justify-content: space-between;
	padding: 12px 16px; background: #fff;
	border-bottom: 1px solid var(--aelms-border);
	flex-shrink: 0;
}
.aelms-runner-topbar-center { flex: 1; display: flex; justify-content: center; }
.aelms-runner-topbar-left, .aelms-runner-topbar-right { display: flex; align-items: center; gap: 10px; }
.aelms-runner-progress { font-weight: 600; font-size: 14px; color: var(--aelms-ink); }

.aelms-timer { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 10px; background: var(--aelms-surface); border: 1px solid var(--aelms-border); }
.aelms-timer-value { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; color: var(--aelms-ink); }
.aelms-timer.is-countdown .aelms-timer-value { color: var(--aelms-primary); }
.aelms-timer.is-out .aelms-timer-value { color: var(--aelms-danger); animation: aelms-pulse 1s infinite; }
@keyframes aelms-pulse { 50% { opacity: 0.5; } }

.aelms-icon-btn { background: transparent; border: 1px solid var(--aelms-border); border-radius: 8px; padding: 6px 10px; font-size: 16px; cursor: pointer; color: var(--aelms-ink); }
.aelms-icon-btn:hover { background: var(--aelms-surface); }
.aelms-icon-btn.is-flagged { color: var(--aelms-warning); border-color: var(--aelms-warning); }

.aelms-runner-body { display: flex; flex: 1 1 auto; min-height: 0; }

.aelms-navigator { width: 220px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--aelms-border); padding: 14px; overflow-y: auto; min-height: 0; }
.aelms-navigator:not(.is-open) { display: none; }
.aelms-navigator-summary { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--aelms-muted); margin-bottom: 12px; }
.aelms-navigator-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.aelms-nav-cell {
	display: inline-flex; align-items: center; justify-content: center;
	width: 100%; aspect-ratio: 1; border-radius: 8px;
	font-size: 12px; font-weight: 600; cursor: pointer;
	background: var(--aelms-surface); color: var(--aelms-ink);
	border: 1px solid var(--aelms-border);
	font-family: inherit;
}
.aelms-nav-cell.current { background: var(--aelms-primary); color: #fff; border-color: var(--aelms-primary); }
.aelms-nav-cell.answered { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.aelms-nav-cell.flagged { background: #fef3c7; color: #92400e; border-color: #fde68a; }

.aelms-question-pane { flex-grow: 1; padding: 24px 32px; overflow-y: auto; min-width: 0; }

.aelms-question-meta { display: flex; gap: 6px; margin-bottom: 14px; }
.aelms-question-stem { font-size: 16px; line-height: 1.6; color: var(--aelms-ink); margin-bottom: 22px; }
.aelms-question-stem img { max-width: 100%; height: auto; border-radius: 8px; }

.aelms-options { display: flex; flex-direction: column; gap: 8px; }
.aelms-option {
	display: flex; align-items: flex-start; gap: 12px;
	padding: 14px 18px; border-radius: 12px; background: #fff;
	border: 2px solid var(--aelms-border); cursor: pointer; text-align: left;
	font-size: 14px; transition: all 0.12s;
	width: 100%;
	font-family: inherit;
}
.aelms-option:hover { border-color: var(--aelms-primary); }
.aelms-option.is-selected { border-color: var(--aelms-primary); background: #eff6ff; }
.aelms-option.is-correct  { border-color: var(--aelms-success); background: #f0fdf4; }
.aelms-option.is-incorrect{ border-color: var(--aelms-danger);  background: #fef2f2; }
.aelms-option-letter { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; border-radius: 50%; background: var(--aelms-surface); border: 1px solid var(--aelms-border); font-weight: 700; flex-shrink: 0; }
.aelms-option-text { flex-grow: 1; }

.aelms-mtf { display: flex; flex-direction: column; gap: 8px; }
.aelms-mtf-row {
	display: grid; grid-template-columns: 30px 1fr auto;
	align-items: center; gap: 12px;
	padding: 12px 14px; background: #fff;
	border: 1px solid var(--aelms-border); border-radius: 10px;
}
.aelms-mtf-readonly .aelms-mtf-row.is-correct { background: #f0fdf4; border-color: var(--aelms-success); }
.aelms-mtf-readonly .aelms-mtf-row.is-incorrect { background: #fef2f2; border-color: var(--aelms-danger); }
.aelms-mtf-letter { font-weight: 700; color: var(--aelms-muted); }
.aelms-mtf-text { font-size: 14px; }
.aelms-mtf-buttons { display: flex; gap: 6px; }
.aelms-mtf-truth { font-size: 12px; color: var(--aelms-muted); display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

.aelms-tf-btn {
	width: 40px; height: 36px; border-radius: 8px;
	background: var(--aelms-surface); border: 2px solid var(--aelms-border);
	font-weight: 700; cursor: pointer; color: var(--aelms-ink);
	font-family: inherit;
}
.aelms-tf-btn:hover { border-color: var(--aelms-primary); }
.aelms-tf-btn.is-selected-true  { background: var(--aelms-primary); color: #fff; border-color: var(--aelms-primary); }
.aelms-tf-btn.is-selected-false { background: var(--aelms-ink); color: #fff; border-color: var(--aelms-ink); }
.aelms-tf-btn.is-correct        { background: var(--aelms-success); color: #fff; border-color: var(--aelms-success); }
.aelms-tf-btn.is-incorrect      { background: var(--aelms-danger); color: #fff; border-color: var(--aelms-danger); }

.aelms-explanation { margin-top: 22px; padding: 16px; border-radius: 12px; background: #eff6ff; border-left: 4px solid var(--aelms-primary); }
.aelms-explanation-title { font-weight: 700; margin-bottom: 8px; font-size: 14px; }

.aelms-tag { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; margin-left: 6px; }
.aelms-tag-correct   { background: #dcfce7; color: #15803d; }
.aelms-tag-incorrect { background: #fee2e2; color: #b91c1c; }
.aelms-tag-partial  { background: #fef9c3; color: #854d0e; }

.aelms-question-footer { display: flex; justify-content: space-between; gap: 8px; margin-top: 28px; }

.aelms-modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.4); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.aelms-modal { background: #fff; padding: 24px; border-radius: 14px; max-width: 460px; width: 92%; }
.aelms-modal h3 { margin: 0 0 8px; }
.aelms-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* Results */
.aelms-results-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.aelms-result-stat { background: var(--aelms-surface); padding: 14px; border-radius: 10px; }
.aelms-review-card.is-correct   { border-left: 4px solid var(--aelms-success); }
.aelms-review-card.is-incorrect { border-left: 4px solid var(--aelms-danger); }
.aelms-review-header { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.aelms-result-filters { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 768px) {
	.aelms-runner-body { flex-direction: column; }
	.aelms-navigator { width: 100%; border-right: none; border-bottom: 1px solid var(--aelms-border); max-height: 30vh; }
	.aelms-navigator-grid { grid-template-columns: repeat(8, 1fr); }
	.aelms-question-pane { padding: 16px; }
}

/* ============================================================
 * NEW VIEWS: HISTORY + STATS
 * ============================================================ */

.aelms-filters-row {
	display: grid;
	gap: 12px;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	margin-bottom: 14px;
}

.aelms-status-pill {
	display: inline-flex;
	align-items: center;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.02em;
}
.aelms-status-pill.is-completed { background: #dcfce7; color: #15803d; }
.aelms-status-pill.is-in-progress { background: #fef3c7; color: #92400e; }
.aelms-status-pill.is-abandoned { background: #fee2e2; color: #b91c1c; }

.aelms-stats-grid {
	display: grid;
	gap: 16px;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.aelms-stat-card {
	background: #fff;
	border: 1px solid var(--aelms-shell-border);
	border-radius: 14px;
	padding: 18px 20px;
}
.aelms-stat-card .aelms-stat-label { font-size: 11px; }
.aelms-stat-card .aelms-stat-value { font-size: 26px; }

.aelms-spark {
	display: flex;
	gap: 3px;
	align-items: flex-end;
	height: 64px;
}
.aelms-spark-bar {
	flex: 1;
	min-width: 4px;
	background: linear-gradient(180deg, var(--aelms-accent), var(--aelms-primary));
	border-radius: 3px 3px 0 0;
	min-height: 2px;
	opacity: 0.85;
}
.aelms-spark-bar.is-empty { background: var(--aelms-shell-border); opacity: 0.5; }

.aelms-subject-bar {
	display: grid;
	grid-template-columns: 1fr 80px 60px;
	align-items: center;
	gap: 10px;
	padding: 8px 0;
	border-bottom: 1px solid var(--aelms-shell-border);
	font-size: 13px;
}
.aelms-subject-bar:last-child { border-bottom: none; }
.aelms-subject-bar-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aelms-subject-bar .aelms-bar { width: 100%; }

.aelms-empty {
	text-align: center;
	padding: 36px 20px;
	color: var(--aelms-muted);
}
.aelms-empty-title { font-size: 16px; font-weight: 700; color: var(--aelms-ink); margin-bottom: 6px; }

.aelms-load-more {
	display: block;
	margin: 18px auto 0;
}
