/* Modern Reem Lesson Page Styles */

body.reem-course-lesson,
body.custom-background.reem-course-lesson {
	background-color: #faf7f2 !important;
	background-image: none !important;
}

body.reem-course-lesson .main-title-section-wrapper {
	display: none !important;
}

body.reem-course-lesson #header-wrapper {
	margin-bottom: 0 !important;
}

body.reem-course-lesson #main > .container {
	width: min(1240px, calc(100% - 2rem));
	max-width: 1240px;
	padding-top: 1.5rem;
	padding-bottom: 4rem;
}

/* Base Lesson Container */
.reem-lesson {
	--reem-primary: #284439;
	--reem-primary-rgb: 40, 68, 57;
	--reem-primary-dark: #1b2f27;
	--reem-primary-light: #3a5c4e;
	--reem-clay: #c76b3d;
	--reem-clay-rgb: 199, 107, 61;
	--reem-clay-light: #faede6;
	--reem-brown: #6e3b2e;
	--reem-rose: #9f4258;
	--reem-rose-light: #faedf0;
	--reem-emerald: #2d8a63;
	--reem-emerald-light: #e8f5ef;
	--reem-ink: #3c4b45;
	--reem-ink-light: #687972;
	--reem-paper: #ffffff;
	--reem-cream: #faf7f2;
	--reem-cream-subtle: #f4ede2;
	--reem-line: #e6ded3;
	--reem-line-subtle: rgba(230, 222, 211, 0.6);
	--reem-radius-sm: 0.5rem;
	--reem-radius-md: 0.9rem;
	--reem-radius-lg: 1.25rem;
	--reem-radius-xl: 1.75rem;
	--reem-shadow-sm: 0 4px 12px rgba(40, 68, 57, 0.04);
	--reem-shadow-md: 0 10px 30px -4px rgba(40, 68, 57, 0.07), 0 2px 6px rgba(0, 0, 0, 0.02);
	--reem-shadow-lg: 0 20px 45px -8px rgba(40, 68, 57, 0.09), 0 6px 16px rgba(0, 0, 0, 0.03);

	color: var(--reem-ink);
	direction: rtl;
	font-family: Tajawal, "Noto Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	text-align: start;
	-webkit-font-smoothing: antialiased;
}

.reem-lesson *,
.reem-lesson *::before,
.reem-lesson *::after {
	box-sizing: border-box;
}

.reem-icon {
	display: inline-block;
	flex-shrink: 0;
	vertical-align: middle;
}

/* ==========================================================================
   TOP PROGRESS BAR
   ========================================================================== */

.reem-lesson__top-progress {
	position: relative;
	width: 100%;
	height: 4px;
	background: var(--reem-line);
	border-radius: 999px;
	margin-bottom: 1.25rem;
	overflow: hidden;
}

.reem-lesson__top-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--reem-clay) 0%, var(--reem-emerald) 100%);
	border-radius: 999px;
	transition: width 0.4s ease;
}

/* ==========================================================================
   BREADCRUMBS
   ========================================================================== */

.reem-lesson__crumb {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 0.65rem;
	align-items: center;
	margin: 0 0 1.75rem;
	padding: 0.65rem 1.15rem;
	background: var(--reem-paper);
	border: 1px solid var(--reem-line);
	border-radius: 999px;
	box-shadow: var(--reem-shadow-sm);
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--reem-ink-light);
	width: fit-content;
}

.reem-lesson__crumb a {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	color: var(--reem-primary);
	text-decoration: none;
	transition: color 0.2s ease;
}

.reem-lesson__crumb a:hover {
	color: var(--reem-clay);
}

.reem-lesson__crumb-sep {
	color: var(--reem-line);
	user-select: none;
}

.reem-lesson__crumb-current {
	color: var(--reem-clay);
	font-weight: 700;
	max-width: 320px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ==========================================================================
   LAYOUT GRID
   ========================================================================== */

.reem-lesson__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: 2.2rem;
	align-items: start;
}

.reem-lesson__main {
	min-width: 0;
}

/* ==========================================================================
   LESSON HEADER
   ========================================================================== */

.reem-lesson__header {
	margin-bottom: 1.5rem;
}

