/**
 * MRT Platform Core Shared UI Tokens
 * Included globally inside MRT App
 */

/* Core UI Notices */
.mrt-core-notice {
    padding: 16px 20px;
    border-radius: 8px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.mrt-core-notice--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}
.mrt-core-notice--error::before {
    content: "⚠️ ";
}

.mrt-core-notice--success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}
.mrt-core-notice--success::before {
    content: "✅ ";
}

/* Base button primitives - can be extended by other plugins */
.mrt-core-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.mrt-core-btn--primary {
    background: #4589f5;
    color: #fff;
    border: none;
}
.mrt-core-btn--primary:hover {
    background: #357ded;
    transform: translateY(-2px);
}

/* ─── Breadcrumb Navigation ─── */
.mrt-breadcrumb {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border-bottom: 1px solid #e2e8f0;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    margin-bottom: 0;
}

.mrt-breadcrumb__list {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.mrt-breadcrumb__item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.mrt-breadcrumb__icon {
    font-size: 15px;
}

.mrt-breadcrumb__link {
    color: #4589f5;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}
.mrt-breadcrumb__link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.mrt-breadcrumb__current {
    color: #475569;
    font-weight: 600;
}

.mrt-breadcrumb__separator {
    color: #94a3b8;
    margin: 0 8px;
    font-size: 16px;
    font-weight: 300;
}

.mrt-breadcrumb__back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}
.mrt-breadcrumb__back:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .mrt-breadcrumb {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 8px 14px;
        font-size: 13px;
    }
    .mrt-breadcrumb__back {
        align-self: flex-start;
    }
}

/* ─── App Navigation & User Menu ─── */
.mrt-app-nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
}
.mrt-nav-user-badge {
    background: #6366f1;
    color: white !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    padding: 4px 6px !important;
    border-radius: 4px;
    letter-spacing: 0.5px;
    display: inline-block;
    line-height: var(--ast-global-line-height, 1) !important;
    vertical-align: middle;
    margin-right: 4px;
}
.mrt-app-nav-user strong {
    color: #1e293b;
    font-weight: 600;
    font-size: 14px;
    vertical-align: middle;
}
.mrt-app-nav-logout a {
    color: #ef4444 !important;
    font-weight: 500;
}
.mrt-app-nav-logout a:hover {
    color: #dc2626 !important;
}

/* ═══════════════════════════════════════════
   5. App Shell & Layout Structure (P4-D1)
   ═══════════════════════════════════════════ */

:root {
	/* Existing tokens */
	--mrt-surface: #f8fafc;
	--mrt-text-primary: #1e293b;
	--mrt-text-secondary: #64748b;
	--mrt-border: #e2e8f0;
	--mrt-primary: #2563eb;

	/* ── Design System Lite: Spacing ── */
	--mrt-space-1: 4px;
	--mrt-space-2: 8px;
	--mrt-space-3: 12px;
	--mrt-space-4: 16px;
	--mrt-space-5: 20px;
	--mrt-space-6: 24px;

	/* ── Design System Lite: Radius ── */
	--mrt-radius-sm: 6px;
	--mrt-radius-md: 10px;
	--mrt-radius-lg: 14px;

	/* ── Design System Lite: Font sizes ── */
	--mrt-font-xs: 12px;
	--mrt-font-sm: 13px;
	--mrt-font-base: 14px;
	--mrt-font-md: 16px;
	--mrt-font-lg: 20px;
	--mrt-font-xl: 24px;

	/* ── Design System Lite: Colors ── */
	--mrt-color-text: #1e293b;
	--mrt-color-muted: #64748b;
	--mrt-color-border: #e2e8f0;
	--mrt-color-surface: #ffffff;
	--mrt-color-surface-alt: #f8fafc;
	--mrt-color-success: #16a34a;
	--mrt-color-warning: #d97706;
	--mrt-color-danger: #dc2626;
	--mrt-color-link: #2563eb;
}

/* ═══════════════════════════════════════════
   Design System Lite: Section Card
   ═══════════════════════════════════════════ */
.mrt-section-card {
	background: var(--mrt-color-surface);
	border: 1px solid var(--mrt-color-border);
	border-radius: var(--mrt-radius-md);
	padding: var(--mrt-space-4) var(--mrt-space-5);
	margin-bottom: var(--mrt-space-6);
}
.mrt-section-card__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: var(--mrt-space-4);
	padding-bottom: var(--mrt-space-3);
	border-bottom: 1px solid var(--mrt-color-border);
}
.mrt-section-card__title {
	font-size: var(--mrt-font-md);
	font-weight: 600;
	color: var(--mrt-color-text);
	margin: 0;
}
.mrt-section-card__meta {
	font-size: var(--mrt-font-xs);
	color: var(--mrt-color-muted);
}

