/*
 * ALC LMS Core App Layouts
 * Styles for structural, multi-role views, and child-safe modes.
 */

/* SPA Core Shell Layout */
/* SPA Core Shell Layout - Vertical Split */
.app-shell {
	display: flex;
	flex-direction: row; /* Layout side-by-side */
	min-height: 100vh;
	width: 100%;
}

/* Sidebar Menu on the Left */
.app-sidebar {
	width: 280px;
	background-color: var(--color-card-bg);
	border-right: 1px solid var(--color-border);
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	height: 100vh;
	position: sticky;
	top: 0;
	z-index: 100;
	padding: 40px 28px;
	flex-shrink: 0;
}

/* Brand Section inside Sidebar */
.brand-section {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 16px;
	margin-bottom: 40px;
}

/* Circle BRAND Buttons next to title */
.brand-circles {
	display: flex;
	gap: 6px;
}
.brand-circle {
	width: 14px;
	height: 14px;
	border-radius: var(--radius-round);
}
.brand-circle.red { background-color: var(--color-attention); }
.brand-circle.orange { background-color: var(--color-working); }
.brand-circle.green { background-color: var(--color-mastered); }
.brand-circle.blue { background-color: var(--color-brand-blue); }

.brand-title {
	font-size: 18px;
	font-weight: 800;
	color: var(--color-text-primary);
}

/* Vertical navigation tabs inside Sidebar */
.nav-tabs {
	display: flex;
	flex-direction: column;
	gap: 12px;
	flex-grow: 1;
	width: 100%;
}

.nav-tab {
	display: flex;
	align-items: center;
	font-family: var(--font-headers);
	font-weight: 600;
	font-size: 14px;
	color: var(--color-text-secondary);
	text-decoration: none;
	padding: 12px 20px;
	width: 100%;
	height: auto;
	border-radius: var(--radius-round);
	cursor: pointer;
	transition: all var(--transition-fast);
}
.nav-tab:hover {
	color: var(--color-text-primary);
	background-color: var(--color-bg);
}
.nav-tab.active {
	color: var(--color-brand-blue);
	background-color: #eff6ff;
	font-weight: 700;
}

/* Profile section at the bottom of the Sidebar */
.user-profile-badge {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 16px;
	border-top: 1px solid var(--color-border);
	padding-top: 24px;
	width: 100%;
}
.user-info {
	text-align: left;
}
.user-info .name {
	font-weight: 600;
	font-size: 14px;
	color: var(--color-text-primary);
}
.user-info .role {
	font-size: 12px;
	color: var(--color-text-secondary);
}

/* Main Viewport Container */
#main-view-viewport {
	flex: 1;
	padding: 40px;
	overflow-y: auto;
	height: 100vh;
	background-color: var(--color-bg);
}

.btn-logout {
	width: 100%;
	height: 40px;
	font-size: 13px;
	font-weight: 600;
	border-radius: var(--radius-round);
	background: #fff;
	border: 1px solid var(--color-border);
	color: var(--color-attention);
	cursor: pointer;
	transition: all var(--transition-fast);
}
.btn-logout:hover {
	background: var(--color-attention-light);
	border-color: var(--color-attention);
}

/* Main Dashboard Wrapper */
.dashboard-container {
	max-width: 1400px;
	width: 100%;
	margin: 0 auto;
	padding: 32px;
	display: flex;
	flex-direction: column;
	gap: 32px;
}

.dashboard-title-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.class-picker {
	padding: 8px 16px;
	border-radius: var(--radius-round);
	border: 1px solid var(--color-border);
	background: #ffffff;
	font-family: var(--font-headers);
	font-weight: 600;
	font-size: 14px;
	color: var(--color-text-secondary);
	outline: none;
	cursor: pointer;
}

/* Main Cards Grid */
.dashboard-grid-top {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 24px;
}

/* Double column layouts */
.dashboard-split-grid {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 24px;
}
@media (max-width: 1024px) {
	.dashboard-split-grid {
		grid-template-columns: 1fr;
	}
}

/* Quick Tools List */
.tools-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 16px;
}
.tool-card {
	background: #ffffff;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	padding: 24px 16px;
	text-align: center;
	cursor: pointer;
	transition: all var(--transition-normal);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}
