/**
 * SMART MUSLIM — OFFICIAL DESIGN SYSTEM & COMPONENT STYLES
 * Production CSS v1.0.0
 * Zero dependencies • Modern CSS Custom Properties • WCAG 2.2 AA Compliant
 */

/* ==========================================================================
   1. Design Tokens & Themes
   ========================================================================== */

:root {
  /* Light Theme Palette (Default) */
  --bg-base: #FAF8F2;             /* Light Ivory ambient background */
  --bg-surface: #FFFFFF;          /* Pure White cards & modal surfaces */
  --bg-surface-elevated: #FFFFFF; /* Elevated cards */
  --bg-subtle: #F2EDE2;           /* Subtle surface contrast */
  
  --color-primary: #0F5C5E;        /* Deep Islamic Teal */
  --color-primary-dark: #083F41;   /* Hover & deep contrast */
  --color-primary-light: #E4F1F0;  /* Subtle teal tint */
  
  --color-secondary: #2F806A;      /* Emerald highlight */
  --color-secondary-subtle: #EBF5F1;
  
  --color-gold: #C9A96E;           /* Muted Warm Gold (strictly 2–5% accent) */
  --color-gold-subtle: #F9F5EC;
  --color-sand: #E8DFC9;           /* Warm Sand for Quran surfaces */
  
  --text-primary: #172A2B;         /* High-contrast primary text */
  --text-secondary: #5F6F70;       /* Secondary body & subtitles */
  --text-muted: #8A9A9B;           /* Caption & metadata */
  --text-inverse: #FFFFFF;         /* Text on primary buttons */
  
  --border-subtle: #DCE4E2;        /* Standard light borders */
  --border-strong: #BDCECA;        /* Form & active borders */
  
  --shadow-sm: 0 2px 4px rgba(15, 92, 94, 0.04);
  --shadow-md: 0 6px 16px rgba(15, 92, 94, 0.06);
  --shadow-lg: 0 16px 36px rgba(15, 92, 94, 0.08);
  --shadow-modal: 0 24px 64px rgba(8, 63, 65, 0.2);

  /* Typography */
  --font-arabic: 'IBM Plex Sans Arabic', 'Noto Sans Arabic', 'Segoe UI', system-ui, sans-serif;
  --font-english: 'Inter', system-ui, -apple-system, sans-serif;
  --font-quran: 'Amiri', serif;
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 250ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --bg-base: #0D191A;              /* Dark Background */
  --bg-surface: #142526;           /* Dark Surface */
  --bg-surface-elevated: #1B3133;  /* Elevated cards in dark */
  --bg-subtle: #182B2D;
  
  --color-primary: #4FA3A0;        /* Accessible Teal for dark mode */
  --color-primary-dark: #3A8380;
  --color-primary-light: rgba(79, 163, 160, 0.15);
  
  --color-secondary: #449C82;
  --color-secondary-subtle: rgba(68, 156, 130, 0.15);
  
  --color-gold: #D6B983;           /* Slightly brighter gold for dark contrast */
  --color-gold-subtle: rgba(201, 169, 110, 0.12);
  --color-sand: #233630;
  
  --text-primary: #F3F1E8;         /* High-legibility light text */
  --text-secondary: #B8C5C4;       /* Secondary light text */
  --text-muted: #7E9292;
  --text-inverse: #0D191A;
  
  --border-subtle: #223A3B;
  --border-strong: #2F4D4F;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.7);
}

/* ==========================================================================
   2. Base & Reset
   ========================================================================== */

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

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

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-arabic);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
}

html[lang="en"] body {
  font-family: var(--font-english);
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select {
  font: inherit;
}

/* ==========================================================================
   3. Typography & Headings
   ========================================================================== */

.font-quran {
  font-family: var(--font-quran);
}

.text-display {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: normal;
  color: var(--text-primary);
}

.text-h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
}

.text-h2 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text-primary);
}

.text-h3 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
}

.text-body-lg {
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.text-body {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

.text-sm {
  font-size: 0.875rem;
  line-height: 1.6;
}

.text-xs {
  font-size: 0.75rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .text-display { font-size: 2rem; line-height: 1.35; }
  .text-h1 { font-size: 1.65rem; line-height: 1.4; }
  .text-h2 { font-size: 1.35rem; line-height: 1.45; }
  .text-h3 { font-size: 1.15rem; line-height: 1.5; }
}

/* ==========================================================================
   4. Layout Containers & Grid
   ========================================================================== */

.container {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.section-spacing {
  padding-top: 5rem;
  padding-bottom: 5rem;
}

@media (max-width: 640px) {
  .section-spacing {
    padding-top: 3.25rem;
    padding-bottom: 3.25rem;
  }
}

/* ==========================================================================
   5. Buttons & Controls
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-normal);
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--color-primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background-color: var(--bg-subtle);
  transform: translateY(-1px);
}

.btn-gold {
  background: linear-gradient(135deg, #D4B278 0%, var(--color-gold) 100%);
  color: #083F41;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(201, 169, 110, 0.25);
}

.btn-gold:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 18px rgba(201, 169, 110, 0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.btn-sm {
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

/* ==========================================================================
   6. Badges & Tags
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge-primary {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  border-color: rgba(15, 92, 94, 0.15);
}

.badge-secondary {
  background-color: var(--color-secondary-subtle);
  color: var(--color-secondary);
  border-color: rgba(47, 128, 106, 0.2);
}

.badge-gold {
  background-color: var(--color-gold-subtle);
  color: #8C6A2E;
  border-color: rgba(201, 169, 110, 0.3);
}

[data-theme="dark"] .badge-gold {
  color: #D6B983;
}

/* ==========================================================================
   7. Cards & Surfaces
   ========================================================================== */

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-quran {
  background-color: var(--color-sand);
  border: 1px solid rgba(201, 169, 110, 0.4);
  color: var(--text-primary);
}

[data-theme="dark"] .card-quran {
  background-color: #1A2824;
  border-color: rgba(201, 169, 110, 0.25);
}

/* ==========================================================================
   8. Header & Navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(250, 248, 242, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  transition: all var(--transition-normal);
}

[data-theme="dark"] .site-header {
  background-color: rgba(13, 25, 26, 0.92);
}

.nav-link {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
  color: var(--color-primary);
  background-color: var(--color-primary-light);
}

/* ==========================================================================
   9. Subtle Islamic Decorative Elements
   ========================================================================== */

.star-ornament {
  display: inline-block;
  color: var(--color-gold);
  font-size: 1.1rem;
  line-height: 1;
}

.quran-ayah-frame {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.quran-ayah-frame::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 6px;
  border: 1px solid rgba(201, 169, 110, 0.2);
  border-radius: calc(var(--radius-xl) - 6px);
  pointer-events: none;
}

/* ==========================================================================
   10. Device Presentation Showcase
   ========================================================================== */

.device-frame {
  position: relative;
  border-radius: 40px;
  border: 8px solid #233435;
  background: #000000;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-width: 320px;
  margin: 0 auto;
}

.device-screen {
  background: #142526;
  width: 100%;
  aspect-ratio: 9 / 19.5;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   11. Accessibility & Utilities
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.hidden { display: none !important; }
.hidden-section { display: none !important; }