/* ═══════════════════════════════════════════
   Design System Lite: Table
   ═══════════════════════════════════════════ */
.mrt-table-wrap {
	overflow-x: auto;
	margin-bottom: var(--mrt-space-6);
}
.mrt-table-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: var(--mrt-space-3);
}
.mrt-table-title {
	font-size: var(--mrt-font-md);
	font-weight: 600;
	color: var(--mrt-color-text);
	margin: 0;
}
.mrt-table-helper {
	font-size: var(--mrt-font-sm);
	color: var(--mrt-color-muted);
}
.mrt-table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--mrt-font-base);
}
.mrt-table th {
	text-align: left;
	padding: var(--mrt-space-3) var(--mrt-space-4);
	background: var(--mrt-color-surface-alt);
	color: var(--mrt-color-muted);
	font-weight: 600;
	font-size: var(--mrt-font-sm);
	border-bottom: 2px solid var(--mrt-color-border);
	white-space: nowrap;
}
.mrt-table td {
	padding: var(--mrt-space-3) var(--mrt-space-4);
	border-bottom: 1px solid var(--mrt-color-border);
	color: var(--mrt-color-text);
	vertical-align: middle;
}
.mrt-table tr:last-child td { border-bottom: none; }
.mrt-table tr:hover td { background: #f9fafb; }
.mrt-table-actions { white-space: nowrap; text-align: right; }

/* ═══════════════════════════════════════════
   Design System Lite: Filter Bar
   ═══════════════════════════════════════════ */
.mrt-filter-bar {
	display: flex;
	align-items: center;
	gap: var(--mrt-space-3);
	flex-wrap: wrap;
	margin-bottom: var(--mrt-space-5);
}
.mrt-filter-group {
	display: flex;
	align-items: center;
	gap: var(--mrt-space-2);
}
.mrt-filter-bar input[type="text"],
.mrt-filter-bar input[type="search"],
.mrt-filter-bar select {
	height: 36px;
	padding: 0 var(--mrt-space-3);
	border: 1px solid var(--mrt-color-border);
	border-radius: var(--mrt-radius-sm);
	font-size: var(--mrt-font-base);
	color: var(--mrt-color-text);
	background: var(--mrt-color-surface);
}
.mrt-filter-bar input:focus,
.mrt-filter-bar select:focus {
	outline: none;
	border-color: var(--mrt-color-link);
	box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.mrt-filter-actions {
	display: flex;
	gap: var(--mrt-space-2);
	margin-left: auto;
}

/* ═══════════════════════════════════════════
   Design System Lite: Badge
   ═══════════════════════════════════════════ */
.mrt-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 8px;
	border-radius: 99px;
	font-size: var(--mrt-font-xs);
	font-weight: 600;
	line-height: 1.4;
}
.mrt-badge--success { background: #f0fdf4; color: var(--mrt-color-success); }
.mrt-badge--warning { background: #fffbeb; color: var(--mrt-color-warning); }
.mrt-badge--danger  { background: #fef2f2; color: var(--mrt-color-danger); }
.mrt-badge--neutral { background: #f1f5f9; color: var(--mrt-color-muted); }
.mrt-badge--info    { background: #eff6ff; color: var(--mrt-color-link); }

/* ═══════════════════════════════════════════
   Design System Lite: Empty State
   ═══════════════════════════════════════════ */
.mrt-empty-state {
	text-align: center;
	padding: 40px var(--mrt-space-6);
	color: var(--mrt-color-muted);
	background: var(--mrt-color-surface-alt);
	border: 1px dashed var(--mrt-color-border);
	border-radius: var(--mrt-radius-md);
}
.mrt-empty-state__icon {
	font-size: 2.5rem;
	margin-bottom: var(--mrt-space-3);
	opacity: 0.6;
}
.mrt-empty-state__title {
	font-size: var(--mrt-font-md);
	font-weight: 600;
	color: var(--mrt-color-text);
	margin: 0 0 var(--mrt-space-2);
}
.mrt-empty-state__desc {
	font-size: var(--mrt-font-base);
	margin: 0 0 var(--mrt-space-4);
}
.mrt-empty-state__action {
	display: inline-flex;
	padding: 8px 20px;
	border-radius: var(--mrt-radius-sm);
	background: var(--mrt-color-link);
	color: #fff;
	font-weight: 600;
	font-size: var(--mrt-font-base);
	text-decoration: none;
	transition: opacity 0.2s;
}
.mrt-empty-state__action:hover { opacity: 0.9; }

.mrt-app-shell {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 80px); /* Approx offset for WP header */
    background-color: var(--mrt-surface);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.mrt-app-container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 24px 64px;
    flex: 1;
}

/* Page Header */
.mrt-app-page-header {
    margin-bottom: 32px;
}

.mrt-app-page-header__breadcrumb {
    margin-bottom: 12px;
}

.mrt-app-page-header__title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
}

.mrt-app-page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--mrt-text-primary);
    line-height: 1.2;
    margin: 0;
}

.mrt-app-page-subtitle {
    font-size: 1.125rem;
    color: var(--mrt-text-secondary);
    margin: 8px 0 0;
}

/* Sections */
.mrt-app-section {
    margin-bottom: 40px;
}

.mrt-app-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--mrt-text-primary);
    margin: 0 0 24px;
}

