:root {
	/* Fonts */
	--font-primary: "Vazirmatn", "Cairo", "Dubai", sans-serif;
	--font-arabic: "Scheherazade New", "Amiri", "Traditional Arabic", serif;

	/* Light Mode - Masjidi Inspired */
	--primary-blue: #0981e9;
	--secondary-blue: #0771d1;
	--accent-blue: #4da8f0;
	--background: #f8fafc;
	--surface: #ffffff;
	--text-primary: #1e293b;
	--text-secondary: #64748b;
	--text-muted: #adb5bd;
	--success: #10b981;
	--warning: #f59e0b;
	--error: #ef4444;
	--border: #e2e8f0;
	--shadow-light: 0 10px 25px rgba(0, 0, 0, 0.1);
	--shadow-card: 0 4px 12px rgba(0, 0, 0, 0.08);
	--radius-lg: 16px;
	--radius-xl: 20px;
}

:root.dark {
	/* Dark Mode - Masjidi Inspired */
	--background: #0f1320;
	--surface: #14192b;
	--tertiary-surface: #1a2035;
	--primary-blue: #0981e9;
	--secondary-blue: #0771d1;
	--accent-blue: #4da8f0;
	--dark-accent: #00a085;
	--text-primary: #e8ecf1;
	--text-secondary: #a9b2c0;
	--text-muted: #6b7280;
	--success: #10b981;
	--warning: #f59e0b;
	--error: #ef4444;
	--border: #1f2740;
	--shadow-light: 0 10px 25px rgba(0, 0, 0, 0.3);
	--shadow-card: 0 4px 12px rgba(0, 0, 0, 0.2);
}
* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	scroll-behavior: smooth;
	-webkit-text-size-adjust: 100%;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

body {
	font-family: var(--font-primary);
	background: var(--background);
	color: var(--text-primary);
	transition: all 0.3s ease-in-out;
	line-height: 1.6;
	direction: rtl;
	overflow-x: hidden;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
}

/* Touch-friendly improvements */
button,
.clickable {
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	min-height: 44px;
	min-width: 44px;
}

.app-container {
	min-height: 100vh;
	width: 100%;
	display: grid;
	grid-template-columns: var(--sidebar-width, 310px) 1fr;
	gap: 0;
	transition: grid-template-columns 0.3s ease;
}

.app-container.sidebar-collapsed {
	--sidebar-width: 0px;
	grid-template-columns: 0px 1fr;
}

/* Header */
.app-header {
	grid-column: 1 / -1;
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	padding: 1rem 1.5rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	position: sticky;
	top: 0;
	z-index: 100;
}

