/* ========================================
   بصائر - الأنماط الرئيسية
   ======================================== */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400;1,700&family=Tajawal:wght@300;400;500;700;800;900&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-primary: #0a0e27;
  --bg-secondary: #111640;
  --bg-card: rgba(17, 22, 64, 0.7);
  --bg-card-hover: rgba(26, 5, 51, 0.8);
  --gradient-purple: linear-gradient(135deg, #1a0533, #2d1854);
  --gradient-main: linear-gradient(135deg, #0a0e27, #1a0533, #0a0e27);
  --gradient-accent: linear-gradient(135deg, #6c3fa0, #c23a7a);
  --gradient-gold: linear-gradient(135deg, #f0c040, #e8a020);
  --color-accent: #6c3fa0;
  --color-accent2: #c23a7a;
  --color-gold: #f0c040;
  --color-gold-dim: #b8922e;
  --text-primary: #e8e0f0;
  --text-secondary: #8b8aad;
  --text-dim: #5a5880;
  --border-glow: rgba(108, 63, 160, 0.3);
  --border-glow-hover: rgba(194, 58, 122, 0.5);
  --shadow-glow: 0 0 30px rgba(108, 63, 160, 0.15);
  --shadow-glow-hover: 0 0 40px rgba(194, 58, 122, 0.2);
  --radius: 16px;
  --radius-sm: 8px;
  --radius-lg: 24px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-body: 'Tajawal', sans-serif;
  --font-heading: 'Tajawal', sans-serif;
  --font-quran: 'Amiri', serif;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  text-align: right;
  line-height: 1.8;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated dot pattern background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(circle, rgba(108, 63, 160, 0.08) 1px, transparent 1px);
  background-size: 30px 30px;
  z-index: -1;
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(108, 63, 160, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(194, 58, 122, 0.06) 0%, transparent 50%);
  z-index: -1;
  pointer-events: none;
  animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(-5%, -3%); }
}

a {
  color: var(--color-accent2);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--color-gold);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--color-accent);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent2);
}

/* --- Reading Progress Bar --- */
#reading-progress {
  position: fixed;
  top: 0;
  right: 0;
  width: 0%;
  height: 3px;
  background: var(--gradient-accent);
  z-index: 10000;
  transition: width 0.1s linear;
}

/* ========================================
   Navigation
   ======================================== */
.navbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1000;
  padding: 0 2rem;
  background: rgba(10, 14, 39, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glow);
  transition: var(--transition);
}

.navbar.scrolled {
  padding: 0 2rem;
  background: rgba(10, 14, 39, 0.95);
  box-shadow: var(--shadow-glow);
}

.navbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 70px;
  position: relative;
}

.navbar-brand {
  display: none;
}

.navbar-brand-link {
  font-weight: 800;
  font-size: 1.3rem;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-left: 1rem;
  white-space: nowrap;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.navbar-links a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.navbar-links a:hover,
.navbar-links a.active {
  color: var(--text-primary);
  background: rgba(108, 63, 160, 0.15);
}

.navbar-search {
  position: relative;
}

.navbar-search input {
  background: rgba(108, 63, 160, 0.1);
  border: 1px solid var(--border-glow);
  border-radius: 30px;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  width: 200px;
  transition: var(--transition);
  direction: rtl;
}

.navbar-search input:focus {
  outline: none;
  border-color: var(--color-accent);
  width: 280px;
  background: rgba(108, 63, 160, 0.2);
}

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

.navbar-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
}

.mobile-menu-overlay.active {
  display: block;
}


/* ========================================
   Hero Section
   ======================================== */
.hero {
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 5rem 2rem 3rem;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, rgba(108, 63, 160, 0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(194, 58, 122, 0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 20% 80%, rgba(108, 63, 160, 0.06) 0%, transparent 50%);
}

/* Particles Canvas */
#hero-particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Floating glow orbs */
.hero-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108, 63, 160, 0.12), transparent 70%);
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: glowFloat 8s ease-in-out infinite;
  z-index: 0;
  pointer-events: none;
}

.hero-glow-2 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(194, 58, 122, 0.1), transparent 70%);
  top: 60%;
  left: 30%;
  animation: glowFloat2 10s ease-in-out infinite;
}

@keyframes glowFloat {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  33% { transform: translate(-45%, -55%) scale(1.15); opacity: 0.9; }
  66% { transform: translate(-55%, -45%) scale(1.05); opacity: 0.7; }
}

@keyframes glowFloat2 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
  50% { transform: translate(-40%, -60%) scale(1.2); opacity: 0.8; }
}

/* Hero Content */
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  width: 100%;
}

