/**
 * Lesson Timer Display Styles
 * Compatible with LearnDash LD30 theme and StudyPeak theme
 *
 * @package Studypeak\StudentFileEssayInterface
 */

/* Timer Display Container */
.sp-timer-display {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-left: auto;
	padding-left: 16px;
	flex-shrink: 0;
}

/* Adjust LearnDash preview to accommodate timer */
.learndash-wrapper .ld-item-list .ld-item-list-item .ld-item-list-item-preview {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
}

.learndash-wrapper .ld-item-list .ld-item-list-item .ld-item-list-item-preview a.ld-item-name {
	flex: 1;
	min-width: 0;
}

/* Time Badge Base */
.sp-time-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	font-family: inherit;
	line-height: 1.4;
}

/* Active/In Progress State */
.sp-time-badge--active {
	background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
	color: #166534;
	border: 1px solid rgba(22, 101, 52, 0.15);
}

/* Completed State */
.sp-time-badge--completed {
	background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
	color: #166534;
	border: 1px solid rgba(22, 101, 52, 0.15);
}

.sp-time-badge--completed .sp-check-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	background: #1F7044;
	border-radius: 50%;
	color: #fff;
	font-size: 10px;
}

/* Idle/Not Started State */
.sp-time-badge--idle {
	background: #f8fafc;
	color: #64748b;
	border: 1px solid #e2e8f0;
}

/* Expired State */
.sp-time-badge--expired {
	background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
	color: #dc2626;
	border: 1px solid rgba(220, 38, 38, 0.15);
}

/* Progress Container */
.sp-timer-progress-wrap {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 6px;
}

/* Mini Progress Bar */
.sp-mini-progress {
	position: relative;
	width: 100%;
	height: 4px;
	background: #e2e8f0;
	border-radius: 4px;
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
	cursor: pointer;
}

/* Progress Bar Tooltip */
.sp-mini-progress[data-tooltip]::before {
	content: attr(data-tooltip);
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%) scale(0.9);
	padding: 6px 10px;
	background: #1e293b;
	color: #fff;
	font-size: 12px;
	font-weight: 500;
	white-space: nowrap;
	border-radius: 6px;
	opacity: 0;
	visibility: hidden;
	transition: all 0.2s ease;
	z-index: 10;
	pointer-events: none;
}

.sp-mini-progress[data-tooltip]::after {
	content: '';
	position: absolute;
	bottom: calc(100% + 2px);
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: #1e293b;
	opacity: 0;
	visibility: hidden;
	transition: all 0.2s ease;
	pointer-events: none;
}

.sp-mini-progress[data-tooltip]:hover::before,
.sp-mini-progress[data-tooltip]:hover::after {
	opacity: 1;
	visibility: visible;
}

.sp-mini-progress[data-tooltip]:hover::before {
	transform: translateX(-50%) scale(1);
}

.sp-mini-progress__fill {
	height: 100%;
	border-radius: 4px;
	transition: width 0.3s ease;
	max-width: 100%;
}

.sp-mini-progress__fill--good {
	background: linear-gradient(90deg, #1F7044 0%, #22c55e 100%);
}

.sp-mini-progress__fill--warning {
	background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

.sp-mini-progress__fill--danger {
	background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
}

/* Start Button */
.sp-start-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 16px;
	background: linear-gradient(135deg, #1F7044 0%, #166534 100%);
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: 0 2px 4px rgba(31, 112, 68, 0.2);
	font-family: inherit;
	line-height: 1;
}

.sp-start-btn:hover {
	background: linear-gradient(135deg, #166534 0%, #14532d 100%);
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(31, 112, 68, 0.3);
}

.sp-start-btn:active {
	transform: translateY(0);
	box-shadow: 0 2px 4px rgba(31, 112, 68, 0.2);
}

.sp-start-btn svg {
	width: 14px;
	height: 14px;
	flex-shrink: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
	.sp-timer-display {
		padding-left: 12px;
		gap: 8px;
	}

	.sp-time-badge {
		padding: 5px 10px;
		font-size: 12px;
	}

	.sp-start-btn {
		padding: 6px 12px;
		font-size: 12px;
	}
}

@media (max-width: 480px) {
	.sp-timer-display {
		padding-left: 8px;
		gap: 6px;
	}

	.sp-time-badge {
		padding: 4px 8px;
		font-size: 11px;
	}

	.sp-start-btn {
		padding: 5px 10px;
		font-size: 11px;
	}

	.sp-start-btn span {
		display: none;
	}
}

/* =====================================================
   Timer Banner - Lesson Page Header
   ===================================================== */

.sp-timer-banner {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px 20px;
	margin-bottom: 24px;
	background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
	transition: background 0.3s, border-color 0.3s;
}

.sp-timer-banner--good {
	background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
	border-color: #a7f3d0;
	box-shadow: 0 2px 8px rgba(31, 112, 68, 0.08);
}

.sp-timer-banner--warning {
	background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
	border-color: #fcd34d;
}

.sp-timer-banner--danger {
	background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
	border-color: #fca5a5;
}

.sp-timer-banner__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: #fff;
	border-radius: 50%;
	color: #64748b;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
	flex-shrink: 0;
	transition: color 0.3s;
}

.sp-timer-banner--good .sp-timer-banner__icon {
	color: #1F7044;
}

.sp-timer-banner--warning .sp-timer-banner__icon {
	color: #d97706;
}

.sp-timer-banner--danger .sp-timer-banner__icon {
	color: #dc2626;
}

.sp-timer-banner__content {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-width: 0;
}

.sp-timer-banner__label {
	font-size: 13px;
	color: #64748b;
	font-weight: 500;
}

.sp-timer-banner__time {
	font-size: 24px;
	font-weight: 700;
	color: #475569;
	font-variant-numeric: tabular-nums;
	line-height: 1.2;
	min-width: 70px;
	transition: color 0.3s;
}

.sp-timer-banner--good .sp-timer-banner__time {
	color: #1F7044;
}

.sp-timer-banner--warning .sp-timer-banner__time {
	color: #d97706;
}

.sp-timer-banner--danger .sp-timer-banner__time {
	color: #dc2626;
}

.sp-timer-banner__progress {
	width: 120px;
	height: 8px;
	background: rgba(255, 255, 255, 0.8);
	border-radius: 4px;
	overflow: hidden;
	flex-shrink: 0;
}

.sp-timer-banner__progress-fill {
	height: 100%;
	border-radius: 4px;
	transition: width 1s linear;
}

.sp-timer-banner__progress-fill--good {
	background: linear-gradient(90deg, #1F7044 0%, #22c55e 100%);
}

.sp-timer-banner__progress-fill--warning {
	background: linear-gradient(90deg, #d97706 0%, #fbbf24 100%);
}

.sp-timer-banner__progress-fill--danger {
	background: linear-gradient(90deg, #dc2626 0%, #f87171 100%);
}

/* Banner Responsive */
@media (max-width: 600px) {
	.sp-timer-banner {
		flex-wrap: wrap;
		padding: 12px 16px;
		gap: 12px;
	}

	.sp-timer-banner__icon {
		width: 36px;
		height: 36px;
	}

	.sp-timer-banner__icon svg {
		width: 18px;
		height: 18px;
	}

	.sp-timer-banner__time {
		font-size: 20px;
	}

	.sp-timer-banner__progress {
		width: 100%;
		order: 3;
	}
}
