/* ============================================
   MRT Portal — Core Shared Styles  (P3-R4)
   All 3 subject portals inherit from this.
   Subject-specific colours defined per-plugin CSS.
   ============================================ */

/* ===== Typography & Reset ===== */
.mrt-math-portal-wrapper,
.mrt-coding-portal-wrapper,
.mrt-robotics-portal-wrapper {
	max-width: 1200px;
	margin: 0 auto;
	padding: 20px;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

/* ===== Breadcrumb ===== */
.mrt-portal-breadcrumb {
	margin-bottom: 14px;
	font-size: 0.84rem;
	color: #64748b;
	letter-spacing: -0.01em;
}
.mrt-portal-breadcrumb a {
	color: #2563eb;
	text-decoration: none;
	font-weight: 500;
}
.mrt-portal-breadcrumb a:hover {
	text-decoration: underline;
}
.mrt-breadcrumb-sep {
	margin: 0 5px;
	color: #94a3b8;
}
.mrt-breadcrumb-current {
	color: #334155;
	font-weight: 500;
}

/* ===== Hero (shared structure) ===== */
.mrt-portal-hero {
	color: #fff;
	border-radius: 20px;
	padding: 36px 40px;
	margin-bottom: 28px;
	position: relative;
	overflow: hidden;
	box-shadow: 0 12px 24px rgba(0,0,0,0.1);
}
.mrt-portal-hero::after {
	content: '';
	position: absolute;
	right: -40px;
	top: -40px;
	width: 200px;
	height: 200px;
	background: rgba(255, 255, 255, 0.08);
	border-radius: 50%;
	filter: blur(25px);
	animation: mrt-float 8s ease-in-out infinite;
	pointer-events: none;
}
.mrt-portal-hero::before {
	content: '';
	position: absolute;
	left: -20px;
	bottom: -40px;
	width: 150px;
	height: 150px;
	background: rgba(255, 255, 255, 0.05);
	border-radius: 50%;
	filter: blur(15px);
	animation: mrt-float 6s ease-in-out infinite reverse;
	pointer-events: none;
}
.mrt-portal-hero h1 {
	font-size: 1.6rem;
	font-weight: 700;
	margin: 0 0 4px;
	color: #fff;
	position: relative;
	z-index: 2;
	letter-spacing: -0.02em;
}
.mrt-portal-course-title {
	font-size: 1rem;
	opacity: 0.88;
	margin: 0 0 6px;
	color: #e2e8f0;
	position: relative;
	z-index: 2;
	font-weight: 400;
}
.mrt-portal-subtitle {
	font-size: 0.88rem;
	opacity: 0.72;
	margin: 0 0 16px;
	position: relative;
	z-index: 2;
}
.mrt-portal-summary {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	position: relative;
	z-index: 2;
}
.mrt-portal-summary span {
	background: rgba(255, 255, 255, 0.15);
	box-shadow: 0 4px 10px rgba(0,0,0,0.05);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	border: 1px solid rgba(255,255,255,0.15);
	padding: 6px 16px;
	border-radius: 20px;
	font-size: 0.82rem;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 500;
	transition: background 0.3s ease, transform 0.2s ease;
}
.mrt-portal-summary span:hover {
	background: rgba(255, 255, 255, 0.25);
	transform: translateY(-1px);
}

/* ===== Keyframes ===== */
@keyframes mrt-gradient-flow {
	0% { background-position: 0% 50%; }
	50% { background-position: 100% 50%; }
	100% { background-position: 0% 50%; }
}
@keyframes mrt-float {
	0% { transform: translateY(0px) rotate(0deg); }
	50% { transform: translateY(-15px) rotate(3deg); }
	100% { transform: translateY(0px) rotate(0deg); }
}

/* ===== Hero Colours (per-subject) ===== */
.mrt-portal-hero--math {
	background: linear-gradient(135deg, #0f172a, #1e3a8a, #3b82f6, #0f172a);
	background-size: 300% 300%;
	animation: mrt-gradient-flow 12s ease infinite;
}
.mrt-portal-hero--coding {
	background: linear-gradient(135deg, #020617, #0f766e, #14b8a6, #020617);
	background-size: 300% 300%;
	animation: mrt-gradient-flow 12s ease infinite;
}
.mrt-portal-hero--robotics {
	background: linear-gradient(135deg, #7c2d12, #ea580c, #f59e0b, #7c2d12);
	background-size: 300% 300%;
	animation: mrt-gradient-flow 12s ease infinite;
}

/* ===== Card Grid ===== */
.mrt-portal-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 18px;
	margin-bottom: 12px;
}

/* ===== Card ===== */
.mrt-portal-card {
	background: #fff;
	border: 1px solid rgba(226, 232, 240, 0.8);
	border-radius: 16px;
	overflow: hidden;
	text-align: left;
	display: flex;
	flex-direction: column;
	transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
	padding: 0;
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
	position: relative;
}
.mrt-portal-card::before {
	content: '';
	position: absolute;
	top: 0; left: 0; right: 0; bottom: 0;
	background: linear-gradient(145deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 100%);
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
	z-index: 1;
}

/* Wrapper-scoped overrides to beat any subject/shared CSS */
[class*="mrt-"][class*="-portal-wrapper"] .mrt-portal-card {
	text-align: left;
	padding: 0;
	align-items: stretch;
	gap: 0;
}

.mrt-portal-card:hover {
	transform: translateY(-6px);
	box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
	border-color: #cbd5e1;
}
.mrt-portal-card:hover::before {
	opacity: 1;
}

/* --- Block 1: Thumbnail --- */
.mrt-portal-card .mrt-card-thumb {
	width: 100%;
	height: 148px;
	overflow: hidden;
	background: #f1f5f9;
	flex-shrink: 0;
}
.mrt-portal-card .mrt-card-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}
.mrt-portal-card:hover .mrt-card-thumb img {
	transform: scale(1.04);
}

/* Card without thumbnail (icon mode) */
.mrt-card-icon {
	font-size: 2.6rem;
	margin: 20px 0 6px;
	line-height: 1;
	text-align: center;
	filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.06));
}

