/**
 * Estilos para el Sistema Educativo - Diseño Minimalista como en la imagen
 * Sidebar de lecciones y ejercicios
 * 
 * @package Really Simple
 */

/* ========================================
   SIDEBAR EDUCATIVO - DISEÑO MINIMALISTA
   ======================================== */

/* Forzar LTR en el sidebar educativo */
.educational-sidebar {
	background: #f5f5f5;
	padding: 0;
	position: fixed;
	left: 0;
	top: 0;
	bottom: 0;
	height: 100vh;
	width: 280px;
	overflow-y: auto;
	overflow-x: hidden;
	display: flex;
	flex-direction: column;
	border-radius: 0;
	border-right: 1px solid #e0e0e0;
	box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
	z-index: 9999;
	transform: translateX(0);
	transition: transform 0.3s ease;
	direction: ltr !important;
	text-align: left !important;
}

.educational-sidebar * {
	direction: ltr !important;
	text-align: left !important;
}

/* إخفاء الـ sidebar في صفحات الـ ejercicio */
body.single-ejercicio .educational-sidebar {
	transform: translateX(-100%);
	pointer-events: none;
}

/* إظهار الـ sidebar فقط في صفحات الـ leccion */
body.single-leccion .educational-sidebar {
	transform: translateX(0);
}

/* تعديل المحتوى عند ظهور الـ sidebar */
body.single-leccion {
	transition: all 0.3s ease;
}

/* جميع العناصر الرئيسية تنحاز لليمين */
body.single-leccion .header,
body.single-leccion #primary,
body.single-leccion .site-footer,
body.single-leccion footer {
	margin-left: 280px;
	transition: all 0.3s ease;
}

body.single-leccion .header {
	margin-right: 0;
	max-width: 100% !important;
	width: calc(100% - 280px);
}

body.single-leccion #primary {
	padding-left: 40px;
	padding-right: 40px;
	max-width: calc(100% - 280px);
}

body.single-leccion .site-footer,
body.single-leccion footer {
	max-width: calc(100% - 280px);
}

body.single-leccion main {
	max-width: 1200px;
	margin-left: auto;
	margin-right: auto;
}

body.single-leccion article {
	max-width: 900px;
	margin-left: auto;
	margin-right: auto;
}

/* صفحات التمارين - بدون تأثير */
body.single-ejercicio .header,
body.single-ejercicio #primary,
body.single-ejercicio .site-footer,
body.single-ejercicio footer {
	margin-left: 0;
}

body.single-ejercicio #primary {
	padding-left: 20px;
	padding-right: 20px;
}

body.single-ejercicio main {
	max-width: 100%;
}

/* Scrollbar minimalista */
.educational-sidebar::-webkit-scrollbar {
	width: 4px;
}

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

.educational-sidebar::-webkit-scrollbar-thumb {
	background: rgba(0, 0, 0, 0.1);
	border-radius: 4px;
}

.educational-sidebar::-webkit-scrollbar-thumb:hover {
	background: rgba(0, 0, 0, 0.2);
}

/* Ajuste del contenido principal */
.educational-widget-area {
	width: 280px;
	flex-shrink: 0;
}

/* إخفاء الـ widget area في صفحات الـ ejercicio */
body.single-ejercicio .educational-widget-area {
	display: none;
}

/* زر التبديل للموبايل - مخفي افتراضياً */
.sidebar-mobile-toggle {
	display: none;
}

/* شريط أفقي في الأعلى لفتح القائمة */
.mobile-sidebar-trigger {
	display: none;
	position: relative;
	margin: 0 auto 15px;
	padding: 0 16px;
	width: 100%;
	height: 50px;
	background: #006aff;
	color: white;
	border: none;
	border-radius: 12px;
	cursor: pointer;
	align-items: center;
	justify-content: space-between;
	font-size: 15px;
	font-weight: 600;
	transition: all 0.3s ease;
	box-shadow: 0 4px 15px rgba(0, 106, 255, 0.25);
}

.mobile-sidebar-trigger .trigger-left {
	display: flex;
	align-items: center;
	gap: 10px;
}

.mobile-sidebar-trigger:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 20px rgba(0, 106, 255, 0.35);
	background: #0056d6;
}

.mobile-sidebar-trigger:active {
	transform: translateY(0);
	box-shadow: 0 2px 10px rgba(0, 106, 255, 0.25);
}

.mobile-sidebar-trigger svg {
	transition: transform 0.3s ease;
	flex-shrink: 0;
}

