/**
 * EduCrystal Assessment Engine - Exam Interface Styles
 *
 * @package EduCrystal_Assessment_Engine
 */

:root {
	--ec-exam-primary: #2563eb;
	--ec-exam-primary-hover: #1d4ed8;
	--ec-exam-bg: #f8fafc;
	--ec-exam-surface: #ffffff;
	--ec-exam-border: #e2e8f0;
	--ec-exam-text: #0f172a;
	--ec-exam-text-muted: #64748b;
	--ec-exam-success: #10b981;
	--ec-exam-warning: #f59e0b;
	--ec-exam-danger: #ef4444;
	--ec-exam-purple: #8b5cf6;
	--ec-exam-radius: 10px;
	--ec-exam-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

.ec-exam-body-locked {
	overflow: hidden;
	user-select: none;
	-webkit-user-select: none;
}

/* Main Container */
.ec-exam-container {
	max-width: 1440px;
	margin: 0 auto;
	padding: 16px;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: var(--ec-exam-text);
	background: var(--ec-exam-bg);
	min-height: 100vh;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
}

/* Header Bar */
.ec-exam-header {
	background: var(--ec-exam-surface);
	border: 1px solid var(--ec-exam-border);
	border-radius: var(--ec-exam-radius);
	padding: 16px 24px;
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20px;
	box-shadow: var(--ec-exam-shadow);
	flex-wrap: wrap;
	gap: 16px;
}

.ec-exam-title-box {
	display: flex;
	align-items: center;
	gap: 12px;
}

.ec-exam-title {
	font-size: 18px;
	font-weight: 700;
	margin: 0;
	color: #0f172a;
}

.ec-exam-badge-meta {
	display: inline-block;
	background: #eff6ff;
	color: #1e40af;
	font-size: 12px;
	font-weight: 600;
	padding: 3px 10px;
	border-radius: 20px;
}

/* Timer */
.ec-timer-box {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #f1f5f9;
	padding: 8px 16px;
	border-radius: 30px;
	font-weight: 700;
	font-size: 16px;
	color: #1e293b;
	border: 1px solid #cbd5e1;
}

.ec-timer-icon {
	font-size: 18px;
}

.ec-timer-warning {
	background: #fef3c7;
	color: #b45309;
	border-color: #fde68a;
}

.ec-timer-danger {
	background: #fee2e2;
	color: #b91c1c;
	border-color: #fca5a5;
	animation: ec-pulse 1s infinite alternate;
}

@keyframes ec-pulse {
	0% { transform: scale(1); }
	100% { transform: scale(1.04); }
}

/* Layout Grid */
.ec-exam-grid {
	display: grid;
	grid-template-columns: 1fr 265px;
	gap: 18px;
	flex: 1;
	align-items: start;
}

/* Question Panel */
.ec-question-panel {
	background: var(--ec-exam-surface);
	border: 1px solid var(--ec-exam-border);
	border-radius: var(--ec-exam-radius);
	padding: 28px;
	box-shadow: var(--ec-exam-shadow);
	display: flex;
	flex-direction: column;
	min-height: 520px;
}

.ec-question-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--ec-exam-border);
	margin-bottom: 24px;
}

.ec-q-number {
	font-size: 16px;
	font-weight: 700;
	color: var(--ec-exam-primary);
}

.ec-q-marks-badge {
	font-size: 12px;
	font-weight: 600;
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	padding: 4px 10px;
	border-radius: 6px;
	color: #475569;
}

.ec-question-content {
	font-size: 16px;
	line-height: 1.6;
	color: #1e293b;
	margin-bottom: 28px;
	flex: 1;
}

.ec-question-content img {
	max-width: 100%;
	height: auto;
	border-radius: 8px;
	margin: 12px 0;
}

/* Options */
.ec-options-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 32px;
}

.ec-option-item {
	display: flex;
	align-items: flex-start;
	padding: 14px 18px;
	border: 1.5px solid var(--ec-exam-border);
	border-radius: 8px;
	background: #ffffff;
	cursor: pointer;
	transition: all 0.2s ease;
}

.ec-option-item:hover {
	border-color: #93c5fd;
	background: #f8faff;
}

.ec-option-item.ec-option-selected {
	border-color: var(--ec-exam-primary);
	background: #eff6ff;
	box-shadow: 0 0 0 1px var(--ec-exam-primary);
}

.ec-option-input {
	margin-top: 3px;
	margin-right: 14px;
	cursor: pointer;
}

.ec-option-letter {
	font-weight: 700;
	margin-right: 10px;
	color: var(--ec-exam-text-muted);
}

.ec-option-text {
	font-size: 15px;
	color: #1e293b;
	flex: 1;
	line-height: 1.5;
}

/* Direct Input */
.ec-direct-input {
	width: 100%;
	padding: 12px 16px;
	border: 1.5px solid var(--ec-exam-border);
	border-radius: 8px;
	font-size: 15px;
}