.header-left {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.menu-toggle {
	width: 48px;
	height: 48px;
	background: var(--background);
	border: 1px solid var(--border);
	border-radius: 12px;
	color: var(--text-secondary);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	box-shadow: var(--shadow-card);
}

.menu-toggle:hover {
	background: var(--primary-blue);
	color: white;
	transform: translateY(-2px);
	box-shadow: var(--shadow-light);
}

.menu-icon {
	width: 24px;
	height: 24px;
}

.app-title {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.app-icon {
	width: 48px;
	height: 48px;
	background: linear-gradient(
		135deg,
		var(--primary-blue),
		var(--secondary-blue)
	);
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: calc(24px * var(--font-scale, 1));
	color: white;
	box-shadow: var(--shadow-card);
}

.app-title h1 {
	font-size: calc(32px * var(--font-scale, 1));
	font-weight: 700;
	color: var(--text-primary);
	letter-spacing: -0.5px;
	font-family: var(--font-primary);
}

.header-right {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.font-size-btn {
	width: 48px;
	height: 48px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	color: var(--text-secondary);
	cursor: pointer;
	font-size: calc(20px * var(--font-scale, 1));
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	box-shadow: var(--shadow-card);
}

.font-size-btn:hover {
	background: var(--primary-blue);
	color: white;
	transform: translateY(-2px);
	box-shadow: var(--shadow-light);
}

.font-size-btn svg {
	width: 20px;
	height: 20px;
}

.theme-toggle {
	width: 48px;
	height: 48px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 12px;
	color: var(--text-secondary);
	cursor: pointer;
	font-size: calc(20px * var(--font-scale, 1));
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	box-shadow: var(--shadow-card);
}

.theme-toggle:hover {
	background: var(--primary-blue);
	color: white;
	transform: translateY(-2px);
	box-shadow: var(--shadow-light);
}

.sun-icon,
.moon-icon {
	width: 24px;
	height: 24px;
}
/* Sidebar */
.sidebar {
	background: var(--surface);
	border-left: 1px solid var(--border);
	padding: 1.5rem;
	overflow-y: auto;
	overflow-x: hidden;
	height: calc(100vh - 65px);
	transform: translateX(0);
	transition: all 0.3s ease;
	position: relative;
	-webkit-overflow-scrolling: touch;
	scroll-behavior: smooth;
	overscroll-behavior: contain;
}

.sidebar.collapsed {
	transform: translateX(100%);
	padding: 0;
	width: 0;
	min-width: 0;
}

.search-container {
	margin-bottom: 1.5rem;
	opacity: 1;
	transition: opacity 0.3s ease;
}

.sidebar.collapsed .search-container {
	opacity: 0;
}

.search-wrapper {
	position: relative;
}

.search-icon {
	position: absolute;
	right: 1rem;
	top: 50%;
	transform: translateY(-50%);
	color: var(--text-muted);
	width: 20px;
	height: 20px;
}

.search-input {
	width: 100%;
	padding: 0.75rem 2.5rem 0.75rem 1rem;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: var(--background);
	color: var(--text-primary);
	font-size: calc(1.1rem * var(--font-scale, 1));
	font-family: inherit;
	transition: all 0.3s ease;
	outline: none;
}

.search-input:focus {
	border-color: var(--primary-blue);
	box-shadow: 0 0 0 3px rgba(92, 129, 239, 0.1);
}

.search-input:focus + .search-icon {
	color: var(--primary-blue);
}

.search-input::placeholder {
	color: var(--text-muted);
}

/* Rules List with Accordion */
.rules-list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	opacity: 1;
	transition: opacity 0.3s ease;
}

.sidebar.collapsed .rules-list {
	opacity: 0;
}

/*.category-section {
  margin-bottom: 1rem;
}*/

.category-header {
	padding: 0.875rem 1rem;
	background: var(--primary-blue);
	color: white;
	border: 1px solid var(--primary-blue);
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.3s ease;
	font-weight: 600;
	font-size: calc(1.1rem * var(--font-scale, 1));
	text-align: right;
	display: flex;
	align-items: center;
	justify-content: space-between;
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	/* gap: 0.75rem; */
}

.category-header:hover {
	background: var(--secondary-blue);
	border-color: var(--secondary-blue);
	/* transform: translateY(-1px); */
}

.category-header.expanded {
	border-bottom-left-radius: 4px;
	border-bottom-right-radius: 4px;
	margin-bottom: 0;
}

.category-icon {
	width: 20px;
	height: 20px;
	transition: transform 0.3s ease;
}

.category-header.expanded .category-icon {
	transform: rotate(180deg);
}

.category-content {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
	background: var(--background);
	border: 1px solid var(--border);
	border-top: none;
	border-bottom-left-radius: var(--radius-lg);
	border-bottom-right-radius: var(--radius-lg);
	padding: 0 0.5rem;
	opacity: 0;
	width: 100%;
	box-sizing: border-box;
}

.category-content.expanded {
	max-height: 1000px;
	padding: 0.5rem;
	opacity: 1;
}

.rule-item {
	padding: 0.75rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 6px;
	color: var(--text-primary);
	cursor: pointer;
	transition: all 0.3s ease;
	font-weight: 400;
	font-size: calc(1rem * var(--font-scale, 1));
	text-align: right;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
	/* width: 100%; */
	box-sizing: border-box;
	min-width: 0;
}

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

.rule-item:hover {
	background: var(--secondary-blue);
	color: white;
	transform: translateX(-3px);
	box-shadow: var(--shadow-card);
	border-color: var(--secondary-blue);
}

.rule-item.active {
	/*background: var(--secondary-blue);
	color: white; */
	border-color: var(--secondary-blue);
	box-shadow: var(--shadow-card);
	transform: translateX(-3px);
}

.rule-icon {
	width: 18px;
	height: 18px;
	opacity: 0.7;
	flex-shrink: 0;
}

/* Category Icons */
.category-header .category-icon {
	transition: transform 0.3s ease;
}

/* Empty state */
.no-results {
	padding: 2rem;
	text-align: center;
	color: var(--text-muted);
	font-style: italic;
}

/* Category counter */
.category-counter {
	background: rgba(255, 255, 255, 0.2);
	color: white;
	width: 27px;
	aspect-ratio: 1/1;
	border-radius: 50%;
	font-size: calc(0.75rem * var(--font-scale, 1));
	font-weight: 500;
	margin-right: 0.5rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	line-height: 1;
	text-align: center;
}
/* Main Content */
.main-content {
	padding: 1.5rem;
	overflow-y: auto;
	height: calc(100vh - 65px);
	background: var(--background);
	--font-scale: 1; /* Default font scale, can be changed by JavaScript */
}

.content-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 1.5rem;
	margin-bottom: 1.5rem;
	transition: all 0.3s ease;
}

.content-card h2 {
	font-size: calc(2rem * var(--font-scale, 1));
	font-weight: 600;
	color: var(--primary-blue);
	margin-bottom: 1rem;
	text-align: right;
	line-height: 1.4;
	font-family: var(--font-primary);
}

.content-card h3 {
	font-size: calc(1.25rem * var(--font-scale, 1));
	font-weight: 600;
	color: var(--secondary-blue);
	margin: 2.5rem 0 0 0;
	text-align: right;
	font-family: var(--font-primary);
}

.content-card p {
	font-size: calc(1.2rem * var(--font-scale, 1));
	line-height: 1.6;
	color: var(--text-primary);
	margin-bottom: 1rem;
	text-align: right;
}

.content-card ul {
	list-style: none;
	padding: 0;
	margin: 1rem 0;
}

.content-card li {
	padding: 0.5rem 0;
	color: var(--text-secondary);
	font-size: calc(1.1rem * var(--font-scale, 1));
	line-height: 1.6;
	border-bottom: 1px solid var(--border);
	text-align: right;
}

.content-card li:last-child {
	border-bottom: none;
}

.content-card li::before {
	content: "•";
	color: var(--accent-blue);
	font-weight: bold;
	margin-left: 0.5rem;
}
.example-box {
	background: var(--background);
	border: 1px solid var(--border);
	padding: 1.5rem;
	border-radius: var(--radius-lg);
	margin: 1rem 0;
	transition: all 0.3s ease;
	text-align: right;
}

.example-box strong {
	color: var(--accent-blue);
	font-weight: 600;
	display: block;
	margin-bottom: 0.5rem;
}

/* Enhanced Examples Display */
.examples-grid {
	display: grid;
	gap: 1rem;
	margin: 1.5rem 0;
}

.example-item {
	background: linear-gradient(
		135deg,
		var(--surface) 0%,
		var(--background) 100%
	);
	border: 2px solid var(--border);
	border-radius: var(--radius-lg);
	padding: 1.5rem;
	transition: all 0.3s ease;
	position: relative;
	overflow: hidden;
}

.example-item:hover {
	border-color: var(--primary-blue);
	box-shadow: var(--shadow-light);
	transform: translateY(-2px);
}

.example-item::before {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	width: 4px;
	height: 100%;
	background: linear-gradient(180deg, var(--primary-blue), var(--accent-blue));
}

.example-arabic {
	font-family: var(--font-arabic);
	font-size: calc(28px * var(--font-scale, 1));
	font-weight: 500;
	line-height: 1.8;
	color: var(--text-primary);
	text-align: center;
	margin: 1rem 0;
	padding: 1rem;
	background: rgba(92, 129, 239, 0.05);
	border-radius: 12px;
	border: 1px dashed var(--primary-blue);
	letter-spacing: 2px;
}

.example-label {
	font-size: calc(14px * var(--font-scale, 1));
	font-weight: 600;
	color: var(--accent-blue);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 0.5rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.example-label::before {
	content: "";
	width: 8px;
	height: 8px;
	background: var(--accent-blue);
	border-radius: 50%;
}

.example-explanation {
	font-size: calc(16px * var(--font-scale, 1));
	color: var(--text-secondary);
	margin-top: 1rem;
	padding: 1rem;
	background: var(--background);
	border-radius: 8px;
	border-right: 3px solid var(--accent-blue);
}

/* Educational Rule Display */
.rule-educational {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 1.25rem;
	/*margin: 1rem 0; */
	position: relative;
}

.rule-header-with-share {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1rem;
}

.rule-title-educational {
	font-size: calc(2rem * var(--font-scale, 1));
	font-weight: 600;
	color: var(--primary-blue);
	margin-bottom: 0;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid var(--border);
	font-family: var(--font-primary);
	flex: 1;
}

.share-rule-btn {
	background: var(--primary-blue);
	color: white;
	border: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.3s ease;
	flex-shrink: 0;
	box-shadow: 0 2px 8px rgba(92, 129, 239, 0.3);
}

.share-rule-btn:hover {
	background: var(--secondary-blue);
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(92, 129, 239, 0.4);
}

.share-rule-btn:active {
	transform: translateY(0);
}

.share-rule-btn svg {
	width: 20px;
	height: 20px;
}

.share-notification {
	position: fixed;
	bottom: 30px;
	left: 50%;
	transform: translateX(-50%) translateY(100px);
	background: var(--success);
	color: white;
	padding: 12px 24px;
	border-radius: 8px;
	font-family: var(--font-primary);
	font-size: calc(1rem * var(--font-scale, 1));
	font-weight: 600;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
	z-index: 10000;
	opacity: 0;
	transition: all 0.3s ease;
	pointer-events: none;
}

.share-notification.show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
	.rule-header-with-share {
		flex-direction: row;
		align-items: flex-start;
	}

	.rule-title-educational {
		font-size: calc(1.5rem * var(--font-scale, 1));
	}

	.share-rule-btn {
		width: 36px;
		height: 36px;
	}

	.share-rule-btn svg {
		width: 18px;
		height: 18px;
	}
}

.rule-definition {
	font-size: calc(1.2rem * var(--font-scale, 1));
	line-height: 1.6;
	color: var(--text-primary);
	background: rgba(92, 129, 239, 0.05);
	padding: 1rem;
	border-radius: 6px;
	margin: 1rem 0;
	border-right: 3px solid var(--primary-blue);
}

.rule-summary {
	background: var(--success);
	color: white;
	padding: 1rem;
	border-radius: 6px;
	margin: 1rem 0;
	font-weight: 500;
	font-size: calc(1.1rem * var(--font-scale, 1));
	line-height: 1.5;
}

.rule-summary::before {
	content: "💡";
	display: inline;
	font-size: calc(16px * var(--font-scale, 1));
	margin-left: 0.5rem;
}

.letters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 1rem 0;
	/* justify-content: center; */
}