body.sidebar-open .mobile-sidebar-trigger svg {
	transform: rotate(180deg);
}

@media (max-width: 992px) {
	/* إظهار الشريط الأفقي في الموبايل */
	.mobile-sidebar-trigger {
		display: flex !important;
	}
	
	/* إزالة padding إضافي */
	body.single-leccion #primary,
	body.single-ejercicio #primary {
		padding-top: 20px !important;
	}
	
	/* إظهار زر الإغلاق في الموبايل */
	.sidebar-mobile-toggle {
		display: flex !important;
		align-items: center;
		justify-content: space-between;
		padding: 0 16px;
		background: #006aff;
		color: white;
		cursor: pointer;
		border: none;
		width: 100%;
		height: 50px;
		font-size: 15px;
		font-weight: 600;
		position: sticky;
		top: 0;
		z-index: 10;
		box-shadow: 0 2px 8px rgba(0, 106, 255, 0.2);
		border-top-left-radius: 20px;
		border-top-right-radius: 20px;
		transition: all 0.3s ease;
	}
	
	.sidebar-mobile-toggle:hover {
		background: #0056d6;
	}
	
	.sidebar-mobile-toggle .trigger-left {
		display: flex;
		align-items: center;
		gap: 10px;
	}
	
	/* تحويل الـ sidebar إلى overlay في الموبايل */
	.educational-sidebar {
		position: fixed !important;
		top: auto;
		left: 0;
		right: 0;
		bottom: 0;
		width: 100% !important;
		height: 80vh !important;
		max-height: 80vh;
		transform: translateY(100%) !important;
		opacity: 0;
		visibility: hidden;
		z-index: 99999;
		box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
		border-right: none;
		border-top: 1px solid rgba(0, 0, 0, 0.1);
		border-top-left-radius: 20px;
		border-top-right-radius: 20px;
		transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
		            opacity 0.3s ease,
		            visibility 0.3s ease;
		overflow-y: auto;
	}
	
	/* عند الفتح */
	.educational-sidebar.is-open {
		transform: translateY(0) !important;
		opacity: 1;
		visibility: visible;
	}
	
	/* خلفية معتمة عند فتح القائمة */
	.educational-sidebar::before {
		content: '';
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: rgba(0, 0, 0, 0.6);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.3s ease, visibility 0.3s ease;
		z-index: -1;
		pointer-events: none;
	}
	
	.educational-sidebar.is-open::before {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
	}
	
	.sidebar-mobile-toggle svg {
		transition: transform 0.3s ease;
	}
	
	.educational-sidebar.is-open .sidebar-mobile-toggle svg {
		transform: rotate(180deg);
	}
	
	/* تعديل المحتوى الداخلي */
	.sidebar-course-header {
		padding: 16px 20px;
	}
	
	.course-title {
		font-size: 16px;
	}
	
	.sidebar-quick-nav {
		grid-template-columns: 1fr 1fr;
		gap: 8px;
		padding: 12px;
	}
	
	.lecciones-list {
		display: grid;
		grid-template-columns: 1fr;
		gap: 4px;
	}
	
	/* إزالة margin-left من جميع العناصر في الموبايل */
	body.single-leccion .header,
	body.single-leccion #primary,
	body.single-leccion .site-footer,
	body.single-leccion footer {
		margin-left: 0 !important;
	}
	
	body.single-leccion .header {
		max-width: 1400px !important;
		width: 100% !important;
	}
	
	body.single-leccion #primary {
		padding-left: 20px;
		padding-right: 20px;
		max-width: 100%;
		margin-top: 0;
	}
	
	body.single-leccion .site-content {
		padding-top: 0;
	}
	
	body.single-leccion .site-footer,
	body.single-leccion footer {
		max-width: 100%;
	}
	
	body.single-leccion article {
		max-width: 100%;
	}
	
	/* إخفاء widget area الافتراضي */
	.educational-widget-area {
		display: block !important;
		width: 100%;
		max-width: 100%;
	}
}

@media (min-width: 993px) {
	.sidebar-mobile-toggle {
		display: none !important;
	}
}

/* ========================================
   ENCABEZADO DEL CURSO
   ======================================== */

.sidebar-course-header {
	padding: 24px 20px;
	background: #f5f5f5;
	border-bottom: 1px solid #e0e0e0;
	flex-shrink: 0;
}

.course-badge {
	display: none;
}

.course-title {
	font-size: 18px;
	font-weight: 700;
	margin: 0 0 8px 0;
	line-height: 1.3;
	color: #1a1a1a;
	text-align: right;
}

