/* MindSpark Daily Learning - Frontend Styles */

.mindspark-app {
	display: flex;
	min-height: 100vh;
	background: #f8f9fc;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
	color: #2d3748;
	line-height: 1.6;
}

/* Sidebar */
.mindspark-sidebar {
	width: 260px;
	flex-shrink: 0;
	background: #fff;
	border-right: 1px solid #e2e8f0;
	padding: 24px;
	display: flex;
	flex-direction: column;
	position: fixed;
	top: 72px; /* Position below fixed header */
	height: calc(100vh - 72px);
	z-index: 10;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: #cbd5e0 transparent;
}

.mindspark-sidebar::-webkit-scrollbar {
	width: 6px;
}

.mindspark-sidebar::-webkit-scrollbar-track {
	background: transparent;
}

.mindspark-sidebar::-webkit-scrollbar-thumb {
	background-color: #cbd5e0;
	border-radius: 3px;
}

/* Adjust fixed top position and height when WordPress admin bar is visible */
.admin-bar .mindspark-sidebar {
	top: 104px; /* 72px header + 32px admin bar */
	height: calc(100vh - 104px);
}

@media (max-width: 782px) {
	.admin-bar .mindspark-sidebar {
		top: 118px; /* 72px header + 46px admin bar */
		height: calc(100vh - 118px);
	}
}

.mindspark-brand {
	font-size: 22px;
	font-weight: 800;
	color: #2b6cb0;
	margin-bottom: 32px;
	letter-spacing: -0.5px;
}

.mindspark-nav a {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	border-radius: 12px;
	color: #4a5568;
	text-decoration: none;
	font-weight: 500;
	transition: all 0.2s;
	margin-bottom: 4px;
	position: relative;
}

.mindspark-nav a:hover,
.mindspark-nav a.active {
	background: #edf2f7;
	color: #2b6cb0;
}

.mindspark-badge {
	background: #fc8181;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 7px;
	border-radius: 10px;
	margin-left: auto;
}

.mindspark-sidebar-footer {
	margin-top: auto;
	padding-top: 24px;
	border-top: 1px solid #e2e8f0;
}

.mindspark-streak,
.mindspark-bloom {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

.mindspark-streak-count,
.mindspark-bloom-count {
	font-size: 20px;
	font-weight: 700;
}

.mindspark-sidebar-footer small {
	color: #a0aec0;
	font-size: 12px;
}

/* Main Content */
.mindspark-main {
	flex: 1;
	margin-left: 260px; /* Offset the fixed sidebar */
	padding: 32px 40px;
	max-width: 900px;
}

.mindspark-header {
	margin-bottom: 28px;
}

.mindspark-header h1 {
	font-size: 28px;
	font-weight: 800;
	margin: 0 0 6px;
	color: #1a202c;
}

.mindspark-tagline {
	color: #718096;
	font-size: 15px;
	margin: 0;
}

.mindspark-back {
	display: inline-block;
	color: #718096;
	text-decoration: none;
	font-size: 14px;
	margin-bottom: 12px;
	transition: color 0.2s;
}

.mindspark-back:hover {
	color: #2b6cb0;
}

.mindspark-trail-badge {
	display: inline-block;
	background: #e6fffa;
	color: #319795;
	font-size: 12px;
	font-weight: 600;
	padding: 4px 12px;
	border-radius: 20px;
	margin-bottom: 8px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

/* Cards */
.mindspark-dashboard-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
}

.mindspark-card {
	background: #fff;
	border-radius: 16px;
	padding: 24px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.04);
	border: 1px solid #edf2f7;
}

.mindspark-card h2 {
	font-size: 16px;
	font-weight: 700;
	margin: 0 0 16px;
	color: #2d3748;
}

.mindspark-card-featured {
	grid-column: 1 / -1;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	color: #fff;
	border: none;
}