/* Footer */
.mrt-app-footer {
    padding: 24px;
    text-align: center;
    border-top: 1px solid var(--mrt-border);
    color: var(--mrt-text-secondary);
    font-size: 0.875rem;
    background-color: transparent;
}

.mrt-app-footer a {
    color: var(--mrt-primary);
    text-decoration: none;
    font-weight: 500;
}

.mrt-app-footer a:hover {
    text-decoration: underline;
}

/* Mobile Adjustments for App Shell */
@media (max-width: 768px) {
    .mrt-app-container {
        padding: 24px 16px 40px;
    }

    .mrt-app-page-header__title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .mrt-app-page-title {
        font-size: 1.75rem;
    }
}

/* ═══════════════════════════════════════════
   6. Learning UX Components (P4-D3)
   ═══════════════════════════════════════════ */

/* Filter Pills */
.mrt-filter-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 24px;
}
.mrt-filter-pill {
	background: #f1f5f9;
	color: #64748b;
	padding: 8px 16px;
	border-radius: 99px;
	font-size: 14px;
	font-weight: 500;
	transition: all 0.2s ease;
	text-decoration: none;
}
.mrt-filter-pill:hover {
	background: #e2e8f0;
	color: #1e293b;
}
.mrt-filter-pill.is-active {
	background: #3b82f6;
	color: white;
}

/* Course Progress Summary */
.mrt-course-progress-summary {
	background: white;
	border-radius: 12px;
	padding: 24px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
	border: 1px solid #e2e8f0;
	margin-bottom: 24px;
}
.mrt-course-summary-stats {
	display: flex;
	gap: 24px;
	margin-bottom: 20px;
}
.mrt-course-stat {
	display: flex;
	flex-direction: column;
}
.mrt-stat-value {
	font-size: 24px;
	font-weight: 700;
	color: #1e293b;
}
.mrt-stat-label {
	font-size: 13px;
	color: #64748b;
	margin-top: 4px;
}
.mrt-course-summary-bar {
	padding-top: 20px;
	border-top: 1px solid #e2e8f0;
}

/* Resume Banner */
.mrt-resume-banner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: linear-gradient(to right, #eff6ff, #dbeafe);
	border: 1px solid #bfdbfe;
	margin-bottom: 32px;
	padding: 24px;
	border-radius: 12px;
}
.mrt-resume-banner--start {
	background: linear-gradient(to right, #f8fafc, #f1f5f9);
	border: 1px solid #e2e8f0;
}
.mrt-resume-label {
	font-size: 12px;
	text-transform: uppercase;
	font-weight: 700;
	color: #2563eb;
	letter-spacing: 0.5px;
	margin-bottom: 4px;
	display: block;
}
.mrt-resume-title {
	font-size: 18px;
	font-weight: 600;
	margin: 0;
	color: #1e293b;
}
.mrt-resume-desc {
	margin: 4px 0 0;
	color: #64748b;
	font-size: 14px;
}

/* Subject Snapshot Cards (Hub) */
.mrt-subject-snapshot-card {
	background: white;
	border-radius: 12px;
	padding: 24px;
	border: 1px solid #e2e8f0;
	transition: all 0.2s ease;
	display: flex;
	flex-direction: column;
	text-decoration: none;
	height: 100%;
}
.mrt-subject-snapshot-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
	border-color: #cbd5e1;
}
.mrt-subject-snapshot-card.is-locked {
	opacity: 0.8;
	pointer-events: none;
}
.mrt-snapshot-icon {
	font-size: 40px;
	margin-bottom: 16px;
}
.mrt-snapshot-header {
	margin-bottom: 12px;
}
.mrt-snapshot-title {
	font-size: 20px;
	font-weight: 600;
	margin: 0 0 4px;
	color: #1e293b;
}
.mrt-snapshot-courses {
	font-size: 13px;
	color: #64748b;
	font-weight: 500;
}
.mrt-snapshot-content {
	flex: 1;
	margin-bottom: 24px;
}
.mrt-snapshot-desc {
	font-size: 14px;
	color: #64748b;
	margin: 12px 0 16px;
}
.mrt-snapshot-action {
	border-top: 1px solid #e2e8f0;
	padding-top: 16px;
	text-align: right;
}
.mrt-snapshot-cta {
	font-size: 14px;
	font-weight: 600;
	color: #3b82f6;
}
.mrt-subject-snapshot-card:hover .mrt-snapshot-cta {
	color: #2563eb;
}