.tool-card:hover {
	border-color: var(--color-brand-blue);
	box-shadow: var(--shadow-md);
	transform: translateY(-2px);
}
.tool-card .icon-holder {
	width: 44px;
	height: 44px;
	border-radius: var(--radius-round);
	background: var(--color-brand-blue-light);
	color: var(--color-brand-blue);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
}
.tool-card p {
	font-family: var(--font-headers);
	font-weight: 600;
	font-size: 14px;
	color: var(--color-text-primary);
}

/* Timetable schedule cards */
.schedule-list {
	display: flex;
	flex-direction: column;
	gap: 16px;
	max-height: 450px;
	overflow-y: auto;
	padding-right: 4px;
}
.schedule-item {
	background: #ffffff;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	padding: 16px 20px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	transition: all var(--transition-fast);
}
.schedule-item:hover {
	border-color: var(--color-brand-blue-light);
	background: #fafcfd;
}
.schedule-details h5 {
	font-size: 15px;
	margin-bottom: 4px;
}
.schedule-details p {
	font-size: 12px;
	color: var(--color-text-secondary);
}
.schedule-item .btn-join {
	height: 36px;
	padding: 0 16px;
	border-radius: var(--radius-md);
	font-size: 13px;
}

/* Student Proficiency Row matching image */
.proficiency-section {
	margin-top: 16px;
}
.proficiency-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.proficiency-item {
	background: #fafdf7; /* Default light green tint */
	border: 1px solid rgba(118, 200, 19, 0.15);
	border-radius: var(--radius-lg);
	padding: 16px 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}
.proficiency-item.working {
	background: #fffdf5;
	border-color: rgba(248, 150, 30, 0.15);
}
.proficiency-item.attention {
	background: #fef5f5;
	border-color: rgba(234, 53, 70, 0.15);
}

.student-info-col {
	display: flex;
	align-items: center;
	gap: 16px;
	width: 25%;
}
.student-avatar {
	width: 44px;
	height: 44px;
	border-radius: var(--radius-round);
	background: var(--color-border);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	color: var(--color-text-secondary);
}
.student-meta h5 {
	font-size: 15px;
	margin-bottom: 2px;
}
.student-meta p {
	font-size: 12px;
	color: var(--color-text-secondary);
}

.student-work-col {
	text-align: center;
	width: 15%;
}
.student-work-col p {
	font-size: 12px;
	color: var(--color-text-secondary);
	text-transform: uppercase;
	font-weight: 700;
	letter-spacing: 0.5px;
}
.student-work-col h6 {
	font-size: 18px;
	font-family: var(--font-headers);
}

.student-progress-col {
	width: 35%;
	display: flex;
	align-items: center;
	gap: 12px;
}
.progress-bar-bg {
	flex-grow: 1;
	height: 8px;
	background: var(--color-border);
	border-radius: var(--radius-round);
	overflow: hidden;
}
.progress-bar-fill {
	height: 100%;
	border-radius: var(--radius-round);
}
.progress-bar-fill.green { background-color: var(--color-mastered); }
.progress-bar-fill.orange { background-color: var(--color-working); }
.progress-bar-fill.red { background-color: var(--color-attention); }

.progress-text {
	font-family: var(--font-headers);
	font-weight: 800;
	font-size: 15px;
	min-width: 40px;
}

.student-status-col {
	display: flex;
	gap: 8px;
	width: 15%;
}
.mini-badge {
	width: 28px;
	height: 28px;
	border-radius: var(--radius-round);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
	font-weight: 700;
	color: #ffffff;
	box-shadow: var(--shadow-sm);
}
.mini-badge.red { background-color: var(--color-attention); }
.mini-badge.orange { background-color: var(--color-working); }
.mini-badge.green { background-color: var(--color-mastered); }

.student-action-col {
	width: 10%;
	text-align: right;
}
.student-action-col .btn-msg {
	height: 36px;
	font-size: 13px;
	padding: 0 16px;
}

/* ==========================================================================
   ROLE/TIER SPECIFIC STYLES
   ========================================================================== */