.mindspark-card-featured h2,
.mindspark-card-featured p {
	color: #fff;
}

.mindspark-card-wide {
	grid-column: 1 / -1;
}

/* Spark Preview */
.mindspark-spark-preview h3 {
	font-size: 20px;
	margin: 0 0 8px;
}

.mindspark-spark-preview p {
	opacity: 0.9;
	margin: 0 0 16px;
}

.mindspark-daily-limit {
	margin-top: 16px;
	font-size: 13px;
	opacity: 0.8;
}

/* Buttons */
.mindspark-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 20px;
	border-radius: 10px;
	font-size: 14px;
	font-weight: 600;
	border: none;
	cursor: pointer;
	text-decoration: none;
	transition: all 0.2s;
}

.mindspark-btn-primary {
	background: #fff;
	color: #667eea;
}

.mindspark-btn-primary:hover {
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.mindspark-btn-secondary {
	background: #48bb78;
	color: #fff;
}

.mindspark-btn-secondary:hover {
	background: #38a169;
}

.mindspark-btn-outline {
	background: transparent;
	color: #4a5568;
	border: 1.5px solid #e2e8f0;
}

.mindspark-btn-outline:hover {
	border-color: #a0aec0;
}

.mindspark-btn-small {
	padding: 6px 14px;
	font-size: 13px;
}

.mindspark-btn-disabled {
	background: rgba(255,255,255,0.3);
	color: #fff;
	cursor: not-allowed;
}

/* Progress Bars */
.mindspark-progress-bar {
	background: #edf2f7;
	border-radius: 10px;
	height: 8px;
	overflow: hidden;
	margin: 8px 0;
}

.mindspark-progress-fill {
	background: #48bb78;
	height: 100%;
	border-radius: 10px;
	transition: width 0.5s ease;
}

.mindspark-progress-bar-large {
	height: 12px;
}

.mindspark-progress-label {
	font-size: 13px;
	color: #718096;
}

/* Lists */
.mindspark-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.mindspark-list li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 0;
	border-bottom: 1px solid #f7fafc;
}

.mindspark-list li:last-child {
	border-bottom: none;
}

.mindspark-list a {
	color: #2d3748;
	text-decoration: none;
	font-weight: 500;
}

.mindspark-list a:hover {
	color: #2b6cb0;
}

.mindspark-list small {
	color: #a0aec0;
	font-size: 12px;
}

.mindspark-empty {
	color: #a0aec0;
	font-style: italic;
}

.mindspark-link {
	color: #667eea;
	font-size: 13px;
	text-decoration: none;
	font-weight: 600;
}

/* Trails Grid */
.mindspark-trails-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 16px;
	margin-top: 12px;
}

.mindspark-trail-mini {
	background: #f7fafc;
	padding: 14px;
	border-radius: 12px;
}

.mindspark-trail-name {
	font-size: 13px;
	font-weight: 600;
	color: #4a5568;
	display: block;
	margin-bottom: 6px;
}

.mindspark-progress-text {
	font-size: 12px;
	color: #718096;
}

/* Trail Cards */
.mindspark-trails-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px;
}

.mindspark-trail-card {
	border-radius: 16px;
	padding: 28px;
	color: #fff;
	text-decoration: none;
	transition: transform 0.2s, box-shadow 0.2s;
	position: relative;
	overflow: hidden;
}

.mindspark-trail-card::before {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.05);
}

.mindspark-trail-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 12px 24px rgba(0,0,0,0.12);
}

.mindspark-trail-card h3 {
	font-size: 20px;
	font-weight: 700;
	margin: 0 0 16px;
	position: relative;
}

.mindspark-trail-card .mindspark-progress-bar {
	background: rgba(255,255,255,0.3);
	position: relative;
}

.mindspark-trail-card .mindspark-progress-fill {
	background: #fff;
}

.mindspark-trail-stats {
	font-size: 13px;
	opacity: 0.9;
	position: relative;
}