/* Title with shimmer effect */
.hero-title {
  font-size: 5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #6c3fa0 0%, #c23a7a 40%, #f0c040 50%, #c23a7a 60%, #6c3fa0 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
  animation: titleShimmer 4s linear infinite;
  letter-spacing: 2px;
  filter: drop-shadow(0 0 30px rgba(108, 63, 160, 0.3));
}

@keyframes titleShimmer {
  0% { background-position: 200% center; }
  100% { background-position: -200% center; }
}

.hero-subtitle {
  font-size: 1.4rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 300;
}

.hero-description {
  font-size: 1.1rem;
  color: var(--text-dim);
  margin-bottom: 1.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-author {
  font-size: 1rem;
  color: var(--color-gold-dim);
  margin-bottom: 2rem;
}

/* --- Hero Search --- */
.hero-search {
  width: 100%;
  max-width: 600px;
  margin: 0 auto 1.5rem;
  position: relative;
  z-index: 10;
}

.hero-search-box {
  position: relative;
  width: 100%;
}

.hero-search-box input {
  width: 100%;
  padding: 0.9rem 1.5rem 0.9rem 3.2rem;
  border-radius: 50px;
  border: 1px solid rgba(108, 63, 160, 0.3);
  background: rgba(17, 22, 64, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-primary);
  font-size: 1.05rem;
  font-family: var(--font-body);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  text-align: right;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hero-search-box input::placeholder {
  color: var(--text-dim);
  transition: opacity 0.3s;
}

.hero-search-box input:focus::placeholder {
  opacity: 0.4;
}

.hero-search-box input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(108, 63, 160, 0.15), 0 4px 30px rgba(108, 63, 160, 0.2);
  background: rgba(17, 22, 64, 0.8);
}

.hero-search-svg {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-dim);
  pointer-events: none;
  transition: color 0.3s;
}

.hero-search-box input:focus ~ .hero-search-svg {
  color: var(--color-accent);
}

/* Search Results Dropdown */
.hero-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: rgba(10, 14, 39, 0.97);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(108, 63, 160, 0.25);
  border-radius: 16px;
  max-height: 350px;
  overflow-y: auto;
  z-index: 200;
  display: none;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(108, 63, 160, 0.1);
  animation: dropdownSlide 0.25s ease-out;
}

@keyframes dropdownSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-search-results.active {
  display: block;
}

.hero-search-results::-webkit-scrollbar {
  width: 4px;
}

.hero-search-results::-webkit-scrollbar-track {
  background: transparent;
}

.hero-search-results::-webkit-scrollbar-thumb {
  background: var(--color-accent);
  border-radius: 10px;
}

.hero-result-item {
  display: block;
  padding: 0.9rem 1.2rem;
  text-decoration: none;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(108, 63, 160, 0.08);
  transition: all 0.2s;
  text-align: right;
}

.hero-result-item:last-child {
  border-bottom: none;
}

.hero-result-item:hover {
  background: rgba(108, 63, 160, 0.12);
  padding-right: 1.5rem;
}

.hero-result-item .result-q-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  color: var(--text-primary);
}

.hero-result-item .result-q-title mark {
  background: rgba(194, 58, 122, 0.3);
  color: var(--color-accent2);
  padding: 0 2px;
  border-radius: 3px;
}

.hero-result-item .result-q-path {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.hero-result-item .result-q-excerpt {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
  line-height: 1.4;
}

.hero-result-item .result-q-excerpt mark {
  background: rgba(194, 58, 122, 0.3);
  color: var(--color-accent2);
  padding: 0 2px;
  border-radius: 3px;
}

.hero-search-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.hero-search-count {
  padding: 0.6rem 1.2rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(108, 63, 160, 0.1);
  text-align: right;
}

/* Hero Buttons */
.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

/* Hero Stats Bar */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.8rem 2rem;
  background: rgba(17, 22, 64, 0.4);
  border: 1px solid rgba(108, 63, 160, 0.15);
  border-radius: 50px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin: 0 auto;
  width: fit-content;
}

