/* ==========================================================================
   SALAM — Pure CSS3 Design Tokens, Typography & Theme Variables
   ========================================================================== */

:root {
  /* Emerald Palette */
  --emerald-950: #022c22;
  --emerald-900: #064e3b;
  --emerald-850: #055842;
  --emerald-800: #065f46;
  --emerald-700: #047857;
  --emerald-600: #059669;
  --emerald-500: #10b981;
  --emerald-400: #34d399;
  --emerald-200: #a7f3d0;
  --emerald-100: #d1fae5;
  --emerald-50: #ecfdf5;

  /* Gold Accents */
  --gold-600: #9a741b;
  --gold-500: #b89225;
  --gold-400: #d4af37;
  --gold-300: #e2ca5d;
  --gold-200: #ede096;
  --gold-100: #f6efc9;
  --gold-50: #fbf8eb;

  /* Cream & Alabaster Surfaces */
  --cream-50: #fdfcfa;
  --cream-100: #faf8f5;
  --cream-200: #f3efe6;
  --cream-300: #e7e0d0;

  /* Light Mode Semantic Tokens */
  --bg-app: #faf8f5;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f3efe6;
  --bg-surface-elevated: #ffffff;
  --bg-header: rgba(250, 248, 245, 0.92);
  --bg-hero: linear-gradient(135deg, #064e3b 0%, #022c22 100%);

  --text-primary: #0f1f1a;
  --text-secondary: #374b43;
  --text-muted: #61756d;
  --text-accent: #065f46;
  --text-gold: #9a741b;

  --border-subtle: rgba(6, 78, 59, 0.11);
  --border-strong: rgba(6, 78, 59, 0.22);
  --border-gold: rgba(212, 175, 55, 0.35);

  --shadow-card: 0 4px 22px -2px rgba(6, 78, 59, 0.06), 0 2px 6px -1px rgba(6, 78, 59, 0.04);
  --shadow-elevated: 0 14px 34px -6px rgba(6, 78, 59, 0.12), 0 4px 10px -2px rgba(6, 78, 59, 0.06);
  --shadow-gold: 0 6px 24px -4px rgba(212, 175, 55, 0.24);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-arabic: 'Amiri', 'Scheherazade New', 'Traditional Arabic', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Dynamic Arabic Font Size (Controlled by User Preferences) */
  --arabic-size-base: 1.75rem;

  /* Radii & Spacing */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-full: 9999px;

  --sidebar-width: 284px;
  --header-height: 66px;
  --bottom-nav-height: 68px;

  --transition-fast: 160ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 260ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Semantic Overrides */
[data-theme="dark"] {
  --bg-app: #022019;
  --bg-surface: #053327;
  --bg-surface-alt: #04291f;
  --bg-surface-elevated: #063f30;
  --bg-header: rgba(2, 32, 25, 0.92);
  --bg-hero: linear-gradient(135deg, #065f46 0%, #02231b 100%);

  --text-primary: #faf8f5;
  --text-secondary: #d1e7dd;
  --text-muted: #8ab3a2;
  --text-accent: #34d399;
  --text-gold: #e2ca5d;

  --border-subtle: rgba(212, 175, 55, 0.16);
  --border-strong: rgba(212, 175, 55, 0.32);
  --border-gold: rgba(212, 175, 55, 0.45);

  --shadow-card: 0 6px 24px -4px rgba(0, 0, 0, 0.35);
  --shadow-elevated: 0 16px 38px -6px rgba(0, 0, 0, 0.55);
}

/* Arabic Font Scale Classes */
[data-arabic-size="md"] { --arabic-size-base: 1.45rem; }
[data-arabic-size="lg"] { --arabic-size-base: 1.7rem; }
[data-arabic-size="xl"] { --arabic-size-base: 2.0rem; }
[data-arabic-size="2xl"] { --arabic-size-base: 2.35rem; }

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
  overflow-x: hidden;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

/* Focus Accessibility */
:focus-visible {
  outline: 2px solid var(--gold-400);
  outline-offset: 2px;
}

/* Arabic Text Helper */
.arabic-text {
  font-family: var(--font-arabic);
  font-size: var(--arabic-size-base);
  line-height: 2.2;
  direction: rtl;
  text-align: right;
  word-spacing: 2px;
}

/* Subtle Islamic Geometric Watermark Patterns */
.islamic-pattern {
  background-image: url("data:image/svg+xml,%3Csvg width='64' height='64' viewBox='0 0 64 64' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23D4AF37' stroke-width='0.75' stroke-opacity='0.14'%3E%3Crect x='14' y='14' width='36' height='36' rx='2'/%3E%3Crect x='14' y='14' width='36' height='36' rx='2' transform='rotate(45 32 32)'/%3E%3Ccircle cx='32' cy='32' r='6'/%3E%3C/g%3E%3C/svg%3E");
}

.card-geometric-bg {
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23065F46' stroke-width='0.6' stroke-opacity='0.05'%3E%3Crect x='18' y='18' width='44' height='44'/%3E%3Crect x='18' y='18' width='44' height='44' transform='rotate(45 40 40)'/%3E%3C/g%3E%3C/svg%3E");
}

[data-theme="dark"] .card-geometric-bg {
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23D4AF37' stroke-width='0.6' stroke-opacity='0.06'%3E%3Crect x='18' y='18' width='44' height='44'/%3E%3Crect x='18' y='18' width='44' height='44' transform='rotate(45 40 40)'/%3E%3C/g%3E%3C/svg%3E");
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 240ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