.letters span {
	padding: 0.75rem 1.5rem;
	background: var(--primary-blue);
	color: white;
	border-radius: 25px;
	font-weight: 500;
	font-size: calc(2rem * var(--font-scale, 1));
	font-family: var(--font-primary);
	transition: all 0.2s ease;
	min-width: calc(5rem * var(--font-scale, 1));
	text-align: center;
	box-sizing: border-box;
}

.letters span:hover {
	transform: translateY(-1px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Examples Grid - More Compact */
.examples-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 0.75rem;
	margin: 1rem 0;
}

.example-category-title {
	font-size: calc(1.3rem * var(--font-scale, 1));
	font-weight: 600;
	color: var(--primary-blue);
	margin-top: 1.5rem;
	margin-bottom: 0.75rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--border);
	font-family: var(--font-primary);
}

.example-item {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 0.75rem;
	transition: all 0.2s ease;
}

.example-item:hover {
	border-color: var(--primary-blue);
	box-shadow: 0 2px 12px rgba(92, 129, 239, 0.15);
	transform: translateY(-1px);
}

.example-label {
	font-size: calc(0.8rem * var(--font-scale, 1));
	font-weight: 600;
	color: var(--primary-blue);
	margin-bottom: 0.4rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.example-arabic {
	font-family: var(--font-arabic);
	font-size: calc(1.75rem * var(--font-scale, 1));
	font-weight: 600;
	color: var(--text-primary);
	text-align: center;
	margin: 0.5rem 0;
	padding: 0.6rem;
	background: rgba(92, 129, 239, 0.05);
	border-radius: 6px;
	border: 1px solid rgba(92, 129, 239, 0.1);
	line-height: 1.4;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
}

.play-audio-btn {
	background: var(--primary-blue);
	border: none;
	border-radius: 50%;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: white;
	transition: all 0.3s ease;
	flex-shrink: 0;
}

.play-audio-btn:hover {
	background: var(--secondary-blue);
	transform: scale(1.1);
}

.play-audio-btn:active {
	transform: scale(0.95);
}

.play-audio-btn svg {
	margin-right: 2px;
}

.example-explanation {
	font-size: calc(1rem * var(--font-scale, 1));
	color: var(--text-secondary);
	line-height: 1.4;
	margin-top: 0.4rem;
	padding-top: 0.4rem;
	border-top: 1px solid var(--border);
}

.educational-notes {
	margin: 1rem 0;
	padding: 0;
	list-style: none;
}

.educational-notes li {
	background: rgba(var(--warning-rgb), 0.1);
	border-right: 3px solid var(--warning);
	padding: 0.75rem;
	margin-bottom: 0.5rem;
	border-radius: 4px;
	font-size: calc(1.3rem * var(--font-scale, 1));
	line-height: 1.6;
}

.educational-notes li::before {
	content: "📝";
	margin-left: 0.5rem;
}
/* Mobile Sidebar Overlay */
.sidebar-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	z-index: 150;
	opacity: 0;
	transition: opacity 0.3s ease;
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	cursor: pointer;
}