.hero-stat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hero-stat-num {
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-stat-label {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.hero-stat-divider {
  width: 1px;
  height: 20px;
  background: rgba(108, 63, 160, 0.3);
}

/* Hero Download Buttons */
.hero-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.2rem;
}

.hero-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid rgba(108, 63, 160, 0.25);
  background: rgba(17, 22, 64, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hero-dl-btn svg {
  width: 18px;
  height: 18px;
}

.hero-dl-pdf {
  color: #e74c3c;
}

.hero-dl-pdf svg {
  stroke: #e74c3c;
}

.hero-dl-pdf:hover {
  background: rgba(220, 53, 69, 0.15);
  border-color: rgba(220, 53, 69, 0.4);
  transform: translateY(-2px);
}

.hero-dl-word {
  color: #3498db;
}

.hero-dl-word svg {
  stroke: #3498db;
}

.hero-dl-word:hover {
  background: rgba(41, 128, 185, 0.15);
  border-color: rgba(41, 128, 185, 0.4);
  transform: translateY(-2px);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 2rem;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: 0 4px 20px rgba(108, 63, 160, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(194, 58, 122, 0.5);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-glow);
}

.btn-outline:hover {
  background: rgba(108, 63, 160, 0.1);
  border-color: var(--color-accent);
  color: var(--text-primary);
}

/* ========================================
   Sections
   ======================================== */
.section {
  padding: 5rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.section-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ========================================
   Parts Cards (Homepage)
   ======================================== */
.parts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.part-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.part-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 4px;
  background: var(--gradient-accent);
  opacity: 0;
  transition: var(--transition);
}

.part-card:hover {
  transform: translateY(-8px);
  border-color: var(--border-glow-hover);
  box-shadow: var(--shadow-glow-hover);
  background: var(--bg-card-hover);
}

.part-card:hover::before {
  opacity: 1;
}

.part-number {
  font-size: 3rem;
  font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0.4;
  margin-bottom: 0.5rem;
}

.part-card-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.part-card-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.part-card-meta {
  display: flex;
  gap: 1.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.part-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* ========================================
   Stats Section
   ======================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

.stat-card {
  text-align: center;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
}

.stat-number {
  font-size: 3rem;
  font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* ========================================
   Topics Grid
   ======================================== */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.8rem;
}

.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.topic-card:hover {
  border-color: var(--border-glow-hover);
  transform: translateX(-4px);
  box-shadow: var(--shadow-glow);
}

.topic-icon {
  font-size: 1.4rem;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(108, 63, 160, 0.15);
  flex-shrink: 0;
}

.topic-info h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.topic-info p {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ========================================
   Download Section
   ======================================== */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.download-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  padding: 1.5rem 1.8rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition);
  cursor: pointer;
}

.download-card:hover {
  border-color: var(--border-glow-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.download-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.download-icon svg {
  width: 30px;
  height: 30px;
}

.download-icon-pdf {
  background: rgba(220, 53, 69, 0.15);
  color: #e74c3c;
  stroke: #e74c3c;
}

.download-icon-pdf svg {
  stroke: #e74c3c;
}

.download-icon-word {
  background: rgba(41, 128, 185, 0.15);
  color: #2980b9;
}

.download-icon-word svg {
  stroke: #2980b9;
}

.download-info {
  flex: 1;
}

.download-info h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.download-info p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.download-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.download-arrow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(108, 63, 160, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.download-arrow svg {
  width: 20px;
  height: 20px;
  stroke: var(--color-accent);
}

.download-card:hover .download-arrow {
  background: var(--gradient-accent);
}

.download-card:hover .download-arrow svg {
  stroke: #fff;
}

/* ========================================
   Part Index Page
   ======================================== */
.part-hero {
  padding: 8rem 2rem 3rem;
  text-align: center;
  position: relative;
}

.part-hero-title {
  font-size: 3rem;
  font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.part-hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
}

/* ========================================
   Table of Contents (flat layout)
   ======================================== */
.toc-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 2rem 4rem;
}

.toc-part {
  margin-bottom: 3rem;
}

.toc-part-header {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--color-gold);
  position: relative;
}

.toc-part-label {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-gold);
  letter-spacing: 2px;
  margin-bottom: 0.5rem;
}

.toc-part-title {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.3rem;
}

.toc-part-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
}

.toc-chapter {
  margin-bottom: 2rem;
}

.toc-chapter-header {
  padding: 1rem 1.5rem;
  margin-bottom: 0.5rem;
  border-right: 4px solid var(--color-accent);
  background: rgba(108, 63, 160, 0.06);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.toc-chapter-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.toc-chapter-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.toc-section {
  margin: 0.8rem 0;
  padding-right: 0.5rem;
}

.toc-section-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-accent2);
  padding: 0.5rem 1rem;
  border-right: 3px solid var(--color-accent2);
  margin-bottom: 0.3rem;
}

.toc-questions {
  display: flex;
  flex-direction: column;
}

.toc-question {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-decoration: none;
  font-size: 1.2rem;
}

.toc-question:hover {
  background: rgba(108, 63, 160, 0.1);
  color: var(--text-primary);
}