/* Sparks List */
.mindspark-sparks-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.mindspark-spark-item {
	display: flex;
	align-items: center;
	gap: 16px;
	background: #fff;
	padding: 18px 22px;
	border-radius: 14px;
	border: 1.5px solid #edf2f7;
	transition: border-color 0.2s;
}

.mindspark-spark-item:hover {
	border-color: #cbd5e0;
}

.mindspark-spark-item.mastered {
	border-color: #9ae6b4;
	background: #f0fff4;
}

.mindspark-spark-number {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #edf2f7;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 14px;
	color: #4a5568;
	flex-shrink: 0;
}

.mindspark-spark-item.mastered .mindspark-spark-number {
	background: #48bb78;
	color: #fff;
}

.mindspark-spark-item.ready {
	border-color: #c3dafe;
	background: #eef2ff;
}

.mindspark-spark-item.ready .mindspark-spark-number {
	background: #667eea;
	color: #fff;
}

.mindspark-spark-item.locked {
	opacity: 0.65;
}

.mindspark-spark-info {
	flex: 1;
}

.mindspark-spark-info h4 {
	margin: 0 0 4px;
	font-size: 15px;
	color: #2d3748;
}

.mindspark-spark-status {
	font-size: 12px;
	color: #718096;
}

/* Lesson Page */
.mindspark-lesson {
	background: #fff;
	border-radius: 16px;
	padding: 32px;
	border: 1px solid #edf2f7;
}

.mindspark-lesson-content {
	margin-bottom: 32px;
}

.mindspark-tts-btn {
	background: #edf2f7;
	border: none;
	padding: 8px 16px;
	border-radius: 8px;
	font-size: 13px;
	cursor: pointer;
	margin-bottom: 16px;
	transition: background 0.2s;
}

.mindspark-tts-btn:hover {
	background: #e2e8f0;
}

.mindspark-tts-btn.active {
	background: #2b6cb0;
	color: #fff;
}

.mindspark-speed-controls {
	display: flex;
	gap: 6px;
	align-items: center;
}

.mindspark-speed-controls button {
	background: #edf2f7;
	border: none;
	padding: 4px 10px;
	border-radius: 6px;
	font-size: 12px;
	cursor: pointer;
}

.mindspark-speed-controls button.active {
	background: #2b6cb0;
	color: #fff;
}

.mindspark-lesson-body {
	font-size: 16px;
	line-height: 1.8;
	color: #4a5568;
}

.mindspark-lesson-body p {
	margin-bottom: 16px;
}

.mindspark-highlight {
	background: #fef3c7;
	transition: background 0.2s;
}

.mindspark-insight {
	background: #fffbeb;
	border-left: 4px solid #f59e0b;
	padding: 16px 20px;
	border-radius: 0 12px 12px 0;
	margin-top: 24px;
}

.mindspark-insight strong {
	color: #92400e;
	display: block;
	margin-bottom: 4px;
}

.mindspark-insight p {
	margin: 0;
	color: #78350f;
}

/* Quiz */
.mindspark-quiz {
	border-top: 2px solid #edf2f7;
	padding-top: 24px;
}

.mindspark-quiz h3 {
	margin: 0 0 20px;
	font-size: 18px;
}

.mindspark-quiz-question {
	margin-bottom: 24px;
}

.mindspark-question-text {
	font-weight: 600;
	margin: 0 0 12px;
	color: #2d3748;
}

.mindspark-options {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.mindspark-option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	background: #f7fafc;
	border-radius: 10px;
	cursor: pointer;
	transition: all 0.2s;
	border: 2px solid transparent;
}

.mindspark-option:hover {
	background: #edf2f7;
}

.mindspark-option input {
	margin: 0;
	accent-color: #667eea;
}

.mindspark-option.correct {
	background: #c6f6d5;
	border-color: #48bb78;
}