.sidebar-overlay.active {
	display: block;
	opacity: 1;
	pointer-events: auto;
}

/* Responsive Design */
@media (max-width: 1024px) {
	.app-container {
		grid-template-columns: 1fr;
	}

	.sidebar {
		position: fixed;
		top: 0;
		right: 0;
		width: min(85vw, 360px);
		height: 100vh;
		height: 100dvh;
		z-index: 200;
		transform: translateX(100%);
		box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
		transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
		padding-top: 1rem;
		border-left: none;
		border-radius: 20px 0 0 20px;
		/* Mobile scroll improvements */
		-webkit-overflow-scrolling: touch;
		overscroll-behavior-y: contain;
		touch-action: pan-y;
	}

	.sidebar.open {
		transform: translateX(0);
	}

	/* Improve mobile scroll */
	.sidebar .rules-list {
		padding-bottom: 60px; /* Extra space at bottom for easy scrolling to last item */
	}

	/* Custom scrollbar for mobile - thin and subtle */
	.sidebar::-webkit-scrollbar {
		width: 4px;
	}

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

	.sidebar::-webkit-scrollbar-thumb {
		background: var(--border);
		border-radius: 4px;
	}

	.sidebar::before {
		content: "";
		position: absolute;
		top: 12px;
		left: 50%;
		transform: translateX(-50%);
		width: 40px;
		height: 4px;
		background: var(--border);
		border-radius: 2px;
		opacity: 0.6;
	}

	.sidebar .search-container {
		margin-top: 1rem;
	}

	.menu-toggle {
		display: flex;
	}

	.app-title h1 {
		font-size: calc(24px * var(--font-scale, 1));
	}

	.main-content {
		height: calc(100vh - 88px);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}
}