.toc-q-num {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  font-size: 1.1rem;
  min-width: 35px;
  flex-shrink: 0;
}

.toc-q-title {
  flex: 1;
}

/* Sidebar question links (reused in article sidebar) */
.question-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-decoration: none;
  font-size: 0.95rem;
}

.question-link:hover {
  background: rgba(108, 63, 160, 0.1);
  color: var(--text-primary);
}

.question-link .q-num {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  font-size: 0.85rem;
  min-width: 30px;
}

.question-link.read {
  opacity: 0.6;
}

.question-link.read::after {
  content: '\2713';
  margin-right: auto;
  margin-left: 0;
  color: #4CAF50;
}

/* ========================================
   Article Page
   ======================================== */
.article-container {
  max-width: 850px;
  margin: 0 auto;
  padding: 7rem 2rem 4rem;
}

.article-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.article-breadcrumb a {
  color: var(--text-secondary);
}

.article-breadcrumb .separator {
  color: var(--text-dim);
}

.article-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-glow);
}

.article-number {
  font-size: 1rem;
  color: var(--color-accent2);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.article-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text-primary);
}

/* Article Content */
.article-content {
  font-size: 1.4rem;
  line-height: 2;
  color: var(--text-primary);
}

.article-content p {
  margin-bottom: 1.2rem;
}

/* Quran verses */
.article-content .quran-verse {
  font-family: var(--font-body);
  font-size: 1.35rem;
  line-height: 2.2;
  color: var(--color-gold);
  background: rgba(240, 192, 64, 0.05);
  border: 1px solid rgba(240, 192, 64, 0.2);
  border-radius: var(--radius);
  padding: 1.2rem 1.8rem;
  margin: 1.5rem 0;
  text-align: center;
}

/* English text */
.article-content .english-text {
  direction: ltr;
  text-align: left;
  font-style: italic;
  color: var(--text-secondary);
}

/* Quote blocks */
.article-content .quote-block {
  background: rgba(194, 58, 122, 0.06);
  border-right: 4px solid var(--color-accent2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1.2rem 1.8rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 2;
}

/* Images in articles */
.article-figure {
  margin: 2rem auto;
  text-align: center;
}

.article-figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-glow);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Footnote superscript reference */
.footnote-ref {
  font-size: 0.75em;
  line-height: 1;
}

.footnote-ref a {
  color: var(--color-accent2);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.footnote-ref a:hover {
  color: var(--color-gold);
}

/* Footnotes section at bottom of article */
.footnotes-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-glow);
}

.footnotes-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-accent2);
  margin-bottom: 1rem;
}

.footnotes-list {
  list-style: none;
  counter-reset: footnote;
}

.footnote-item {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.8;
  border-bottom: 1px solid rgba(108, 63, 160, 0.1);
}

.footnote-item:last-child {
  border-bottom: none;
}

.footnote-num {
  color: var(--color-accent2);
  font-weight: 700;
  min-width: 24px;
  flex-shrink: 0;
}

/* Navigation between articles */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-glow);
}

.article-nav-btn {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  transition: var(--transition);
  text-decoration: none;
  max-width: 45%;
}

.article-nav-btn:hover {
  border-color: var(--color-accent);
  background: var(--bg-card-hover);
}

.article-nav-btn .label {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.article-nav-btn .title {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   Sidebar
   ======================================== */
.page-with-sidebar {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  padding-top: 70px;
  min-height: 100vh;
}

.sidebar {
  width: 320px;
  flex-shrink: 0;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
  padding: 2rem 1rem;
  border-left: 1px solid var(--border-glow);
  background: rgba(10, 14, 39, 0.5);
  align-self: flex-start;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding: 0 0.5rem;
}

.sidebar .question-link {
  font-size: 0.85rem;
  padding: 0.7rem 0.8rem;
}

.sidebar .question-link.current {
  background: rgba(108, 63, 160, 0.2);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
}

.main-content {
  flex: 1;
  min-width: 0;
}

/* ========================================
   Search Page
   ======================================== */
.search-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 8rem 2rem 4rem;
}

.search-box {
  position: relative;
  margin-bottom: 2rem;
}

.search-box input {
  width: 100%;
  padding: 1.2rem 1.5rem 1.2rem 3rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: 50px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.1rem;
  transition: var(--transition);
  direction: rtl;
}

.search-box input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: var(--shadow-glow);
}

.search-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.4rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: 50px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn.active {
  background: rgba(108, 63, 160, 0.2);
  border-color: var(--color-accent);
  color: var(--text-primary);
}

.search-results {
  list-style: none;
}

