/* ==========================================================================
   100 Ayat Populer Al-Quran - Modern Islamic Web Portal Stylesheet
   Designed for High Core Web Vitals, Responsive Layout, Dark/Light Themes & RTL
   ========================================================================== */

:root {
  --primary: #065f46;
  --primary-light: #047857;
  --primary-dark: #064e3b;
  --primary-subtle: #ecfdf5;
  --accent-gold: #d97706;
  --accent-gold-light: #fbbf24;
  --accent-gold-subtle: #fffbeb;
  
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-muted: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-color: #e2e8f0;
  --border-focus: #10b981;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-gold: 0 4px 20px -2px rgba(217, 119, 6, 0.15);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --font-arabic: 'Amiri', 'Scheherazade New', 'Noto Naskh Arabic', serif;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-main: #090d16;
  --bg-surface: #0f172a;
  --bg-card: #131c31;
  --bg-muted: #1e293b;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border-color: #1e293b;
  
  --primary-subtle: rgba(6, 95, 70, 0.2);
  --accent-gold-subtle: rgba(217, 119, 6, 0.15);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header & Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

[data-theme="dark"] .site-header {
  background-color: rgba(15, 23, 42, 0.92);
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary-dark);
}

[data-theme="dark"] .brand-logo {
  color: #34d399;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 2px 8px rgba(6, 95, 70, 0.25);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Language Dropdown */
.lang-dropdown {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background-color: var(--bg-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.lang-btn:hover {
  border-color: var(--primary-light);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: 0.5rem 0;
  display: none;
  z-index: 1010;
}

.lang-menu.show {
  display: block;
  animation: fadeIn 0.15s ease-out;
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  color: var(--text-main);
  font-size: 0.875rem;
  transition: var(--transition);
}

.lang-option:hover, .lang-option.active {
  background-color: var(--primary-subtle);
  color: var(--primary-dark);
}

[data-theme="dark"] .lang-option:hover, [data-theme="dark"] .lang-option.active {
  color: #34d399;
}

/* Theme Toggle Button */
.theme-btn {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.theme-btn:hover {
  background-color: var(--border-color);
}

/* Hero Section */
.hero {
  padding: 4rem 0 3rem;
  background: radial-gradient(circle at top right, var(--primary-subtle) 0%, transparent 60%),
              radial-gradient(circle at bottom left, var(--accent-gold-subtle) 0%, transparent 60%);
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  background-color: var(--accent-gold-subtle);
  color: var(--accent-gold);
  border: 1px solid rgba(217, 119, 6, 0.25);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.hero-title span {
  color: var(--primary);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  max-width: 720px;
  margin: 0 auto 2rem;
  font-size: 1.125rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* Search Bar & Filter */
.search-box-wrapper {
  max-width: 680px;
  margin: 0 auto;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 1rem 1.25rem 1rem 3.25rem;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-full);
  background-color: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  outline: none;
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* Categories Pills */
.categories-filter {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.cat-pill {
  padding: 0.5rem 1rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.cat-pill:hover, .cat-pill.active {
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Ad Unit Containers (AdSense Valuable Inventory Compliant) */
.ad-slot-wrapper {
  margin: 2rem auto;
  max-width: 970px;
  text-align: center;
  overflow: hidden;
}

.ad-label {
  font-size: 0.6875rem;
  letter-spacing: 1px;
  color: var(--text-light);
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.ad-container {
  background-color: var(--bg-muted);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

/* Verses Grid */
.verses-section {
  padding: 3rem 0;
  flex: 1;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
}

.verse-count-badge {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  background-color: var(--primary-subtle);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
}

.verses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

/* Verse Card */
.verse-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.verse-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(6, 95, 70, 0.3);
}

.verse-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.surah-ref {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
}

.category-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background-color: var(--accent-gold-subtle);
  color: var(--accent-gold);
}

.arabic-preview {
  font-family: var(--font-arabic);
  font-size: 1.5rem;
  line-height: 2;
  text-align: right;
  direction: rtl;
  color: var(--text-main);
  margin: 0.75rem 0;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.translit-preview {
  font-size: 0.875rem;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.translation-preview {
  font-size: 0.9375rem;
  color: var(--text-main);
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.verse-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.btn-read-more {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary);
}

.btn-read-more:hover {
  color: var(--accent-gold);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-action-btn {
  background: var(--bg-muted);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.icon-action-btn:hover {
  background-color: var(--primary);
  color: #fff;
}

/* Single Verse Article Page */
.article-page {
  padding: 2.5rem 0 4rem;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--text-muted);
}

.breadcrumbs a:hover {
  color: var(--primary);
}

.article-header {
  margin-bottom: 2rem;
}

.article-category {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  background-color: var(--primary-subtle);
  color: var(--primary);
  border-radius: var(--radius-full);
  margin-bottom: 0.75rem;
}

.article-title {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

/* Verse Callout Box (Arabic display) */
.verse-display-box {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-muted) 100%);
  border: 1px solid var(--border-color);
  border-left: 6px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 2.25rem 2rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-md);
}

[dir="rtl"] .verse-display-box {
  border-left: 1px solid var(--border-color);
  border-right: 6px solid var(--primary);
}

.verse-arabic-full {
  font-family: var(--font-arabic);
  font-size: 2rem;
  line-height: 2.4;
  text-align: right;
  direction: rtl;
  color: var(--text-main);
  margin-bottom: 1.5rem;
}

.verse-transliteration-box {
  font-size: 1.0625rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.7;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.verse-translation-box {
  font-size: 1.125rem;
  color: var(--text-main);
  line-height: 1.8;
  font-weight: 500;
}

/* Audio Player Bar */
.audio-player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border-color);
  flex-wrap: wrap;
  gap: 1rem;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-play-audio {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background-color: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-play-audio:hover {
  background-color: var(--primary-light);
  transform: scale(1.02);
}

.reciter-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.share-copy-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-outline-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.btn-outline-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Content Sections */
.article-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.section-heading-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--primary-subtle);
  padding-bottom: 0.75rem;
}

.heading-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: var(--primary-subtle);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
}

.section-heading {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-main);
}

.section-body {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-main);
}

.section-body p {
  margin-bottom: 1rem;
}

.section-body ul, .section-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

[dir="rtl"] .section-body ul, [dir="rtl"] .section-body ol {
  padding-left: 0;
  padding-right: 1.5rem;
}

.section-body li {
  margin-bottom: 0.75rem;
}

/* Multilingual Verses Switcher Bar */
.lang-switcher-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

.lang-switcher-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.lang-badges-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.lang-badge-link {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-muted);
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
}

.lang-badge-link:hover, .lang-badge-link.active {
  background-color: var(--primary);
  color: #fff;
}

/* Footer */
.site-footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 3.5rem 0 2rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-col h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.footer-col p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.6rem;
}

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

.footer-links a:hover {
  color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-light);
}

/* RTL Support */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .search-input {
  padding: 1rem 3.25rem 1rem 1.25rem;
}

[dir="rtl"] .search-icon {
  left: auto;
  right: 1.25rem;
}

[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
}

/* Animations & Toast */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: #0f172a;
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

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

/* Responsive adjustments */
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 1.85rem;
  }
  .article-title {
    font-size: 1.65rem;
  }
  .verse-arabic-full {
    font-size: 1.65rem;
    line-height: 2.1;
  }
  .verses-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .audio-player-bar {
    flex-direction: column;
    align-items: stretch;
  }
}