.course-stats {
	display: none;
}

/* ========================================
   NAVEGACIÓN RÁPIDA - SIMPLIFICADA
   ======================================== */

.sidebar-quick-nav {
	padding: 16px;
	border-bottom: 1px solid #e5e7eb;
	background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
	flex-shrink: 0;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.quick-nav-btn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 0.875rem;
	font-weight: 600;
	color: #1f2937;
	background: white;
	border: 1px solid #e5e7eb;
	transition: all 0.3s ease;
	text-decoration: none;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.quick-nav-btn:hover {
	background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
	color: white;
	border-color: #3b82f6;
	transform: translateX(4px);
	box-shadow: 0 4px 8px rgba(59, 130, 246, 0.2);
}

.quick-nav-btn.prev-btn {
	justify-content: flex-start;
}

.quick-nav-btn.next-btn {
	justify-content: flex-end;
	flex-direction: row-reverse;
}

.quick-nav-btn svg {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	transition: transform 0.3s ease;
}

.quick-nav-btn.prev-btn:hover svg {
	transform: translateX(-3px);
}

.quick-nav-btn.next-btn:hover svg {
	transform: translateX(3px);
}

.quick-nav-btn .btn-text {
	font-size: 0.875rem;
	font-weight: 600;
}

/* ========================================
   LISTA DE LECCIONES - ESTILO AGRUPADO
   ======================================== */

.sidebar-lecciones-list {
	padding: 0;
	flex: 1;
	overflow-y: auto;
}

.list-title {
	display: none;
}

/* Contenedor de grupos */
.lecciones-grouped {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

/* Grupo de categoría */
.leccion-category-group {
	margin-bottom: 0.5rem;
}

.category-title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.8125rem;
	font-weight: 700;
	color: #6b7280;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 0.625rem 1rem;
	margin: 0 0 0.25rem 0;
	background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
	border-left: 3px solid #3b82f6;
	border-radius: 0 6px 6px 0;
}

.category-title svg {
	flex-shrink: 0;
	color: #3b82f6;
	width: 14px;
	height: 14px;
}

.lecciones-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.leccion-item {
	margin: 0;
	border-bottom: 1px solid #e0e0e0;
}

.leccion-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 20px;
	text-decoration: none;
	color: #374151;
	background: #f5f5f5;
	transition: all 0.2s ease;
	font-size: 14px;
	line-height: 1.5;
	position: relative;
}

.leccion-link:hover {
	background: #e5e5e5;
}

/* الدرس الحالي */
.leccion-item.current-leccion .leccion-link {
	background: #ffffff;
	color: #1a1a1a;
	font-weight: 600;
	border-right: 3px solid #2563eb;
}

.leccion-link.active {
	cursor: default;
}

/* رقم الدرس */
.leccion-number {
	display: none;
}

/* عنوان الدرس */
.leccion-title {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	text-align: right;
}

/* أيقونة التحديد (checkmark) */
.current-icon {
	flex-shrink: 0;
	color: #2563eb;
	width: 18px;
	height: 18px;
	order: -1;
}

/* أيقونة checkmark افتراضية لجميع الدروس */
.leccion-link::before {
	content: '';
	display: block;
	width: 18px;
	height: 18px;
	border: 2px solid #d1d5db;
	border-radius: 50%;
	flex-shrink: 0;
	order: -1;
	background: transparent;
	transition: all 0.2s ease;
}

.leccion-item.current-leccion .leccion-link::before {
	background: #2563eb;
	border-color: #2563eb;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
	background-size: 12px;
	background-position: center;
	background-repeat: no-repeat;
}

.leccion-item.current-leccion .current-icon {
	display: none;
}

.no-lecciones,
.no-items {
	text-align: center;
	padding: 24px 20px;
	color: #6b7280;
	font-size: 14px;
}

/* ========================================
   TABS (PARA EJERCICIOS)
   ======================================== */

.sidebar-tabs {
	padding: 0;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.tabs-header {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0;
	padding: 0;
	border-bottom: 2px solid #e0e0e0;
	background: #f5f5f5;
	flex-shrink: 0;
}

.tab-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 14px 16px;
	background: transparent;
	border: none;
	border-bottom: 3px solid transparent;
	color: #6b7280;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	margin-bottom: -2px;
}

.tab-btn:hover {
	color: #374151;
	background: rgba(0, 0, 0, 0.02);
}

.tab-btn.active {
	color: #2563eb;
	border-bottom-color: #2563eb;
	background: transparent;
}

.tab-btn svg {
	width: 14px;
	height: 14px;
}