/* --- Block 2-4: Card Body Container --- */
.mrt-portal-card .mrt-card-body {
	padding: 14px 16px 16px;
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 0;
}

/* --- Block 2: Title + Description --- */
[class*="-portal-wrapper"] .mrt-card-title,
.mrt-portal-card .mrt-card-title {
	font-size: 0.92rem;
	font-weight: 600;
	color: #1e293b;
	margin: 0 0 4px;
	line-height: 1.32;
	letter-spacing: -0.01em;
	padding: 0;
	text-align: left;
	/* 2-line clamp */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}
.mrt-card-desc {
	font-size: 0.8rem;
	color: #64748b;
	margin: 0 0 8px;
	line-height: 1.4;
	font-weight: 400;
	text-align: left;
	/* 2-line clamp */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* --- Block 3: Meta Row --- */
[class*="-portal-wrapper"] .mrt-card-meta,
.mrt-portal-card .mrt-card-meta {
	font-size: 0.78rem;
	color: #64748b;
	margin-bottom: 12px;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	padding: 0;
}
.mrt-card-meta-extra {
	color: #94a3b8;
	font-size: 0.75rem;
}

/* ===== Status Badges ===== */
.mrt-portal-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 9px;
	border-radius: 10px;
	font-size: 0.72rem;
	font-weight: 600;
	white-space: nowrap;
	letter-spacing: 0.01em;
}
.mrt-badge--not-started {
	background: #f1f5f9;
	color: #94a3b8;
}
.mrt-badge--active {
	background: #eff6ff;
	color: #2563eb;
}
.mrt-badge--completed {
	background: #f0fdf4;
	color: #16a34a;
}

/* Card state backgrounds */
.mrt-portal-card--completed {
	border-color: #86efac;
	background: #fafff8;
}
.mrt-portal-card--active {
	border-color: #93c5fd;
	background: #f8faff;
}

/* --- Block 4: CTA Button --- */
.mrt-card-cta {
	display: block;
	width: 100%;
	text-align: center;
	padding: 12px 16px;
	border-radius: 10px;
	font-weight: 600;
	font-size: 0.88rem;
	text-decoration: none;
	transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
	cursor: pointer;
	border: none;
	box-sizing: border-box;
	margin-top: auto;
	position: relative;
	overflow: hidden;
}