@media (min-width: 1025px) {
	.menu-toggle {
		display: flex;
	}
}

@media (max-width: 768px) {
	.app-header {
		padding: 1rem;
	}

	.app-title h1 {
		font-size: calc(20px * var(--font-scale, 1));
	}

	.app-icon,
	.theme-toggle,
	.menu-toggle {
		width: 44px;
		height: 44px;
		font-size: calc(18px * var(--font-scale, 1));
	}

	.font-size-btn {
		width: 44px;
		height: 44px;
	}

	.font-size-btn svg {
		width: 18px;
		height: 18px;
	}

	.sidebar {
		width: min(90vw, 320px);
		padding: 1.5rem;
		padding-top: 2rem;
	}

	.main-content {
		padding: 1rem;
	}

	.content-card {
		padding: 1.5rem;
		margin-bottom: 1rem;
	}

	.content-card h2 {
		font-size: calc(24px * var(--font-scale, 1));
	}

	.content-card p {
		font-size: calc(18px * var(--font-scale, 1));
	}

	/* Compact Examples on Mobile */
	.examples-grid {
		grid-template-columns: 1fr;
		gap: 0.5rem;
	}

	.example-item {
		padding: 0.6rem;
	}

	.example-arabic {
		font-size: calc(1.6rem * var(--font-scale, 1));
		padding: 0.5rem;
		margin: 0.4rem 0;
	}

	.example-label {
		font-size: calc(0.75rem * var(--font-scale, 1));
		margin-bottom: 0.3rem;
	}

	.example-explanation {
		font-size: calc(1rem * var(--font-scale, 1));
		margin-top: 0.3rem;
		padding-top: 0.3rem;
	}
}

