/* =============================================================================
   NV Drivers Ed – Frontend Styles
   ============================================================================= */

/* Timer
   ============================================================================= */

#nvde-timer-wrap {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border: none;
	border-radius: 16px;
	padding: 20px 24px;
	margin: 20px 0;
	max-width: 480px;
	box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	position: relative;
	z-index: 100;
}

/* Floating timer – desktop: top-right corner */
#nvde-timer-wrap.nvde-timer-floating {
	position: fixed;
	top: 20px;
	right: 20px;
	left: auto;
	margin: 0;
	max-width: 320px;
	z-index: 9999;
	animation: nvde-slide-in 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 0 8px 32px rgba(102, 126, 234, 0.4), 0 4px 12px rgba(0, 0, 0, 0.15);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

@keyframes nvde-slide-in {
	from {
		opacity: 0;
		transform: translateY(-20px) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

/* Floating timer compact mode */
#nvde-timer-wrap.nvde-timer-floating #nvde-timer-display {
	margin-bottom: 8px;
}

#nvde-timer-wrap.nvde-timer-floating #nvde-timer-label {
	font-size: 0.75em;
}

#nvde-timer-wrap.nvde-timer-floating #nvde-timer-value {
	font-size: 1.3em;
}

#nvde-timer-display {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	font-size: 1.1em;
	margin-bottom: 14px;
}

#nvde-timer-label {
	font-weight: 600;
	color: rgba(255, 255, 255, 0.9);
	font-size: 0.85em;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

#nvde-timer-value {
	font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', Courier, monospace;
	font-weight: 700;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
	background: rgba(255, 255, 255, 0.15);
	padding: 6px 14px;
	border-radius: 10px;
	letter-spacing: 0.02em;
}

#nvde-timer-bar-wrap {
	background: rgba(255, 255, 255, 0.25);
	border-radius: 8px;
	height: 8px;
	overflow: hidden;
	box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

#nvde-timer-bar {
	height: 100%;
	background: linear-gradient(90deg, #00f5a0 0%, #00d9f5 100%);
	border-radius: 8px;
	width: 0;
	transition: width 1s linear;
	box-shadow: 0 0 10px rgba(0, 245, 160, 0.5);
}

/* Warning state: less than 5 minutes remaining */
#nvde-timer-wrap.nvde-timer-warning {
	background: linear-gradient(135deg, #ea6666 0%, #a24b76 100%);
	animation: nvde-pulse 1.5s ease-in-out infinite;
}

@keyframes nvde-pulse {
	0%, 100% {
		box-shadow: 0 4px 15px rgba(234, 102, 102, 0.3);
	}
	50% {
		box-shadow: 0 4px 25px rgba(234, 102, 102, 0.6);
	}
}

#nvde-timer-wrap.nvde-timer-warning #nvde-timer-bar {
	background: linear-gradient(90deg, #ffd93d 0%, #ff6b6b 100%);
}

.nvde-timer-bypass {
	background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
	border: none;
	border-radius: 12px;
	padding: 14px 20px;
	margin: 20px 0;
	color: #8b4513;
	font-weight: 500;
	box-shadow: 0 4px 12px rgba(252, 182, 159, 0.3);
}

.nvde-timer-bypass a {
	color: #d35400;
	font-weight: 600;
	text-decoration: none;
	margin-left: 8px;
	padding: 4px 12px;
	background: rgba(255, 255, 255, 0.6);
	border-radius: 6px;
	transition: all 0.2s ease;
}

.nvde-timer-bypass a:hover {
	background: rgba(255, 255, 255, 0.9);
}

/* Mobile-specific floating timer styles */
@media (max-width: 768px) {
	#nvde-timer-wrap {
		max-width: 100%;
		margin: 16px 0;
		padding: 16px 20px;
		border-radius: 12px;
	}

	/* Mobile: float to bottom of screen for easier thumb reach */
	#nvde-timer-wrap.nvde-timer-floating {
		top: auto;
		bottom: 16px;
		left: 16px;
		right: 16px;
		max-width: none;
		width: calc(100% - 32px);
		border-radius: 16px;
		padding: 14px 18px;
		animation: nvde-slide-up 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	}

	@keyframes nvde-slide-up {
		from {
			opacity: 0;
			transform: translateY(20px) scale(0.95);
		}
		to {
			opacity: 1;
			transform: translateY(0) scale(1);
		}
	}

	#nvde-timer-wrap.nvde-timer-floating #nvde-timer-display {
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 10px;
	}

	#nvde-timer-wrap.nvde-timer-floating #nvde-timer-label {
		font-size: 0.7em;
	}

	#nvde-timer-wrap.nvde-timer-floating #nvde-timer-value {
		font-size: 1.2em;
		padding: 5px 12px;
	}

	#nvde-timer-wrap.nvde-timer-floating #nvde-timer-bar-wrap {
		height: 6px;
	}

	/* Prevent content from being hidden behind floating timer on mobile */
	body:has(#nvde-timer-wrap.nvde-timer-floating) {
		padding-bottom: 100px;
	}

	#nvde-timer-display {
		flex-wrap: wrap;
		gap: 8px;
	}

	#nvde-timer-value {
		font-size: 1.4em;
		padding: 5px 12px;
	}

	#nvde-timer-bar-wrap {
		height: 6px;
	}
}