.mrt-card-cta::after {
	content: '';
	position: absolute;
	top: 0; left: -100%; width: 100%; height: 100%;
	background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
	transition: left 0.5s ease;
}

.mrt-portal-card:hover .mrt-card-cta::after {
	left: 100%;
}

/* Legacy support for mrt-btn-block (older markup) */
.mrt-btn {
	display: inline-block;
	padding: 10px 20px;
	border-radius: 8px;
	font-weight: 600;
	font-size: 0.84rem;
	text-decoration: none;
	transition: all 0.2s ease;
	cursor: pointer;
	border: none;
	box-sizing: border-box;
}
.mrt-btn-block {
	display: block;
	width: calc(100% - 32px);
	text-align: center;
	margin: auto 16px 16px;
	padding: 10px 16px;
}

/* Subject-specific CTA colours */
.mrt-math-portal-wrapper .mrt-btn-primary {
	background: #2563eb;
	color: #fff;
}
.mrt-math-portal-wrapper .mrt-btn-primary:hover {
	background: #1d4ed8;
	color: #fff;
	text-decoration: none;
}
.mrt-coding-portal-wrapper .mrt-btn-primary {
	background: #0d9488;
	color: #fff;
}
.mrt-coding-portal-wrapper .mrt-btn-primary:hover {
	background: #0f766e;
	color: #fff;
	text-decoration: none;
}
.mrt-robotics-portal-wrapper .mrt-btn-primary {
	background: #ea580c;
	color: #fff;
}
.mrt-robotics-portal-wrapper .mrt-btn-primary:hover {
	background: #c2410c;
	color: #fff;
	text-decoration: none;
}

/* ===== Section Title (Robotics themes etc.) ===== */
.mrt-portal-section-title {
	font-size: 1.1rem;
	font-weight: 600;
	color: #1e293b;
	padding-left: 14px;
	margin: 24px 0 12px;
	letter-spacing: -0.01em;
}
.mrt-robotics-portal-wrapper .mrt-portal-section-title {
	border-left: 4px solid #ea580c;
}
.mrt-coding-portal-wrapper .mrt-portal-section-title {
	border-left: 4px solid #0d9488;
}
.mrt-math-portal-wrapper .mrt-portal-section-title {
	border-left: 4px solid #2563eb;
}

/* ===== Back to Hub ===== */
.mrt-portal-back-wrap {
	text-align: center;
	margin-top: 28px;
}
.mrt-portal-back-link {
	color: #64748b;
	text-decoration: none;
	font-weight: 500;
	font-size: 0.88rem;
	transition: color 0.2s;
}
.mrt-portal-back-link:hover {
	color: #334155;
	text-decoration: none;
}

/* ===== Empty State ===== */
.mrt-portal-empty-state {
	text-align: center;
	padding: 48px 24px;
	max-width: 460px;
	margin: 32px auto;
}
.mrt-portal-empty-icon {
	font-size: 2.8rem;
	margin-bottom: 14px;
}
.mrt-portal-empty-title {
	font-size: 1.15rem;
	color: #1e293b;
	margin: 0 0 6px;
	font-weight: 600;
}
.mrt-portal-empty-message {
	color: #64748b;
	font-size: 0.88rem;
	margin: 0 0 18px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
	.mrt-math-portal-wrapper,
	.mrt-coding-portal-wrapper,
	.mrt-robotics-portal-wrapper {
		padding: 14px;
	}
	.mrt-portal-hero {
		padding: 24px 18px;
		margin-bottom: 20px;
	}
	.mrt-portal-hero h1 {
		font-size: 1.3rem;
	}
	.mrt-portal-grid {
		grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
		gap: 12px;
	}
	.mrt-portal-card .mrt-card-thumb {
		height: 110px;
	}
	.mrt-card-icon {
		font-size: 2rem;
	}
	.mrt-portal-card .mrt-card-body {
		padding: 12px 12px 14px;
	}
	.mrt-card-title {
		font-size: 0.86rem;
	}
	.mrt-card-desc {
		font-size: 0.76rem;
	}
	.mrt-card-cta {
		padding: 9px 14px;
		font-size: 0.8rem;
	}
	.mrt-btn-block {
		margin-left: 12px;
		margin-right: 12px;
		width: calc(100% - 24px);
		font-size: 0.8rem;
	}
}