.reem-lesson__meta-top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.65rem;
	margin-bottom: 0.75rem;
}

.reem-lesson__badge {
	display: inline-flex;
	align-items: center;
	padding: 0.3rem 0.85rem;
	border-radius: 999px;
	background: var(--reem-rose-light);
	border: 1px solid rgba(159, 66, 88, 0.2);
	color: var(--reem-rose);
	font-size: 0.85rem;
	font-weight: 700;
}

.reem-lesson__index-pill {
	display: inline-flex;
	align-items: center;
	padding: 0.3rem 0.85rem;
	border-radius: 999px;
	background: var(--reem-cream-subtle);
	border: 1px solid var(--reem-line);
	color: var(--reem-primary);
	font-size: 0.85rem;
	font-weight: 700;
}

.reem-lesson__title {
	margin: 0 0 0.85rem;
	color: var(--reem-primary);
	font-family: inherit;
	font-size: clamp(1.8rem, 1.3rem + 1.4vw, 2.4rem);
	font-weight: 800;
	line-height: 1.35;
	letter-spacing: -0.01em;
}

.reem-lesson__intro {
	margin-top: 0.85rem;
	padding: 1.15rem 1.4rem;
	background: var(--reem-paper);
	border: 1px solid var(--reem-line);
	border-radius: var(--reem-radius-md);
	font-size: 1.05rem;
	line-height: 1.85;
	color: var(--reem-ink);
	box-shadow: var(--reem-shadow-sm);
}

.reem-lesson__intro p {
	margin: 0 0 0.65rem;
}

.reem-lesson__intro p:last-child {
	margin-bottom: 0;
}

/* ==========================================================================
   VIDEO PLAYER STAGE
   ========================================================================== */

.reem-lesson__videos {
	display: flex;
	flex-direction: column;
	gap: 2rem;
	margin-top: 1.25rem;
}

.reem-lesson__video-block {
	display: flex;
	flex-direction: column;
}

.reem-lesson__video-title {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 0 0 0.85rem;
	color: var(--reem-primary);
	font-size: 1.25rem;
	font-weight: 700;
}

.reem-lesson__video-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--reem-clay-light);
	color: var(--reem-clay);
	font-size: 0.85rem;
	font-weight: 800;
}

.reem-lesson__player-stage {
	position: relative;
	border-radius: var(--reem-radius-lg);
	background: #1e1917;
	box-shadow: 0 20px 45px -8px rgba(40, 68, 57, 0.2), 0 6px 16px rgba(0, 0, 0, 0.12);
	overflow: hidden;
}

.reem-lesson__frame {
	position: relative;
	aspect-ratio: 16 / 9;
	width: 100%;
	overflow: hidden;
	background: #1e1917;
}

.reem-lesson__frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.reem-lesson__play {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: grid;
	place-items: center;
	padding: 0;
	border: 0;
	background: #1e1917;
	cursor: pointer;
}

.reem-lesson__play img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transform: scale(1.08);
	transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.reem-lesson__play:hover img {
	transform: scale(1.15);
}

.reem-lesson__play-glow {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.6) 100%);
}

.reem-lesson__play-btn {
	position: relative;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 0.85rem;
	padding: 0.85rem 1.6rem;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.96);
	border: 1px solid rgba(255, 255, 255, 1);
	color: var(--reem-primary);
	font-family: inherit;
	font-size: 1.08rem;
	font-weight: 700;
	box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
	backdrop-filter: blur(12px);
	transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.reem-lesson__play-btn svg {
	color: var(--reem-clay);
}

.reem-lesson__play:hover .reem-lesson__play-btn {
	background: #ffffff;
	transform: scale(1.06);
	box-shadow: 0 18px 42px rgba(199, 107, 61, 0.4);
}

/* Actions Bar under Player */
.reem-lesson__actions-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.85rem;
	margin-top: 1rem;
	padding: 0.85rem 1.15rem;
	background: var(--reem-paper);
	border: 1px solid var(--reem-line);
	border-radius: var(--reem-radius-md);
	box-shadow: var(--reem-shadow-sm);
}

.reem-lesson__actions-left,
.reem-lesson__actions-right {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.65rem;
}