/* Small mobile screens */
@media (max-width: 480px) {
	#nvde-timer-wrap.nvde-timer-floating {
		bottom: 12px;
		left: 12px;
		right: 12px;
		width: calc(100% - 24px);
		padding: 12px 14px;
	}

	#nvde-timer-wrap.nvde-timer-floating #nvde-timer-label {
		font-size: 0.65em;
	}

	#nvde-timer-wrap.nvde-timer-floating #nvde-timer-value {
		font-size: 1.1em;
		padding: 4px 10px;
	}

	/* Slightly less padding on small screens as the timer is more compact */
	body:has(#nvde-timer-wrap.nvde-timer-floating) {
		padding-bottom: 90px;
	}
}

/* Safe area support for devices with notches (e.g. iPhone X+) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
	@media (max-width: 768px) {
		#nvde-timer-wrap.nvde-timer-floating {
			bottom: calc(16px + env(safe-area-inset-bottom));
		}

		body:has(#nvde-timer-wrap.nvde-timer-floating) {
			padding-bottom: calc(100px + env(safe-area-inset-bottom));
		}
	}
}

/* Quiz timer
   ============================================================================= */

#nvde-quiz-timer {
	font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Courier New', Courier, monospace;
	margin: 10px 0;
	background: linear-gradient(135deg, #f5f7fa 0%, #e4e8f0 100%);
	padding: 10px 16px;
	border-radius: 10px;
	display: inline-block;
	box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

/* Sidebar navigation
   ============================================================================= */

.nvde-sidebar {
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	overflow: hidden;
	margin: 0 0 24px;
}

.nvde-sidebar-header {
	background: #8b5e3c;
	color: #fff;
	font-weight: 700;
	font-size: 0.95em;
	letter-spacing: 0.08em;
	padding: 10px 16px;
	text-transform: uppercase;
}

.nvde-sidebar-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.nvde-sidebar-item {
	border-bottom: 1px solid #e8e8e8;
}

.nvde-sidebar-item:last-child {
	border-bottom: none;
}

.nvde-sidebar-item a,
.nvde-sidebar-item span {
	display: block;
	padding: 10px 16px;
	text-decoration: none;
	color: #333;
	font-size: 0.88em;
	line-height: 1.4;
}

.nvde-sidebar-item a:hover {
	filter: brightness(0.95);
	color: inherit;
}

/* Uncompleted: gray background */
.nvde-sidebar-item.nvde-uncompleted,
.nvde-sidebar-item.nvde-uncompleted a,
.nvde-sidebar-item.nvde-uncompleted span {
	background: #d9d9d9;
	color: #444;
}

/* Completed: blue background */
.nvde-sidebar-item.nvde-completed,
.nvde-sidebar-item.nvde-completed a,
.nvde-sidebar-item.nvde-completed span {
	background: #3a7abf;
	color: #fff;
}

.nvde-sidebar-item.nvde-completed a:hover {
	background: #3a7abf;
	color: #fff;
}

/* Current: yellow/orange background */
.nvde-sidebar-item.nvde-current,
.nvde-sidebar-item.nvde-current a,
.nvde-sidebar-item.nvde-current span {
	background: #e8a020;
	color: #fff !important;
	font-weight: 600;
}

.nvde-sidebar-item.nvde-current a:hover {
	background: #e8a020;
	color: #fff;
}

/* Locked: gray background with muted text */
.nvde-sidebar-item.nvde-locked,
.nvde-sidebar-item.nvde-locked span {
	background: #d9d9d9;
	color: #000000;
	cursor: default;
}

.nvde-sidebar-item.nvde-locked span {
	display: flex;
	align-items: center;
	justify-content: space-between;
	cursor: not-allowed;
}

.nvde-lock {
	color: #c96a00;
	font-size: 1em;
	flex-shrink: 0;
}

/* Legend section */
.nvde-sidebar-legend {
	border-top: 2px solid #e0e0e0;
	padding: 10px 16px 14px;
	background: #fff;
}

.nvde-sidebar-legend-title {
	font-weight: 700;
	font-size: 0.8em;
	letter-spacing: 0.07em;
	color: #555;
	text-transform: uppercase;
	margin-bottom: 8px;
}

.nvde-sidebar-legend-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.nvde-legend-item {
	font-size: 0.82em;
	padding: 5px 10px;
	border-radius: 3px;
	color: #fff;
	font-weight: 600;
}

.nvde-legend-completed {
	background: #3a7abf;
}

.nvde-legend-current {
	background: #e8a020;
}

.nvde-legend-uncompleted {
	background: #d9d9d9;
	color: #444;
}

/* Module link wrapper (sidebar item with optional "Proceed to Test" button)
   ============================================================================= */

.nvde-module-link-wrapper {
	display: flex;
	flex-direction: column;
}

.nvde-proceed-to-test-btn {
	display: block;
	background-color: #28a745;
	color: #ffffff !important;
	padding: 6px 16px;
	font-size: 0.85em;
	font-weight: 600;
	text-decoration: none;
	text-align: center;
	transition: background-color 0.2s ease;
}

.nvde-proceed-to-test-btn:hover {
	background-color: #218838;
	color: #ffffff !important;
	text-decoration: none;
}

/* Quiz wrapper
   ============================================================================= */

.nvde-quiz-wrap {
	margin: 24px 0;
}

/* Pass / fail messages
   ============================================================================= */

.nvde-error,
.nvde-quiz-fail {
	background: #fff3f3;
	border-left: 4px solid #e74c3c;
	border-radius: 4px;
	padding: 14px 18px;
	margin: 20px 0;
	color: #c0392b;
}

.nvde-quiz-fail p {
	margin: 0 0 10px;
}

.nvde-quiz-fail p:last-child {
	margin-bottom: 0;
}

/* Buttons
   ============================================================================= */

.nvde-btn {
	display: inline-block;
	background: #0073aa;
	color: #fff;
	padding: 8px 18px;
	border-radius: 4px;
	text-decoration: none;
	font-size: 0.95em;
	transition: background 0.2s;
}

.nvde-btn:hover {
	background: #005a87;
	color: #fff;
}

/* Certificate
   ============================================================================= */

.nvde-certificate-wrap {
	margin: 24px 0;
}

.nvde-certificate-frame {
	border: 1px solid #ddd;
	border-radius: 4px;
}

.nvde-cert-link {
	display: inline-block;
	background: #27ae60;
	color: #fff;
	padding: 10px 20px;
	border-radius: 4px;
	text-decoration: none;
	font-size: 1em;
	margin: 12px 0;
	transition: background 0.2s;
}

.nvde-cert-link:hover {
	background: #1e8449;
	color: #fff;
}

/* User profile
   ============================================================================= */

.nvde-user-profile {
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	padding: 20px;
	margin: 20px 0;
}

.nvde-user-profile h3 {
	margin-top: 0;
}

/* Entries table
   ============================================================================= */

.nvde-entries-wrap {
	overflow-x: auto;
	margin: 20px 0;
}

.nvde-entries-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9em;
}

.nvde-entries-table th,
.nvde-entries-table td {
	padding: 8px 12px;
	border: 1px solid #e0e0e0;
	text-align: left;
}

.nvde-entries-table thead th {
	background: #f0f0f0;
	font-weight: 600;
}

.nvde-pass {
	color: #27ae60;
	font-weight: 600;
}

.nvde-fail {
	color: #e74c3c;
	font-weight: 600;
}

/* Final exam
   ============================================================================= */

#nvde-final-exam {
	margin: 24px 0;
}

/* Responsive menu
   ============================================================================= */

.nvde-responsive-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.nvde-responsive-menu li a {
	display: block;
	padding: 8px 14px;
	color: #333;
	text-decoration: none;
	border-radius: 4px;
	transition: background 0.15s;
}

.nvde-responsive-menu li a:hover {
	background: #f0f0f0;
}

@media ( max-width: 768px ) {
	.nvde-responsive-menu {
		flex-direction: column;
	}
}

/* Admin page
   ============================================================================= */

.nvde-admin table.widefat {
	margin-bottom: 24px;
}