@media (max-width: 480px) {
	.mrt-portal-grid {
		grid-template-columns: 1fr;
	}
	.mrt-portal-summary {
		flex-direction: column;
		gap: 6px;
	}
}

/* =========================================================================
 * 6. List Layout (Course Dashboard)
 * ========================================================================= */

.mrt-portal-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0 auto 40px;
	max-width: 900px;
}

.mrt-list-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 16px 20px;
	transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.mrt-list-row:hover {
	border-color: #cbd5e1;
	box-shadow: 0 8px 16px rgba(15, 23, 42, 0.06);
	transform: translateY(-2px);
}

/* Status variants */
.mrt-list-row.mrt-list-row--completed,
.mrt-list-row.mrt-list-row--mastered {
	border-left: 4px solid #10b981;
	padding: 8px 16px; /* more compact */
	background: #f8fafc;
}
.mrt-list-row.mrt-list-row--completed .mrt-list-row-title,
.mrt-list-row.mrt-list-row--mastered .mrt-list-row-title {
	font-size: 0.95rem;
	color: #64748b;
	font-weight: 500;
}
.mrt-list-row.mrt-list-row--completed .mrt-list-row-meta,
.mrt-list-row.mrt-list-row--mastered .mrt-list-row-meta {
	display: none; /* Hide meta for completed to save vertical space */
}

.mrt-list-row.mrt-list-row--active,
.mrt-list-row.mrt-list-row--in_progress {
	border-left: 4px solid #3b82f6;
}

.mrt-list-row.mrt-list-row--not_started {
	border-left: 4px solid #cbd5e1;
}

/* Left side (Icon + Text) */
.mrt-list-row-main {
	display: flex;
	align-items: center;
	gap: 16px;
	flex: 1;
	min-width: 0;
}

.mrt-list-row-icon {
	font-size: 1.8rem;
	line-height: 1;
	filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.08));
	flex-shrink: 0;
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mrt-list-row:hover .mrt-list-row-icon {
	transform: scale(1.15) rotate(5deg);
}

.mrt-list-row-content {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
}

.mrt-list-row-title {
	font-size: 1.05rem;
	font-weight: 600;
	color: #1e293b;
	margin: 0;
	line-height: 1.3;
}

.mrt-list-row-meta {
	font-size: 0.85rem;
	color: #64748b;
	margin: 0;
	line-height: 1.4;
}

/* Right side (Action + Badge) */
.mrt-list-row-actions {
	display: flex;
	align-items: center;
	gap: 20px;
	flex-shrink: 0;
}

.mrt-list-row-badge {
	display: flex;
	align-items: center;
}

.mrt-list-row .mrt-btn {
	padding: 8px 16px;
	font-size: 0.9rem;
	border-radius: 8px;
	white-space: nowrap;
}

.mrt-btn-muted {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}
.mrt-btn-muted:hover {
    background: #e2e8f0;
    color: #475569;
}

/* Responsive adjustments */
@media (max-width: 640px) {
	.mrt-list-row {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		padding: 12px 16px;
		gap: 12px;
	}
	
	.mrt-list-row-actions {
		justify-content: flex-end;
		width: auto;
		border-top: none;
		padding-top: 0;
		margin-left: auto;
		gap: 12px;
	}

	.mrt-list-row-title {
		font-size: 0.95rem;
	}

	.mrt-list-row-meta {
		font-size: 0.8rem;
	}
	
	.mrt-list-row .mrt-btn {
		padding: 6px 12px;
		font-size: 0.8rem;
	}
}

/* ═══════════════════════════════════════════
   PREMIUM UX - Course Dashboard (Pack UX-4)
   ═══════════════════════════════════════════ */