/* Extra small devices */
@media (max-width: 480px) {
	.app-header {
		padding: 0.75rem;
	}

	.app-title h1 {
		font-size: calc(18px * var(--font-scale, 1));
	}

	.sidebar {
		width: 85vw;
		max-width: 320px;
		border-radius: 16px 0 0 16px;
		padding: 1rem;
		padding-top: 2rem;
	}

	.main-content {
		padding: 0.75rem;
	}

	.content-card {
		padding: 1rem;
		margin-bottom: 0.75rem;
	}

	.content-card h2 {
		font-size: calc(22px * var(--font-scale, 1));
		margin-bottom: 0.75rem;
	}

	.example-arabic {
		font-size: calc(1.5rem * var(--font-scale, 1));
		padding: 0.4rem;
	}

	.nav-item {
		padding: 0.75rem 1rem;
		font-size: calc(0.9rem * var(--font-scale, 1));
	}

	.rule-definition {
		font-size: calc(1.1rem * var(--font-scale, 1));
		padding: 0.75rem;
	}

	.educational-notes li {
		padding: 0.6rem;
		font-size: calc(1.2rem * var(--font-scale, 1));
	}
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
	.app-header {
		padding: 0.5rem 1rem;
	}

	.main-content {
		height: calc(100vh - 60px);
	}

	.sidebar {
		top: 60px;
		height: calc(100vh - 60px);
	}
}

/* Loading State */
.loading {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 200px;
	color: var(--text-muted);
	font-size: calc(18px * var(--font-scale, 1));
}

/* Navigation Controls */
.control-btn {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1.25rem;
	border: 1px solid var(--border);
	border-radius: 8px;
	background: var(--background);
	color: var(--text-primary);
	cursor: pointer;
	transition: all 0.3s ease;
	font-size: calc(0.95rem * var(--font-scale, 1));
	font-weight: 500;
	font-family: var(--font-primary);
	text-decoration: none;
}

.control-btn:hover:not(:disabled) {
	background: var(--surface);
	border-color: var(--primary-blue);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(92, 129, 239, 0.15);
}

.control-btn:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

.control-btn .btn-icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.controls {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	margin-top: 2rem;
	padding: 1rem 0;
	border-top: 1px solid var(--border);
}

/* Notes Styling */
.notes {
	/* margin-top: 1rem; */
	padding: 1rem;
	background: var(--surface);
	border-radius: 8px;
	border-right: 4px solid var(--primary-blue);
}

.note-item {
	margin-bottom: 0.5rem;
	color: var(--text-secondary);
	line-height: 1.6;
	font-size: calc(1.2rem * var(--font-scale, 1));
}
.note-item::before {
	content: "- ";
}

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

/* Memory Summary Styling */
.memory-summary {
	margin-top: 2rem;
	padding: 1.5rem;
	background: linear-gradient(
		135deg,
		var(--surface) 0%,
		var(--background) 100%
	);
	border-radius: 12px;
	border: 2px solid var(--primary-blue);
	box-shadow: 0 4px 16px rgba(92, 129, 239, 0.1);
}

.memory-summary-title {
	font-size: calc(1.5rem * var(--font-scale, 1)) !important;
	font-weight: 700 !important;
	color: var(--primary-blue) !important;
	margin: 0 !important;
	font-family: var(--font-primary);

	padding-bottom: 0.5rem;
}

.memory-summary-content {
	/* margin-top: 1rem; */
}

.memory-summary-paragraph {
	margin: 0;
	color: var(--text-primary);
	line-height: 1.9;
	font-size: calc(1.2rem * var(--font-scale, 1));
	font-weight: 400;
	text-align: right;
}

.memory-summary-list {
	margin: 0;
	padding-right: 1.5rem;
	color: var(--text-primary);
	line-height: 1.9;
	font-size: calc(1.2rem * var(--font-scale, 1));
	font-weight: 400;
	text-align: right;
}

.memory-summary-list li {
	margin-bottom: 0.5rem;
}

.memory-summary-list li:last-child {
	margin-bottom: 0;
}

.memory-summary-item:last-child {
	margin-bottom: 0;
}

/* Loading Spinner Animation */
@keyframes spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

.spinning {
	animation: spin 1s linear infinite;
}

/* Audio Button Enhanced States */
.play-audio-btn.loading {
	opacity: 0.7;
	cursor: wait;
}