/* 1. EARLY YEARS (Ages 3-5) Play-based layout */
.early-years-dashboard {
	background: linear-gradient(135deg, #fffbeb 0%, #fff7ed 100%);
	min-height: calc(100vh - 70px);
	padding: 32px;
}

.ey-title {
	text-align: center;
	font-size: 32px;
	color: var(--color-working-dark);
	margin-bottom: 24px;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ey-timeline-scroll {
	display: flex;
	gap: 24px;
	overflow-x: auto;
	padding: 20px 4px;
	scroll-snap-type: x mandatory;
}

.ey-card {
	flex: 0 0 300px;
	scroll-snap-align: start;
	background: #ffffff;
	border: 6px solid var(--color-border);
	border-radius: var(--radius-xl);
	padding: 24px;
	text-align: center;
	box-shadow: var(--shadow-lg);
	cursor: pointer;
	transition: all var(--transition-slow);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
}
.ey-card:hover {
	transform: scale(1.05) rotate(1deg);
	border-color: var(--color-working);
	box-shadow: var(--shadow-xl);
}
.ey-card .ey-icon {
	font-size: 72px;
	margin-bottom: 8px;
	animation: floatReward 4s ease-in-out infinite;
}
.ey-card h3 {
	font-size: 22px;
	color: var(--color-text-primary);
}
.ey-card .ey-time {
	background: var(--color-working-light);
	color: var(--color-working-dark);
	padding: 6px 16px;
	border-radius: var(--radius-round);
	font-weight: 700;
	font-size: 14px;
}

/* Scribble Drawing Tool Widget */
.drawing-widget {
	border: 3px dashed var(--color-border);
	border-radius: var(--radius-lg);
	background: #ffffff;
	padding: 16px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
}
.ey-canvas {
	background: #fafcfd;
	border: 2px solid var(--color-border);
	border-radius: var(--radius-md);
	cursor: crosshair;
	touch-action: none;
}
.drawing-controls {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
	justify-content: center;
}
.color-swatch {
	width: 40px;
	height: 40px;
	border-radius: var(--radius-round);
	cursor: pointer;
	border: 3px solid #ffffff;
	box-shadow: var(--shadow-sm);
	transition: transform var(--transition-fast);
}
.color-swatch:hover, .color-swatch.active {
	transform: scale(1.15);
	box-shadow: 0 0 0 3px var(--color-brand-blue);
}

/* Large voice recording circle button */
.voice-recorder-circle {
	width: 120px;
	height: 120px;
	border-radius: var(--radius-round);
	background: var(--color-attention-light);
	border: 6px solid var(--color-attention);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 40px;
	cursor: pointer;
	transition: all var(--transition-slow);
	box-shadow: var(--shadow-lg);
	animation: pulseNormal 2s infinite;
}
.voice-recorder-circle.recording {
	background: var(--color-attention);
	color: #ffffff;
	animation: pulseRecording 1s infinite;
	border-color: #ffffff;
}
@keyframes pulseNormal {
	0% { box-shadow: 0 0 0 0 rgba(234, 53, 70, 0.4); }
	70% { box-shadow: 0 0 0 15px rgba(234, 53, 70, 0); }
	100% { box-shadow: 0 0 0 0 rgba(234, 53, 70, 0); }
}
@keyframes pulseRecording {
	0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(234, 53, 70, 0.7); }
	70% { transform: scale(1.05); box-shadow: 0 0 0 20px rgba(234, 53, 70, 0); }
	100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(234, 53, 70, 0); }
}

/* Sound play card */
.sound-instruction-btn {
	background: var(--color-brand-blue-light);
	color: var(--color-brand-blue);
	border-radius: var(--radius-round);
	padding: 8px 24px;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	border: 2px solid var(--color-brand-blue);
	display: inline-flex;
	align-items: center;
	gap: 8px;
	animation: floatReward 3s ease-in-out infinite;
}

/* Parent Lock prompt */
.parent-lock-modal {
	max-width: 400px;
}
.parent-lock-input {
	font-size: 24px;
	text-align: center;
	letter-spacing: 12px;
	height: 56px;
}

/* 2. PRIMARY (Ages 6-11) Structured/Gamified layout */
.primary-rewards-panel {
	background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
	border-radius: var(--radius-lg);
	padding: 24px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}
.badge-case {
	display: flex;
	gap: 16px;
}
.badge-slot {
	width: 60px;
	height: 60px;
	border-radius: var(--radius-round);
	background: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28px;
	box-shadow: var(--shadow-sm);
	position: relative;
}
.badge-slot.empty {
	background: rgba(255, 255, 255, 0.4);
	border: 2px dashed var(--color-text-muted);
}