/* Filter Pills */
.mrt-filter-pills {
	display: flex;
	gap: 12px;
	margin-bottom: 24px;
	flex-wrap: wrap;
}
.mrt-filter-pill {
	background: #f1f5f9;
	color: #64748b;
	padding: 8px 16px;
	border-radius: 999px;
	font-size: 0.9rem;
	font-weight: 500;
	text-decoration: none;
	transition: all 0.2s ease;
	border: 1px solid transparent;
}
.mrt-filter-pill:hover {
	background: #e2e8f0;
	color: #334155;
}
.mrt-filter-pill.is-active {
	background: #fff;
	color: #2563eb;
	border-color: #2563eb;
	box-shadow: 0 2px 4px rgba(37,99,235,0.1);
}

/* KPI Strip */
.mrt-premium-course-kpi-strip {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 20px;
	margin-bottom: 30px;
}
.mrt-pc-kpi-card {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 16px;
	padding: 24px;
	text-align: center;
	box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.mrt-pc-kpi-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 15px -3px rgba(0,0,0,0.1);
}
.mrt-pc-kpi-val {
	font-size: 1.8rem;
	font-weight: 800;
	color: #1e293b;
	margin-bottom: 8px;
	line-height: 1;
}
.mrt-pc-kpi-label {
	font-size: 0.85rem;
	color: #64748b;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* Resume Banner */
.mrt-premium-resume-card {
	background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
	border-radius: 20px;
	padding: 32px 40px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	color: #fff;
	box-shadow: 0 10px 25px -5px rgba(15,23,42,0.4);
	position: relative;
	overflow: hidden;
}
.mrt-premium-resume-card::before {
	content: '';
	position: absolute;
	top: -50px;
	right: -50px;
	width: 200px;
	height: 200px;
	background: radial-gradient(circle, rgba(59,130,246,0.3) 0%, rgba(0,0,0,0) 70%);
	border-radius: 50%;
	pointer-events: none;
}
.mrt-prc-content {
	position: relative;
	z-index: 2;
}
.mrt-prc-label {
	font-size: 0.85rem;
	color: #94a3b8;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-bottom: 8px;
	font-weight: 600;
}
.mrt-prc-title {
	font-size: 1.5rem;
	font-weight: 700;
	margin: 0 0 8px;
	color: #f8fafc;
}
.mrt-prc-meta {
	font-size: 0.9rem;
	color: #cbd5e1;
}
.mrt-prc-actions {
	position: relative;
	z-index: 2;
	display: flex;
	gap: 16px;
	align-items: center;
}
.mrt-btn-ghost {
	background: transparent;
	color: #cbd5e1;
	border: 1px solid rgba(255,255,255,0.2);
}
.mrt-btn-ghost:hover {
	background: rgba(255,255,255,0.1);
	color: #fff;
}

@media (max-width: 768px) {
	.mrt-premium-resume-card {
		flex-direction: column;
		text-align: center;
		padding: 24px;
		gap: 24px;
	}
	.mrt-prc-actions {
		flex-direction: column;
		width: 100%;
	}
	.mrt-prc-actions .mrt-btn {
		width: 100%;
		justify-content: center;
	}
}

/* ═══════════════════════════════════════════
   PREMIUM UX - Global Header Link Fix
   ═══════════════════════════════════════════ */
/* Force SaaS-style header text to be visible on white background */
body #header .header_default, 
body #header .stm_lms_header, 
body header#masthead,
body .site-header {
    background-color: #ffffff !important;
}
body #header .header_default .header_main_menu_wrapper ul li a,
body #header .header_default .header_main_menu_wrapper ul li a *,
body #header .stm_lms_header ul li a,
body header#masthead .header_main_menu_wrapper ul li a,
body header#masthead .main-header-menu a,
body header#masthead a.menu-link,
body header#masthead .ast-builder-menu a,
body .site-header a.menu-link,
body .stm_header_links a,
body #header .header_default a {
    color: #334155 !important;
}
body #header .header_default .header_main_menu_wrapper ul li a:hover,
body #header .stm_lms_header ul li a:hover,
body header#masthead .header_main_menu_wrapper ul li a:hover,
body header#masthead .main-header-menu a:hover,
body header#masthead a.menu-link:hover,
body header#masthead .ast-builder-menu a:hover,
body .site-header a.menu-link:hover,
body .stm_header_links a:hover,
body #header .header_default a:hover {
    color: #2563eb !important;
}