/* Continue Learning Block */
.mrt-continue-block {
	background: white;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 32px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
	margin-bottom: 40px;
	display: grid;
	gap: 20px;
	position: relative;
	overflow: hidden;
}
.mrt-continue-block::before {
	content: '';
	position: absolute;
	top: 0; left: 0;
	width: 6px; height: 100%;
	background: #3b82f6;
}
.mrt-continue-block-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.mrt-continue-badge {
	background: #eff6ff;
	color: #2563eb;
	padding: 4px 12px;
	border-radius: 99px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}
.mrt-continue-time {
	font-size: 13px;
	color: #64748b;
}
.mrt-continue-course {
	font-size: 24px;
	font-weight: 700;
	margin: 0;
	color: #1e293b;
}
.mrt-continue-lesson {
	font-size: 16px;
	color: #64748b;
	margin: 0;
}
.mrt-continue-progress-wrap {
	max-width: 400px;
}
.mrt-continue-action {
	margin-top: 8px;
}
.mrt-continue-block--empty {
	text-align: center;
	padding: 48px 24px;
	background: #f8fafc;
	justify-content: center;
}
.mrt-continue-block--empty::before {
	background: #cbd5e1;
}

/* Recent Activity List */
.mrt-recent-activity-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.mrt-activity-item {
	display: flex;
	flex-direction: column;
	padding: 16px 20px;
	background: white;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	text-decoration: none;
	transition: all 0.2s ease;
}
.mrt-activity-item:hover {
	border-color: #94a3b8;
	background: #f8fafc;
}
.mrt-activity-meta {
	display: flex;
	gap: 8px;
	margin-bottom: 8px;
	font-size: 12px;
	color: #64748b;
}
.mrt-activity-subject {
	font-weight: 600;
	color: #475569;
}
.mrt-activity-lesson {
	font-size: 16px;
	font-weight: 600;
	color: #1e293b;
	margin: 0 0 8px;
}
.mrt-activity-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 13px;
}
.mrt-activity-status {
	padding: 2px 8px;
	border-radius: 4px;
	background: #f1f5f9;
	color: #64748b;
	font-weight: 500;
}
.mrt-activity-status.in_progress { background: #eff6ff; color: #2563eb; }
.mrt-activity-status.completed { background: #f0fdf4; color: #16a34a; }
.mrt-recent-activity-empty {
	padding: 32px;
	text-align: center;
	color: #64748b;
	background: #f8fafc;
	border-radius: 8px;
	border: 1px dashed #e2e8f0;
}

@media (max-width: 768px) {
	.mrt-resume-banner {
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
	}
	.mrt-continue-block-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}
}

/* ═══════════════════════════════════════════════════════
   GLOBAL WHITE BACKGROUND OVERRIDE  (P4-Fix)
   Forces the student home page to render on a white
   background regardless of any inherited dark theme.
   ═══════════════════════════════════════════════════════ */
.mrt-app-shell,
.mrt-app-shell.mrt-student-home-shell {
    background: #ffffff !important;
    background-color: #ffffff !important;
}
.mrt-app-container {
    background: #ffffff !important;
}
.mrt-student-app-home,
.mrt-student-app-home.mrt-student-app-premium {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
}

/* ── STUDENT badge: compact size regardless of Astra theme ── */
.mrt-nav-user-badge,
.ast-builder-menu-1 .mrt-nav-user-badge,
.main-header-bar .mrt-nav-user-badge,
#masthead .mrt-nav-user-badge {
    background: #6366f1 !important;
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    padding: 3px 6px !important;
    line-height: 1 !important;
    height: auto !important;
    max-height: 22px !important;
    border-radius: 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    letter-spacing: 0.5px !important;
    vertical-align: middle !important;
    margin-right: 4px !important;
    /* Reset any inherited spacings */
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    box-shadow: none !important;
}
/* Prevent the parent <li> from stretching because of the badge */
.ast-builder-menu-1 .menu-item .mrt-nav-user-badge {
    position: static !important;
}