.reem-lesson__action-link {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.45rem 0.95rem;
	border-radius: var(--reem-radius-sm);
	background: var(--reem-cream-subtle);
	border: 1px solid var(--reem-line);
	color: var(--reem-primary);
	font-family: inherit;
	font-size: 0.92rem;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.2s ease;
}

.reem-lesson__action-link:hover {
	background: var(--reem-primary);
	border-color: var(--reem-primary);
	color: #ffffff;
}

/* Complete Button Active Style */
.reem-lesson__complete-btn.is-completed {
	background: var(--reem-emerald);
	border-color: var(--reem-emerald);
	color: #ffffff;
	box-shadow: 0 4px 12px rgba(45, 138, 99, 0.35);
}

.reem-lesson__complete-btn.is-completed:hover {
	background: #236c4e;
	border-color: #236c4e;
}

.reem-lesson__action-yt:hover {
	background: #cc181e;
	border-color: #cc181e;
	color: #ffffff;
}

.reem-lesson__action-yt svg:first-child {
	color: #cc181e;
}

.reem-lesson__action-yt:hover svg:first-child {
	color: #ffffff;
}

/* ==========================================================================
   ADJACENT PAGER NAVIGATION
   ========================================================================== */

.reem-lesson__pager {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.25rem;
	margin-top: 2.75rem;
	padding-top: 1.75rem;
	border-top: 2px solid var(--reem-line);
}

.reem-lesson__pager-card {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1.2rem 1.35rem;
	background: var(--reem-paper);
	border: 1px solid var(--reem-line);
	border-radius: var(--reem-radius-md);
	box-shadow: var(--reem-shadow-sm);
	color: inherit;
	text-decoration: none;
	transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.reem-lesson__pager-card:hover {
	border-color: var(--reem-clay);
	transform: translateY(-3px);
	box-shadow: var(--reem-shadow-md);
}

.reem-lesson__pager-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	flex-shrink: 0;
	border-radius: 50%;
	background: var(--reem-cream-subtle);
	color: var(--reem-clay);
	transition: all 0.2s ease;
}

.reem-lesson__pager-card:hover .reem-lesson__pager-icon {
	background: var(--reem-clay);
	color: #ffffff;
}

.reem-lesson__pager-info {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	min-width: 0;
}

.reem-lesson__pager-kicker {
	color: var(--reem-rose);
	font-size: 0.85rem;
	font-weight: 700;
}

.reem-lesson__pager-title {
	color: var(--reem-primary);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.45;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.reem-lesson__pager-placeholder {
	display: block;
}

.reem-lesson__footer-nav {
	margin-top: 2rem;
}

.reem-lesson__back-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.75rem 1.35rem;
	border-radius: var(--reem-radius-md);
	background: var(--reem-paper);
	border: 1px solid var(--reem-line);
	color: var(--reem-primary);
	font-size: 0.98rem;
	font-weight: 700;
	text-decoration: none;
	box-shadow: var(--reem-shadow-sm);
	transition: all 0.2s ease;
}

.reem-lesson__back-btn:hover {
	background: var(--reem-cream-subtle);
	border-color: #d8cdbf;
	color: var(--reem-primary-dark);
	transform: translateY(-2px);
}

/* ==========================================================================
   SIDEBAR PLAYLIST
   ========================================================================== */

.reem-lesson__sidebar {
	position: sticky;
	top: 1.5rem;
}

.reem-lesson__playlist-card {
	background: var(--reem-paper);
	border: 1px solid var(--reem-line);
	border-radius: var(--reem-radius-lg);
	box-shadow: var(--reem-shadow-md);
	overflow: hidden;
}

.reem-lesson__playlist-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.15rem 1.35rem;
	background: linear-gradient(135deg, #fbf8f4 0%, #f4ece1 100%);
	border-bottom: 1px solid var(--reem-line);
}

.reem-lesson__playlist-titles {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	color: var(--reem-primary);
}

.reem-lesson__playlist-titles h2 {
	margin: 0;
	color: inherit;
	font-family: inherit;
	font-size: 1.15rem;
	font-weight: 800;
}