.mindspark-option.incorrect {
	background: #fed7d7;
	border-color: #fc8181;
}

.mindspark-quiz-results {
	margin-top: 20px;
	padding: 20px;
	border-radius: 12px;
	background: #f0fff4;
	border: 1px solid #9ae6b4;
}

.mindspark-quiz-results.fail {
	background: #fff5f5;
	border-color: #fc8181;
}

/* Review */
.mindspark-review-list {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.mindspark-review-card {
	background: #fff;
	border-radius: 16px;
	padding: 24px;
	border: 1px solid #edf2f7;
}

.mindspark-review-card h3 {
	margin: 0 0 8px;
	font-size: 18px;
}

.mindspark-review-insight {
	color: #718096;
	font-style: italic;
	margin: 0 0 16px;
}

.mindspark-review-actions {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.mindspark-empty-state {
	text-align: center;
	padding: 60px 20px;
	color: #718096;
}

.mindspark-empty-state p {
	font-size: 18px;
	margin: 0;
}

/* Mobile */
@media (max-width: 768px) {
	.mindspark-sidebar {
		width: 100%;
		position: relative;
		height: auto;
		border-right: none;
		border-bottom: 1px solid #e2e8f0;
		padding: 16px;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
	}

	.mindspark-brand {
		margin-bottom: 0;
		margin-right: auto;
	}

	.mindspark-nav {
		display: flex;
		gap: 8px;
		width: 100%;
		margin-top: 12px;
		order: 3;
	}

	.mindspark-nav a {
		flex: 1;
		justify-content: center;
		margin-bottom: 0;
		padding: 10px;
		font-size: 13px;
	}

	.mindspark-sidebar-footer {
		display: flex;
		gap: 16px;
		margin-top: 0;
		padding-top: 0;
		border-top: none;
		order: 2;
	}

	.mindspark-streak,
	.mindspark-bloom {
		margin-bottom: 0;
	}

	.mindspark-main {
		margin-left: 0;
		padding: 20px;
	}

	.mindspark-dashboard-grid {
		grid-template-columns: 1fr;
	}

	.mindspark-trails-cards {
		grid-template-columns: 1fr;
	}

	.mindspark-lesson {
		padding: 20px;
	}
}

/* ========== AUTO-GENERATION STATES ========== */
.mindspark-auto-gen-state {
	text-align: center;
	padding: 48px 24px;
	color: #fff;
}

.mindspark-auto-gen-state h3 {
	font-size: 20px;
	font-weight: 700;
	margin: 16px 0 8px;
}

.mindspark-auto-gen-state p {
	font-size: 14px;
	opacity: 0.85;
	margin: 0;
}

.mindspark-auto-gen-spinner {
	width: 48px;
	height: 48px;
	border: 4px solid rgba(255,255,255,0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: mindspark-spin 1s linear infinite;
	margin: 0 auto;
}

@keyframes mindspark-spin {
	 to { transform: rotate(360deg); }
}

.mindspark-card-featured .mindspark-auto-gen-spinner {
	border-color: rgba(255,255,255,0.3);
	border-top-color: #fff;
}

.mindspark-card-featured .mindspark-auto-gen-state {
	color: #fff;
}

.mindspark-sparks-list .mindspark-auto-gen-state {
	background: #f7fafc;
	border-radius: 16px;
	color: #4a5568;
	border: 2px dashed #cbd5e0;
}

.mindspark-sparks-list .mindspark-auto-gen-spinner {
	border-color: #e2e8f0;
	border-top-color: #667eea;
}

.mindspark-sparks-list .mindspark-auto-gen-state h3 {
	color: #2d3748;
}

.mindspark-auto-gen-done {
	animation: mindspark-fade-in 0.5s ease;
}

@keyframes mindspark-fade-in {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Prevent fixed sidebar from overlapping the theme's footer */
.ms-site-footer {
	position: relative;
	z-index: 100;
}