.ec-direct-input:focus {
	border-color: var(--ec-exam-primary);
	outline: none;
	box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Question Action Buttons */
.ec-question-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-top: 20px;
	border-top: 1px solid var(--ec-exam-border);
	flex-wrap: wrap;
	gap: 12px;
}

.ec-action-group-left, .ec-action-group-right {
	display: flex;
	gap: 10px;
}

.ec-btn {
	padding: 10px 18px;
	border-radius: 6px;
	font-weight: 600;
	font-size: 14px;
	cursor: pointer;
	transition: all 0.2s ease;
	border: 1px solid transparent;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	text-decoration: none;
}

.ec-btn-primary {
	background: var(--ec-exam-primary);
	color: #ffffff;
}

.ec-btn-primary:hover {
	background: var(--ec-exam-primary-hover);
}

.ec-btn-secondary {
	background: #ffffff;
	border-color: #cbd5e1;
	color: #334155;
}

.ec-btn-secondary:hover {
	background: #f1f5f9;
}

.ec-btn-purple {
	background: #f5f3ff;
	border-color: #ddd6fe;
	color: #6d28d9;
}

.ec-btn-purple:hover {
	background: #ede9fe;
}

.ec-btn-danger {
	background: var(--ec-exam-danger);
	color: #ffffff;
}

.ec-btn-danger:hover {
	background: #dc2626;
}

/* Sidebar / Palette */
.ec-palette-panel {
	background: var(--ec-exam-surface);
	border: 1px solid var(--ec-exam-border);
	border-radius: var(--ec-exam-radius);
	padding: 14px 12px;
	box-shadow: var(--ec-exam-shadow);
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.ec-palette-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid var(--ec-exam-border);
	padding-bottom: 10px;
}

.ec-palette-title {
	font-size: 14px;
	font-weight: 700;
	margin: 0;
	color: #0f172a;
}

.ec-palette-total-badge {
	font-size: 11px;
	font-weight: 700;
	background: #eff6ff;
	color: #2563eb;
	padding: 3px 8px;
	border-radius: 20px;
	border: 1px solid #bfdbfe;
}

/* Legend */
.ec-palette-legend {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
	font-size: 11px;
	color: #334155;
	background: #f8fafc;
	padding: 8px 10px;
	border-radius: 6px;
	border: 1px solid #e2e8f0;
}

.ec-legend-item {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 500;
	white-space: nowrap;
}

.ec-dot {
	width: 10px;
	height: 10px;
	border-radius: 3px;
	display: inline-block;
	flex-shrink: 0;
}

.ec-dot-answered {
	background: #16a34a;
	border: 1px solid #15803d;
}

.ec-dot-unanswered {
	background: #dc2626;
	border: 1px solid #b91c1c;
}

.ec-dot-review {
	background: #8b5cf6;
	border: 1px solid #7c3aed;
}

.ec-dot-unvisited {
	background: #f1f5f9;
	border: 1.5px solid #cbd5e1;
}

/* Grid Buttons */
.ec-palette-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 6px;
	max-height: 220px;
	overflow-y: auto;
	padding: 4px 2px;
}

.ec-pal-btn {
	width: 100%;
	aspect-ratio: 1;
	max-width: 42px;
	max-height: 42px;
	margin: 0 auto;
	border-radius: 6px;
	border: 1.5px solid #cbd5e1;
	background: #f1f5f9;
	color: #334155;
	font-weight: 700;
	font-size: 12px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s ease;
	user-select: none;
	padding: 0;
}