.reem-lesson__playlist-count {
	padding: 0.25rem 0.65rem;
	border-radius: 999px;
	background: rgba(40, 68, 57, 0.08);
	color: var(--reem-primary);
	font-size: 0.82rem;
	font-weight: 700;
}

.reem-lesson__playlist-list {
	margin: 0;
	padding: 0.65rem;
	list-style: none;
	max-height: calc(100vh - 160px);
	overflow-y: auto;
}

.reem-lesson__playlist-item {
	margin: 0 0 0.35rem;
}

.reem-lesson__playlist-item:last-child {
	margin-bottom: 0;
}

.reem-lesson__playlist-link {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.85rem 1rem;
	border-radius: var(--reem-radius-md);
	color: var(--reem-ink);
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.5;
	text-decoration: none;
	transition: all 0.2s ease;
}

.reem-lesson__playlist-link:hover {
	background: var(--reem-cream-subtle);
	color: var(--reem-primary);
}

.reem-lesson__playlist-idx {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	flex-shrink: 0;
	border-radius: 50%;
	background: var(--reem-cream-subtle);
	color: var(--reem-ink-light);
	font-size: 0.82rem;
	font-weight: 700;
}

.reem-lesson__playlist-check {
	display: none;
	color: #ffffff;
	font-size: 0.85rem;
}

/* Checked status in sidebar */
.reem-lesson__playlist-item.is-done .reem-lesson__playlist-idx {
	background: var(--reem-emerald);
	color: #ffffff;
}

.reem-lesson__playlist-item.is-done .reem-lesson__playlist-num {
	display: none;
}

.reem-lesson__playlist-item.is-done .reem-lesson__playlist-check {
	display: inline;
}

