:root {
  /* Color Palette */
  --primary: #05B34D;
  --primary-dark: #04A045;
  --primary-light: #07D85B;
  --accent: #F2B91C;
  --accent-dark: #D9A516;
  --dark: #181F25;
  --dark-surface: #232B33;
  --dark-elevated: #2D3640;
  --light-bg: #E9FBF1;
  --light-surface: #FFFFFF;
  --light-elevated: #F5FFFA;
  --white: #FFFFFF;

  /* Semantic Colors */
  --text-primary: var(--dark);
  --text-secondary: #5A6470;
  --text-tertiary: #8B95A1;
  --text-on-primary: var(--white);
  --bg: var(--light-bg);
  --surface: var(--light-surface);
  --elevated: var(--light-elevated);
  --border: #D4EDE0;
  --shadow: 0 2px 12px rgba(5, 179, 77, 0.08);
  --shadow-lg: 0 8px 32px rgba(5, 179, 77, 0.12);
  --shadow-gold: 0 2px 12px rgba(242, 185, 28, 0.15);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-arabic: 'Noto Naskh Arabic', 'Amiri', serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', monospace;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --text-primary: #E6EDF3;
  --text-secondary: #9BA6B2;
  --text-tertiary: #6B7684;
  --bg: var(--dark);
  --surface: var(--dark-surface);
  --elevated: var(--dark-elevated);
  --border: #3A4550;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

/* Mobile App Shell - max-width for desktop, full height on mobile */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.05);
}

@media (min-width: 481px) {
  .app-shell {
    margin-top: 0;
    min-height: 100vh;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
  }
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.app-header .brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.app-header .brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: var(--shadow);
}

.app-header .brand-name {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  color: var(--text-primary);
}

.theme-toggle:hover {
  background: var(--elevated);
  border-color: var(--primary);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }
.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }

/* Content Area */
.app-content {
  flex: 1;
  padding: var(--space-lg);
  padding-bottom: 100px;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: var(--space-sm) 0;
  padding-bottom: env(safe-area-inset-bottom, var(--space-sm));
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-sm);
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 500;
  transition: color var(--transition);
  cursor: pointer;
  background: none;
  border: none;
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.card-elevated {
  background: var(--elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-lg);
}

.card-accent {
  border-left: 4px solid var(--primary);
}

.card-gold {
  border-left: 4px solid var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  min-height: 48px;
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(5, 179, 77, 0.25);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(5, 179, 77, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

.btn-gold {
  background: var(--accent);
  color: var(--dark);
  box-shadow: var(--shadow-gold);
}

.btn-gold:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

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

.btn-ghost:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Forms */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: all var(--transition);
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
}

.hero-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-md);
  line-height: 1.15;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  line-height: 1.5;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: var(--space-lg);
}

[data-theme="dark"] .hero-badge {
  color: var(--accent);
}

/* Dhikr Card */
.dhikr-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.dhikr-card:active {
  transform: scale(0.98);
}

.dhikr-arabic {
  font-family: var(--font-arabic);
  font-size: 1.5rem;
  line-height: 2.2;
  text-align: right;
  direction: rtl;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  font-weight: 500;
}

.dhikr-transliteration {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: var(--space-sm);
  line-height: 1.6;
}

.dhikr-translation {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

.dhikr-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.dhikr-count {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
}

.dhikr-reference {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.dhikr-virtue {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: var(--space-xs) 0;
  margin-bottom: var(--space-lg);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar { display: none; }

.category-tab {
  flex-shrink: 0;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-full);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.category-tab.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

/* Status Indicator */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
}

.status-indicator.online {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
}

.status-indicator.offline {
  background: color-mix(in srgb, #EF4444 12%, transparent);
  color: #EF4444;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--dark);
  color: var(--white);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  opacity: 0;
  transition: all var(--transition);
  max-width: 90%;
  text-align: center;
}

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

/* Loading Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

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

/* Section Title */
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: var(--space-md);
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-lg) 0;
}

/* Hidden */
.hidden { display: none !important; }

/* Fade In Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

/* Stagger animation for list items */
.dhikr-card:nth-child(1) { animation: fadeIn 0.3s ease-out; }
.dhikr-card:nth-child(2) { animation: fadeIn 0.4s ease-out; }
.dhikr-card:nth-child(3) { animation: fadeIn 0.5s ease-out; }
.dhikr-card:nth-child(4) { animation: fadeIn 0.6s ease-out; }
.dhikr-card:nth-child(5) { animation: fadeIn 0.7s ease-out; }