.ec-pal-btn:hover {
	transform: scale(1.08);
	box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 1. Answered: Solid Green */
.ec-pal-btn.ec-state-answered {
	background: #16a34a !important;
	color: #ffffff !important;
	border-color: #15803d !important;
}

/* 2. Not Answered: Solid Red */
.ec-pal-btn.ec-state-unanswered {
	background: #dc2626 !important;
	color: #ffffff !important;
	border-color: #b91c1c !important;
}

/* 3. Review: Solid Purple */
.ec-pal-btn.ec-state-review {
	background: #8b5cf6 !important;
	color: #ffffff !important;
	border-color: #7c3aed !important;
}

/* 4. Not Visited: Neutral Gray */
.ec-pal-btn.ec-state-unvisited {
	background: #f1f5f9 !important;
	color: #475569 !important;
	border-color: #cbd5e1 !important;
}

/* 5. Active / Current Question: Highlighted with blue ring */
.ec-pal-btn.ec-state-active {
	box-shadow: 0 0 0 2.5px #2563eb !important;
	outline: 1.5px solid #ffffff;
	outline-offset: -1.5px;
	transform: scale(1.08);
	z-index: 2;
}

.ec-submit-panel-btn {
	width: 100%;
	padding: 11px 14px;
	font-size: 14px;
	justify-content: center;
	border-radius: 6px;
}

/* Watermark */
.ec-watermark {
	position: fixed;
	bottom: 10px;
	right: 15px;
	opacity: 0.15;
	font-size: 13px;
	pointer-events: none;
	user-select: none;
	z-index: 9999;
	color: #000;
}

/* Modal */
.ec-exam-modal {
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(15, 23, 42, 0.7);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	backdrop-filter: blur(4px);
}

.ec-exam-modal-card {
	background: #ffffff;
	border-radius: 12px;
	max-width: 480px;
	width: 90%;
	padding: 30px;
	box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
	text-align: center;
}

.ec-exam-modal-icon {
	font-size: 48px;
	margin-bottom: 16px;
}

.ec-exam-modal-title {
	font-size: 20px;
	font-weight: 700;
	margin: 0 0 12px 0;
}

.ec-exam-modal-desc {
	font-size: 14px;
	color: #64748b;
	margin-bottom: 24px;
	line-height: 1.5;
}

.ec-exam-modal-stats {
	background: #f8fafc;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 14px;
	display: flex;
	justify-content: space-around;
	margin-bottom: 24px;
}

.ec-modal-stat-item strong {
	display: block;
	font-size: 18px;
	color: #0f172a;
}

.ec-modal-stat-item span {
	font-size: 12px;
	color: #64748b;
}

.ec-exam-modal-actions {
	display: flex;
	gap: 12px;
	justify-content: center;
}

/* =============================================================================
   RESPONSIVE DESIGN: TABLET & MOBILE
   ============================================================================= */

/* Tablet (<= 992px) */
@media (max-width: 992px) {
	.ec-exam-grid {
		grid-template-columns: 1fr 230px;
		gap: 14px;
	}
	.ec-question-panel {
		padding: 20px 22px;
		min-height: 440px;
	}
	.ec-palette-panel {
		padding: 12px 10px;
	}
	.ec-pal-btn {
		max-width: 38px;
		max-height: 38px;
		font-size: 11px;
	}
}

/* Mobile (<= 768px) */
@media (max-width: 768px) {
	.ec-site-wrapper {
		padding: 10px 0 30px 0 !important;
	}
	.ec-exam-container {
		width: 95%;
		padding: 0;
	}
	.ec-exam-header {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
		padding: 14px 16px;
	}
	.ec-exam-title {
		font-size: 17px;
		line-height: 1.3;
	}
	.ec-exam-header > div:last-child {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 100%;
	}
	.ec-timer-box {
		padding: 6px 12px;
		font-size: 14px;
	}
	.ec-exam-grid {
		grid-template-columns: 1fr;
		gap: 16px;
	}
	.ec-question-panel {
		padding: 16px 14px;
		min-height: auto;
		border-radius: 10px;
	}
	.ec-question-header {
		margin-bottom: 16px;
		padding-bottom: 12px;
	}
	.ec-q-number {
		font-size: 15px;
	}
	.ec-question-content {
		font-size: 15px;
		line-height: 1.55;
		margin-bottom: 20px;
	}
	.ec-options-list {
		gap: 10px;
		margin-bottom: 24px;
	}
	.ec-option-item {
		padding: 11px 14px;
		min-height: 44px;
	}
	.ec-option-text {
		font-size: 14px;
	}
	.ec-question-actions {
		flex-direction: column;
		gap: 10px;
		padding-top: 14px;
	}
	.ec-action-group-left, .ec-action-group-right {
		width: 100%;
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 8px;
	}
	.ec-btn {
		justify-content: center;
		padding: 10px 8px;
		font-size: 13px;
		width: 100%;
	}
	.ec-palette-panel {
		border-radius: 10px;
		padding: 14px;
	}
	.ec-palette-grid {
		grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
		gap: 8px;
		max-height: 200px;
	}
	.ec-pal-btn {
		max-width: 44px;
		max-height: 44px;
		font-size: 13px;
	}
	.ec-exam-modal-card {
		width: 94%;
		padding: 22px 16px;
	}
}

/* Small Mobile (<= 480px) */
@media (max-width: 480px) {
	.ec-exam-header {
		padding: 12px;
	}
	.ec-exam-title {
		font-size: 16px;
	}
	.ec-palette-legend {
		grid-template-columns: 1fr 1fr;
		font-size: 10.5px;
		gap: 4px;
		padding: 6px 8px;
	}
	.ec-palette-grid {
		grid-template-columns: repeat(5, 1fr);
		gap: 6px;
	}
	.ec-pal-btn {
		max-width: 36px;
		max-height: 36px;
		font-size: 12px;
	}
	.ec-action-group-left .ec-btn, .ec-action-group-right .ec-btn {
		font-size: 12px;
		padding: 9px 4px;
	}
}

/* Assessment Set Badges */
.ec-set-badge {
	display: inline-flex;
	align-items: center;
	padding: 3px 10px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.3px;
	text-transform: uppercase;
}
.ec-set-badge-1 {
	background: #eff6ff;
	color: #1d4ed8;
	border: 1px solid #bfdbfe;
}
.ec-set-badge-2 {
	background: #fdf4ff;
	color: #a21caf;
	border: 1px solid #f5d0fe;
}
.ec-set-badge-3 {
	background: #ecfdf5;
	color: #047857;
	border: 1px solid #a7f3d0;
}