.tab-content {
	display: none;
	flex: 1;
	overflow-y: auto;
}

.tab-content.active {
	display: block;
}

/* ========================================
   FOOTER DEL SIDEBAR
   ======================================== */

.sidebar-footer {
	padding: 16px 20px;
	border-top: 1px solid #e0e0e0;
	background: #f5f5f5;
	flex-shrink: 0;
}

.view-all-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 16px;
	background: transparent;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	color: #374151;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	transition: all 0.2s ease;
	text-align: center;
}

.view-all-btn:hover {
	background: #2563eb;
	color: white;
	border-color: #2563eb;
}

.view-all-btn svg {
	flex-shrink: 0;
	width: 16px;
	height: 16px;
}

/* ========================================
   RESPONSIVE - MÓVIL
   ======================================== */

@media (max-width: 768px) {
	/* تصغير بعض الأحجام للشاشات الصغيرة جداً */
	.sidebar-course-header {
		padding: 16px;
	}
	
	.course-title {
		font-size: 16px;
	}
	
	.sidebar-quick-nav {
		padding: 12px;
		gap: 6px;
	}
	
	.quick-nav-btn {
		padding: 8px 12px;
		font-size: 0.8125rem;
	}
	
	.quick-nav-btn .btn-text {
		font-size: 0.8125rem;
	}
	
	.leccion-link {
		padding: 12px 16px;
		font-size: 13px;
		gap: 10px;
	}
	
	.tab-btn {
		padding: 12px;
		font-size: 12px;
		gap: 4px;
	}
	
	.tab-btn svg {
		width: 12px;
		height: 12px;
	}
	
	.sidebar-footer {
		padding: 12px 16px;
	}
	
	.view-all-btn {
		padding: 8px 14px;
		font-size: 12px;
	}
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */

[data-theme="dark"] .educational-sidebar {
	background: #1f1f1f;
	border-right-color: #333;
}

[data-theme="dark"] .sidebar-course-header,
[data-theme="dark"] .sidebar-quick-nav,
[data-theme="dark"] .sidebar-footer {
	background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
	border-color: #374151;
}

[data-theme="dark"] .quick-nav-btn {
	background: #1f2937;
	color: #f9fafb;
	border-color: #374151;
}

[data-theme="dark"] .quick-nav-btn:hover {
	background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
	color: white;
	border-color: #3b82f6;
}

[data-theme="dark"] .category-title {
	background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
	color: #9ca3af;
	border-left-color: #60a5fa;
}

[data-theme="dark"] .category-title svg {
	color: #60a5fa;
}

[data-theme="dark"] .course-title {
	color: #e5e5e5;
}

[data-theme="dark"] .leccion-link {
	background: #1f1f1f;
	color: #d1d5db;
	border-bottom-color: #333;
}

[data-theme="dark"] .leccion-link:hover {
	background: #2a2a2a;
}

[data-theme="dark"] .leccion-item.current-leccion .leccion-link {
	background: #2a2a2a;
	color: #ffffff;
	border-right-color: #2563eb;
}

[data-theme="dark"] .leccion-item {
	border-bottom-color: #333;
}

[data-theme="dark"] .tabs-header {
	background: #1f1f1f;
	border-bottom-color: #333;
}

[data-theme="dark"] .tab-btn {
	color: #9ca3af;
}

[data-theme="dark"] .tab-btn:hover {
	color: #d1d5db;
	background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .tab-btn.active {
	color: #60a5fa;
	border-bottom-color: #60a5fa;
}

[data-theme="dark"] .view-all-btn {
	background: transparent;
	color: #d1d5db;
	border-color: #333;
}

[data-theme="dark"] .view-all-btn:hover {
	background: #2563eb;
	color: white;
	border-color: #2563eb;
}

[data-theme="dark"] .no-lecciones,
[data-theme="dark"] .no-items {
	color: #6b7280;
}

[data-theme="dark"] .leccion-link::before {
	border-color: #4b5563;
}

/* دعم إضافي لزر الإغلاق في الموبايل */
[data-theme="dark"] .sidebar-mobile-toggle {
	background: #2563eb;
	box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

[data-theme="dark"] .sidebar-mobile-toggle:hover {
	background: #1d4ed8;
}

[data-theme="dark"] .mobile-sidebar-trigger {
	background: #2563eb;
	box-shadow: 0 4px 15px rgba(37, 99, 235, 0.35);
}

[data-theme="dark"] .mobile-sidebar-trigger:hover {
	background: #1d4ed8;
	box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