.play-audio-btn.playing {
	background: var(--error);
	border-color: var(--error);
}

.play-audio-btn.playing:hover {
	background: #dc2626;
	transform: scale(1.05);
}

/* Subsection Styling */
.subsection {
	margin: 1.5rem 0;
	padding: 1.25rem;
	background: var(--background);
	border-radius: 12px;
	border-right: 4px solid var(--primary-blue);
}

.subsection-title {
	font-family: var(--font-primary);
	font-size: calc(1.3rem * var(--font-scale, 1));
	font-weight: 700;
	color: var(--primary-blue);
	margin: 0 0 0.75rem 0;
}

.subsection-definition {
	font-size: calc(1.2rem * var(--font-scale, 1));
	color: var(--text-secondary);
	margin-bottom: 1rem;
	line-height: 1.8;
	padding: 0.75rem;
	background: var(--surface);
	border-radius: 8px;
}

.subsection-note {
	margin-top: 1rem;
	padding: 0.75rem 1rem;
	background: var(--surface);
	border-radius: 8px;
	color: var(--text-secondary);
	font-size: calc(0.95rem * var(--font-scale, 1));
	border-right: 3px solid var(--warning);
}

.category-definition {
	font-size: calc(1.2rem * var(--font-scale, 1));
	color: var(--text-secondary);
	margin: 0.75rem 0 1.25rem 0;
	padding: 1rem;
	background: var(--surface);
	border-radius: 8px;
	line-height: 1.8;
	border-right: 3px solid var(--accent-blue);
	white-space: pre-wrap;
}

.category-note {
	margin-top: 1rem;
	padding: 0.75rem 1rem;
	background: var(--surface);
	border-radius: 8px;
	color: var(--text-secondary);
	font-size: calc(0.95rem * var(--font-scale, 1));
	border-right: 3px solid var(--success);
}

.example-explanation {
	font-size: calc(0.9rem * var(--font-scale, 1));
	color: var(--text-secondary);
	margin-top: 0.5rem;
	padding: 0.5rem;
	background: var(--background);
	border-radius: 6px;
	/* font-style: italic; */
}

/* Reciter Card Dropdown */
.reciter-card {
	background: var(--surface, #fff);
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.13);
	border-radius: 14px;
	min-width: 220px;
	max-width: 420px;
	padding: 0.5rem 0;
	z-index: 1000;
	position: absolute;
	top: 110%;
	left: 0;
	overflow: hidden;
	border: 1px solid var(--border, #e2e8f0);
}

.reciter-list {
	max-height: 260px;
	overflow-y: auto;
	padding: 0.25rem 0;
}

.reciter-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.7rem 1.2rem;
	cursor: pointer;
	font-family: var(--font-primary);
	font-size: calc(1rem * var(--font-scale, 1));
	color: var(--primary-blue);
	transition: background 0.15s;
}
.reciter-item:hover {
	background: var(--primary-blue, #e6f0fa);
	color: white;
}
.reciter-item.selected {
	background: none;
	color: var(--primary-blue);
	font-weight: 600;
}
.reciter-check {
	width: 20px;
	height: 20px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--primary-blue);
	font-size: calc(1.2em * var(--font-scale, 1));
}

/* Photo Gallery Styles */
.photos-gallery {
	margin: 1.5rem 0;
	padding: 1rem;
	background: linear-gradient(
		135deg,
		rgba(16, 185, 129, 0.08) 0%,
		rgba(16, 185, 129, 0.03) 100%
	);
	border: 2px solid rgba(16, 185, 129, 0.3);
	border-radius: var(--radius-lg);
}

/* Photo Gallery Section for app.js display */
.photo-gallery-section {
	margin: 1.5rem 0;
}

.photo-gallery-title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 1rem;
	color: var(--primary-blue);
	font-weight: 600;
	font-size: calc(1.1rem * var(--font-scale, 1));
}

.photo-gallery-title svg {
	flex-shrink: 0;
}

.photo-gallery {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1rem;
	padding: 1rem;
	background: linear-gradient(
		135deg,
		rgba(9, 129, 233, 0.08) 0%,
		rgba(9, 129, 233, 0.03) 100%
	);
	border: 2px solid rgba(9, 129, 233, 0.3);
	border-radius: var(--radius-lg);
}

@media (max-width: 768px) {
	.photo-gallery {
		grid-template-columns: 1fr;
	}
}

