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

:root {
  --primary: #1a5c3a;
  --primary-dark: #0d3b24;
  --primary-light: #2d8a5e;
  --gold: #c9a84c;
  --gold-light: #e8d48b;
  --bg: #f8f6f0;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-light: #555;
  --text-muted: #888;
  --border: #e0dcd4;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Tajawal', 'Amiri', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  line-height: 1.8;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.2);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
}

.logo-icon {
  width: 45px;
  height: 45px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: bold;
  color: var(--primary-dark);
}

.logo h1 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo small {
  display: block;
  font-size: 0.7rem;
  opacity: 0.8;
  font-weight: 300;
}

nav {
  background: rgba(0,0,0,0.15);
}

nav ul {
  list-style: none;
  display: flex;
  gap: 0;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

nav a {
  color: rgba(255,255,255,0.85);
  padding: 10px 18px;
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}

nav a:hover, nav a.active {
  color: white;
  background: rgba(255,255,255,0.1);
  border-bottom-color: var(--gold);
}

.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: white;
  text-align: center;
  padding: 60px 20px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.hero h2 {
  font-family: 'Amiri', serif;
  font-size: 2.5rem;
  margin-bottom: 12px;
  position: relative;
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 700px;
  margin: 0 auto 30px;
  position: relative;
}

.hero .bismillah {
  font-family: 'Amiri', serif;
  font-size: 1.8rem;
  margin-bottom: 20px;
  color: var(--gold-light);
  position: relative;
}

.stats-bar {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 30px;
  position: relative;
}

.stat-item {
  text-align: center;
}

.stat-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--gold-light);
  display: block;
}

.stat-label {
  font-size: 0.85rem;
  opacity: 0.8;
}

.search-box {
  max-width: 600px;
  margin: 30px auto 0;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 14px 50px 14px 20px;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  outline: none;
}

.search-box input::placeholder { color: #999; }

.search-box button {
  position: absolute;
  left: 5px;
  top: 5px;
  bottom: 5px;
  padding: 0 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.2s;
}

.search-box button:hover { background: var(--primary-dark); }

.section {
  padding: 50px 0;
}

.section-title {
  text-align: center;
  margin-bottom: 40px;
}

.section-title h2 {
  font-family: 'Amiri', serif;
  font-size: 1.8rem;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.section-title p {
  color: var(--text-light);
  font-size: 0.95rem;
}

.section-title .line {
  width: 60px;
  height: 3px;
  background: var(--gold);
  margin: 12px auto 0;
  border-radius: 2px;
}

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

.topic-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.topic-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
  border-color: var(--gold);
}

.topic-card .topic-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 14px;
}

.topic-card h3 {
  font-size: 1.1rem;
  color: var(--primary-dark);
  margin-bottom: 8px;
}

.topic-card .count {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.topic-card .count strong {
  color: var(--gold);
  font-size: 1.1rem;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.book-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all 0.3s;
  text-align: center;
}

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

.book-card .book-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.book-card h3 {
  font-size: 1rem;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.book-card .book-count {
  color: var(--gold);
  font-weight: 700;
  font-size: 1.1rem;
}

.narration-list { list-style: none; }

.narration-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-right: 4px solid var(--primary);
  transition: border-color 0.2s;
}

.narration-item:hover { border-right-color: var(--gold); }

.narration-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.narration-meta span {
  font-size: 0.8rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.meta-masoom {
  background: #e8f5e9;
  color: var(--primary-dark);
}

.meta-source {
  background: #fff8e1;
  color: #7a6200;
}

.narration-text {
  font-family: 'Amiri', serif;
  font-size: 1.1rem;
  line-height: 2;
  color: var(--text);
}

.narration-text mark {
  background: var(--gold-light);
  padding: 0 3px;
  border-radius: 3px;
}

.copy-btn {
  margin-top: 10px;
  padding: 5px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.pagination a, .pagination span {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  transition: all 0.2s;
}

.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination .disabled { opacity: 0.4; pointer-events: none; }

.breadcrumb {
  padding: 16px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumb a { color: var(--primary); }
.breadcrumb span { margin: 0 6px; }

footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.8);
  padding: 40px 0 20px;
  margin-top: 60px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-section h3 {
  color: var(--gold);
  margin-bottom: 14px;
  font-size: 1rem;
}

.footer-section p, .footer-section a {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  line-height: 2;
}

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

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  margin-top: 30px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

.about-content {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
}

.about-content h3 {
  color: var(--primary-dark);
  margin: 24px 0 12px;
  font-size: 1.2rem;
}

.about-content p {
  color: var(--text-light);
  margin-bottom: 14px;
}

.about-content ul {
  padding-right: 20px;
  margin-bottom: 14px;
}

.about-content li {
  color: var(--text-light);
  margin-bottom: 6px;
}

.result-info {
  text-align: center;
  padding: 12px;
  background: #e8f5e9;
  border-radius: 8px;
  margin-bottom: 20px;
  color: var(--primary-dark);
  font-weight: 500;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results h3 { margin-bottom: 10px; color: var(--text-light); }

.load-more-btn {
  display: block;
  margin: 20px auto;
  padding: 12px 40px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: 'Tajawal', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.load-more-btn:hover { background: var(--primary-dark); }

.masoom-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  margin: 3px;
}

.topic-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  padding: 40px 20px;
  text-align: center;
  margin-bottom: 30px;
  border-radius: 0 0 var(--radius) var(--radius);
}

.topic-header h2 {
  font-family: 'Amiri', serif;
  font-size: 2rem;
  margin-bottom: 8px;
}

.topic-header .topic-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 16px;
  font-size: 0.9rem;
  opacity: 0.9;
}

.filter-bar {
  background: var(--bg-card);
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-bar select, .filter-bar input {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem;
  direction: rtl;
  background: white;
  outline: none;
}

.filter-bar select:focus, .filter-bar input:focus {
  border-color: var(--primary);
}

@media (max-width: 768px) {
  .hero h2 { font-size: 1.6rem; }
  .hero .bismillah { font-size: 1.3rem; }
  .stats-bar { gap: 20px; flex-wrap: wrap; }
  .stat-num { font-size: 1.4rem; }
  nav ul { overflow-x: auto; }
  nav a { padding: 8px 12px; font-size: 0.8rem; white-space: nowrap; }
  .header-top { padding: 8px 12px; }
  .logo h1 { font-size: 1rem; }
  .topics-grid { grid-template-columns: 1fr; }
  .narration-item { padding: 16px; }
  .footer-content { grid-template-columns: 1fr; }
  .about-content { padding: 20px; }
}