.search-result-item {
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.search-result-item:hover {
  border-color: var(--color-accent);
  background: var(--bg-card-hover);
}

.search-result-item .result-part {
  font-size: 0.8rem;
  color: var(--color-accent2);
  margin-bottom: 0.3rem;
}

.search-result-item h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.search-result-item .result-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.search-result-item .result-excerpt mark {
  background: rgba(240, 192, 64, 0.3);
  color: var(--color-gold);
  border-radius: 2px;
  padding: 0 2px;
}

.search-count {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ========================================
   About Page
   ======================================== */
.about-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 8rem 2rem 4rem;
}

.about-content {
  font-size: 1.1rem;
  line-height: 2;
}

/* ========================================
   Footer
   ======================================== */
.footer {
  padding: 3rem 2rem;
  border-top: 1px solid var(--border-glow);
  text-align: center;
  margin-top: 4rem;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
}

.footer-brand {
  font-size: 1.3rem;
  font-weight: 700;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.footer-text {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer-copy {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.footer-credit {
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-top: 0.5rem;
  opacity: 0.7;
}

/* ========================================
   Animations (Scroll Reveal)
   ======================================== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ========================================
   Loading
   ======================================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-glow);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1100px) {
  .sidebar {
    display: none;
  }
}

@media (max-width: 900px) {
  .parts-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-title {
    font-size: 3.5rem;
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }

  .article-title {
    font-size: 1.5rem;
  }

  .article-content {
    font-size: 1.2rem;
  }

  .toc-part-title {
    font-size: 1.4rem;
  }

  .toc-question {
    padding: 0.7rem 1rem;
    font-size: 1.05rem;
  }

  .toc-container {
    padding: 1rem 1rem 4rem;
  }
}

@media (max-width: 768px) {
  .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
  }

  .navbar-inner {
    justify-content: space-between;
    padding: 0 1rem;
  }

  .navbar-brand-link {
    font-size: 1.2rem;
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
    order: -1;
    font-size: 1.6rem;
    z-index: 1002;
  }

  .navbar-links {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    background: #0a0e27;
    flex-direction: column;
    padding: 80px 0 2rem;
    gap: 0;
    overflow-y: auto;
    border-left: 1px solid rgba(108, 63, 160, 0.25);
    box-shadow: -5px 0 30px rgba(0,0,0,0.5);
    z-index: 1001;
  }

  .navbar-links.open {
    display: flex !important;
  }

  .navbar-links li {
    width: 100%;
    border-bottom: 1px solid rgba(108, 63, 160, 0.1);
  }

  .navbar-links a {
    display: block;
    padding: 1rem 1.5rem;
    border-radius: 0;
    font-size: 1.15rem;
    font-weight: 500;
    text-align: right;
    color: var(--text-secondary);
    text-decoration: none;
  }

  .navbar-links a:hover,
  .navbar-links a.active {
    background: rgba(108, 63, 160, 0.15);
    color: #fff;
  }

  .navbar-search {
    width: 100%;
    padding: 0.5rem 1rem;
  }

  .navbar-search input {
    width: 100%;
  }

  .hero {
    padding: 5rem 1.5rem 2rem;
    min-height: auto;
  }

  .hero-title {
    font-size: 2.8rem;
  }

  .hero-stats {
    gap: 1rem;
    padding: 0.6rem 1.2rem;
  }

  .hero-stat-num {
    font-size: 0.95rem;
  }

  .hero-stat-label {
    font-size: 0.7rem;
  }

  .section {
    padding: 3rem 1.5rem;
  }

  .section-title {
    font-size: 1.7rem;
  }

  .article-container {
    padding: 5rem 1.2rem 3rem;
  }

  .article-nav {
    flex-direction: column;
  }

  .article-nav-btn {
    max-width: 100%;
  }

  .topics-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }

  .download-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .download-card {
    padding: 1.2rem 1rem;
  }

  .download-icon {
    width: 48px;
    height: 48px;
  }

  .download-icon svg {
    width: 24px;
    height: 24px;
  }

}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2.2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero-search {
    max-width: 100%;
  }

  .hero-stats {
    gap: 0.8rem;
    padding: 0.5rem 1rem;
    flex-wrap: wrap;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .stat-number {
    font-size: 2rem;
  }

  .part-hero-title {
    font-size: 2rem;
  }
}

/* ========================================
   Back to Top
   ======================================== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient-accent);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(108, 63, 160, 0.4);
  z-index: 100;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(194, 58, 122, 0.5);
}

/* Share buttons */
.share-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 2rem;
}

.share-btn {
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: 50px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.share-btn:hover {
  border-color: var(--color-accent);
  color: var(--text-primary);
}