.photos-gallery-header {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 1rem;
	color: #059669;
	font-weight: 600;
	font-size: calc(1rem * var(--font-scale, 1));
}

.photos-gallery-header svg {
	flex-shrink: 0;
}

.photos-gallery-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1rem;
}

.photo-gallery-item {
	position: relative;
	border-radius: 12px;
	overflow: hidden;
	background: var(--surface);
	box-shadow: var(--shadow-card);
	transition: all 0.3s ease;
	cursor: pointer;
}

.photo-gallery-item:hover {
	transform: translateY(-4px);
	box-shadow: var(--shadow-light);
}

.photo-gallery-item img {
	width: 100%;
	height: auto;
	display: block;
	transition: transform 0.3s ease;
}

.photo-gallery-item:hover img {
	transform: scale(1.05);
}

.photo-gallery-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 40%);
	opacity: 0;
	transition: opacity 0.3s ease;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: 1rem;
}

.photo-gallery-item:hover .photo-gallery-overlay {
	opacity: 1;
}

.photo-gallery-expand {
	background: rgba(255, 255, 255, 0.9);
	color: #1e293b;
	border: none;
	border-radius: 8px;
	padding: 0.5rem 1rem;
	font-size: calc(0.875rem * var(--font-scale, 1));
	font-weight: 600;
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	transition: all 0.2s ease;
}

.photo-gallery-expand:hover {
	background: white;
	transform: scale(1.05);
}

/* Photo Lightbox */
.photo-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.95);
	z-index: 10000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.photo-lightbox-backdrop {
	position: absolute;
	inset: 0;
	cursor: pointer;
}

.photo-lightbox-content {
	max-width: 90vw;
	max-height: 90vh;
	position: relative;
	z-index: 1;
}

.photo-lightbox-content img {
	max-width: 100%;
	max-height: 85vh;
	object-fit: contain;
	border-radius: 8px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.photo-lightbox-caption {
	display: none;
}

.photo-lightbox-close {
	position: fixed;
	top: 20px;
	right: 20px;
	background: rgba(255, 255, 255, 0.95);
	border: none;
	color: #333;
	cursor: pointer;
	padding: 0.75rem;
	border-radius: 50%;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
	z-index: 10001;
}

.photo-lightbox-close:hover {
	background: white;
	transform: scale(1.1);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.photo-lightbox-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	background: rgba(255, 255, 255, 0.2);
	border: none;
	color: white;
	font-size: calc(2rem * var(--font-scale, 1));
	cursor: pointer;
	padding: 1rem;
	border-radius: 50%;
	transition: all 0.2s;
}

.photo-lightbox-nav:hover {
	background: rgba(255, 255, 255, 0.3);
}

.photo-lightbox-nav.prev {
	left: -60px;
}

.photo-lightbox-nav.next {
	right: -60px;
}

.photo-lightbox-counter {
	position: absolute;
	bottom: -40px;
	left: 50%;
	transform: translateX(-50%);
	color: white;
	font-size: calc(0.9rem * var(--font-scale, 1));
	opacity: 0.8;
}

/* Mobile responsive for photos */
@media (max-width: 768px) {
	.photos-gallery-grid {
		grid-template-columns: 1fr;
	}

	.photo-lightbox-nav.prev {
		left: 10px;
	}

	.photo-lightbox-nav.next {
		right: 10px;
	}

	.photo-lightbox-close {
		top: 10px;
		right: 10px;
		position: fixed;
	}
}

/* Dark mode for photos */
:root.dark .photos-gallery {
	background: linear-gradient(
		135deg,
		rgba(16, 185, 129, 0.12) 0%,
		rgba(16, 185, 129, 0.05) 100%
	);
	border-color: rgba(16, 185, 129, 0.4);
}

:root.dark .photo-gallery {
	background: linear-gradient(
		135deg,
		rgba(9, 129, 233, 0.12) 0%,
		rgba(9, 129, 233, 0.05) 100%
	);
	border-color: rgba(9, 129, 233, 0.4);
}

:root.dark .photo-gallery-title {
	color: var(--accent-blue);
}

:root.dark .photo-gallery-item {
	background: var(--tertiary-surface);
}

:root.dark .photo-gallery-expand {
	background: rgba(30, 41, 59, 0.9);
	color: white;
}

:root.dark .photo-gallery-expand:hover {
	background: rgba(30, 41, 59, 1);
}