.reem-lesson__playlist-name {
	flex: 1;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.reem-lesson__playlist-arrow {
	color: var(--reem-line);
	flex-shrink: 0;
	transition: transform 0.2s ease, color 0.2s ease;
}

.reem-lesson__playlist-link:hover .reem-lesson__playlist-arrow {
	color: var(--reem-clay);
	transform: translateX(-3px);
}

/* Active Lesson in Sidebar */
.reem-lesson__playlist-item.is-active .reem-lesson__playlist-link {
	background: linear-gradient(135deg, rgba(40, 68, 57, 0.08) 0%, rgba(199, 107, 61, 0.08) 100%);
	border: 1px solid rgba(40, 68, 57, 0.15);
	color: var(--reem-primary);
	font-weight: 700;
}

.reem-lesson__playlist-item.is-active .reem-lesson__playlist-idx {
	background: var(--reem-primary);
	color: #ffffff;
}

.reem-lesson__playlist-tag {
	padding: 0.2rem 0.55rem;
	border-radius: 999px;
	background: var(--reem-primary);
	color: #ffffff;
	font-size: 0.75rem;
	font-weight: 700;
	white-space: nowrap;
}

/* Playing Wave Indicator */
.reem-lesson__playing-indicator {
	display: inline-flex;
	align-items: flex-end;
	gap: 2px;
	height: 12px;
}

.reem-lesson__playing-indicator span {
	width: 2.5px;
	background: #ffffff;
	border-radius: 1px;
	animation: reem-soundwave 1s infinite ease-in-out alternate;
}

.reem-lesson__playing-indicator span:nth-child(1) { height: 40%; animation-delay: 0.1s; }
.reem-lesson__playing-indicator span:nth-child(2) { height: 90%; animation-delay: 0.3s; }
.reem-lesson__playing-indicator span:nth-child(3) { height: 60%; animation-delay: 0.2s; }

@keyframes reem-soundwave {
	0% { height: 30%; }
	100% { height: 100%; }
}

/* Toast Message */
.reem-toast {
	position: fixed;
	bottom: 2rem;
	left: 50%;
	transform: translateX(-50%) translateY(20px);
	z-index: 99999;
	display: inline-flex;
	align-items: center;
	gap: 0.65rem;
	padding: 0.85rem 1.6rem;
	border-radius: 999px;
	background: var(--reem-primary);
	color: #ffffff;
	font-family: Tajawal, "Noto Sans Arabic", sans-serif;
	font-size: 0.95rem;
	font-weight: 700;
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
	opacity: 0;
	pointer-events: none;
	transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.reem-toast.is-show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
	pointer-events: auto;
}

/* Focus and Accessibility */
.reem-lesson a:focus-visible,
.reem-lesson button:focus-visible {
	outline: 2px solid var(--reem-clay);
	outline-offset: 3px;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS - LUXURY MOBILE EDITION
   ========================================================================== */

@media (max-width: 980px) {
	.reem-lesson__layout {
		grid-template-columns: 1fr;
		gap: 2rem;
	}

	.reem-lesson__sidebar {
		position: static;
		order: 2;
	}

	.reem-lesson__playlist-card {
		margin-top: 1.25rem;
		box-shadow: var(--reem-shadow-sm);
	}

	.reem-lesson__playlist-list {
		max-height: 400px;
	}
}

@media (max-width: 640px) {
	body.reem-course-lesson #main > .container {
		width: 100% !important;
		max-width: 100% !important;
		padding-left: 0.75rem !important;
		padding-right: 0.75rem !important;
		padding-top: 1rem !important;
		padding-bottom: 3rem !important;
	}

	.reem-lesson__crumb {
		width: 100%;
		padding: 0.55rem 0.85rem;
		font-size: 0.84rem;
		gap: 0.35rem 0.5rem;
		border-radius: var(--reem-radius-md);
	}

	.reem-lesson__crumb-current {
		max-width: 170px;
	}

	.reem-lesson__meta-top {
		gap: 0.45rem;
	}

	.reem-lesson__badge,
	.reem-lesson__index-pill {
		font-size: 0.8rem;
		padding: 0.25rem 0.75rem;
	}

	.reem-lesson__title {
		font-size: clamp(1.4rem, 5vw, 1.85rem);
		line-height: 1.35;
		margin-bottom: 0.65rem;
	}

	.reem-lesson__intro {
		padding: 0.9rem 1.05rem;
		font-size: 0.95rem;
		line-height: 1.75;
	}

	.reem-lesson__play-btn {
		padding: 0.65rem 1.25rem;
		font-size: 0.95rem;
		gap: 0.65rem;
	}

	.reem-lesson__play-btn svg {
		width: 20px;
		height: 20px;
	}

	.reem-lesson__actions-bar {
		padding: 0.75rem;
		gap: 0.65rem;
	}

	.reem-lesson__actions-left {
		display: grid;
		grid-template-columns: 1fr 1fr;
		width: 100%;
		gap: 0.5rem;
	}

	.reem-lesson__actions-right {
		width: 100%;
	}

	.reem-lesson__action-link {
		padding: 0.6rem 0.75rem;
		font-size: 0.85rem;
		min-height: 42px;
		width: 100%;
		justify-content: center;
	}

	.reem-lesson__pager {
		grid-template-columns: 1fr;
		gap: 0.75rem;
		margin-top: 1.75rem;
		padding-top: 1.25rem;
	}

	.reem-lesson__pager-placeholder {
		display: none;
	}

	.reem-lesson__pager-card {
		padding: 0.95rem 1.1rem;
		gap: 0.85rem;
	}

	.reem-lesson__pager-icon {
		width: 36px;
		height: 36px;
	}

	.reem-lesson__pager-title {
		font-size: 0.94rem;
	}

	.reem-lesson__footer-nav {
		margin-top: 1.5rem;
	}

	.reem-lesson__back-btn {
		width: 100%;
		justify-content: center;
		padding: 0.8rem 1.2rem;
		font-size: 0.92rem;
	}

	.reem-lesson__playlist-header {
		padding: 0.95rem 1.15rem;
	}

	.reem-lesson__playlist-header h2 {
		font-size: 1.05rem;
	}

	.reem-lesson__playlist-link {
		padding: 0.75rem 0.85rem;
		font-size: 0.9rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.reem-lesson__pager-card,
	.reem-lesson__play img,
	.reem-lesson__play-btn,
	.reem-lesson__playlist-link,
	.reem-lesson__top-progress-fill {
		transition: none !important;
	}

	.reem-lesson__pager-card:hover,
	.reem-lesson__play:hover .reem-lesson__play-btn {
		transform: none !important;
	}

	.reem-lesson__playing-indicator span {
		animation: none !important;
	}
}