/* 3. SECONDARY (Ages 12-16) Academic dashboard */
.essay-dropzone {
	border: 2px dashed var(--color-brand-blue);
	border-radius: var(--radius-lg);
	background: var(--color-brand-blue-light);
	padding: 32px;
	text-align: center;
	cursor: pointer;
	transition: background var(--transition-fast);
}
.essay-dropzone:hover {
	background: #dbeafe;
}

/* SVG Grade progression graphs */
.svg-graph-container {
	width: 100%;
	height: 200px;
	background: #ffffff;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	padding: 16px;
}

/* 4. TEACHER VIEW Grading panels */
.grading-panel {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 24px;
}
@media (max-width: 768px) {
	.grading-panel {
		grid-template-columns: 1fr;
	}
}

/* 5. AUTHENTICATION SCREENS (PIN Circular Numpad) */
.auth-container {
	max-width: 440px;
	width: 100%;
	margin: 80px auto;
	padding: 24px;
}
.auth-logo-box {
	text-align: center;
	margin-bottom: 32px;
}
.pin-numpad {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	max-width: 280px;
	margin: 24px auto 0;
}
.pin-btn {
	width: 70px;
	height: 70px;
	border-radius: var(--radius-round);
	border: 2px solid var(--color-border);
	background: #ffffff;
	font-size: 24px;
	font-family: var(--font-headers);
	font-weight: 700;
	color: var(--color-text-primary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--shadow-sm);
	transition: all var(--transition-fast);
}
.pin-btn:hover {
	background: var(--color-brand-blue-light);
	border-color: var(--color-brand-blue);
	color: var(--color-brand-blue);
	transform: scale(1.05);
}
.pin-btn:active {
	transform: scale(0.95);
}

.pin-display {
	display: flex;
	justify-content: center;
	gap: 16px;
	margin: 24px 0;
}
.pin-dot {
	width: 18px;
	height: 18px;
	border-radius: var(--radius-round);
	border: 2px solid var(--color-text-secondary);
	transition: background var(--transition-fast);
}
.pin-dot.filled {
	background: var(--color-brand-blue);
	border-color: var(--color-brand-blue);
}

/* Confetti Container */
#confetti-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	pointer-events: none;
	z-index: 9999;
	overflow: hidden;
}
.confetti-piece {
	position: absolute;
	width: 12px;
	height: 12px;
	background: #ffd700;
	animation: fallConfetti 4s linear forwards;
}
@keyframes fallConfetti {
	0% { transform: translateY(-50px) rotate(0deg); opacity: 1; }
	100% { transform: translateY(105vh) rotate(720deg); opacity: 0; }
}

/* Sticker rewards box */
.sticker-book {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
	gap: 16px;
	margin-top: 16px;
}
.sticker-item {
	border: 2px solid var(--color-border);
	border-radius: var(--radius-md);
	background: #ffffff;
	padding: 12px;
	text-align: center;
	transition: transform var(--transition-slow);
}
.sticker-item:hover {
	transform: scale(1.2) rotate(-5deg);
	border-color: var(--color-working);
}
.sticker-item .sticker-icon {
	font-size: 36px;
}

/* Message timeline styling */
.messages-box {
	height: 350px;
	overflow-y: auto;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	padding: 16px;
	background: #ffffff;
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 16px;
}
.message-bubble {
	max-width: 70%;
	padding: 12px 16px;
	border-radius: var(--radius-md);
	font-size: 14px;
	line-height: 1.4;
}
.message-bubble.sent {
	background: var(--color-brand-blue);
	color: #ffffff;
	align-self: flex-end;
	border-bottom-right-radius: 2px;
}
.message-bubble.received {
	background: var(--color-bg);
	color: var(--color-text-primary);
	align-self: flex-start;
	border-bottom-left-radius: 2px;
}
.message-meta {
	font-size: 10px;
	margin-top: 4px;
	opacity: 0.8;
}

/* Initial Fullscreen Loader */
.initial-loading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100vh;
	background-color: var(--color-bg);
	gap: 16px;
}
.loader-spinner {
	width: 48px;
	height: 48px;
	border: 5px solid var(--color-border);
	border-top-color: var(--color-brand-blue);
	border-radius: var(--radius-round);
	animation: spinLoader 1s linear infinite;
}
@keyframes spinLoader {
	to { transform: rotate(360deg); }
}
