/* ═══════════════════════════════════════════════════════════════════════════
   RAMADAN FOCUS THEME - Elite Academic Night Mode
   Design Philosophy: Premium, nocturnal, luminous, serene, disciplined, scholarly
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Core Color System ─── */
:root[data-theme="ramadan"] {
  /* Primary Background - Deep Academic Night */
  --bg-primary: #101B33;
  --bg-secondary: #0B1628;
  --bg-tertiary: #121F3F;
  
  /* Refined Gold Accents - NEVER yellow */
  --gold-refined: #D4AF37;
  --gold-hover: #E6C76A;
  --gold-pressed: #B8962E;
  --gold-glow: rgba(212, 175, 55, 0.15);
  
  /* Secondary Accent - Emerald (limited use) */
  --emerald: #0F8A5F;
  --emerald-light: #10B981;
  
  /* Surface Colors */
  --card-surface: #FAF7F0;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-focus: var(--gold-refined);
  
  /* Text Colors */
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.85);
  --text-muted: rgba(255, 255, 255, 0.65);
  --text-on-card: #1a1a1a;
  
  /* Motion System */
  --transition-fast: 180ms ease-out;
  --transition-medium: 240ms ease-out;
  --transition-slow: 400ms ease-out;

  /* Bridge to existing app design tokens */
  --bg: linear-gradient(180deg, #0B1628 0%, #101B33 55%, #121F3F 100%);
  --bg-flat: #101B33;
  --card-bg: rgba(18, 31, 63, 0.72);
  --card-hover: rgba(22, 40, 84, 0.78);
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.04);
  --text: var(--text-primary);
  --text-secondary: rgba(255, 255, 255, 0.82);
  --text-muted: rgba(255, 255, 255, 0.62);
  --accent: var(--gold-refined);
  --accent-hover: var(--gold-hover);
  --accent-light: rgba(212, 175, 55, 0.12);
  --accent-glow: rgba(212, 175, 55, 0.16);
  --success: var(--emerald);
  --success-light: rgba(15, 138, 95, 0.14);
}

/* ─── Global Background with Vertical Gradient ─── */
html[data-theme="ramadan"] body {
  background: var(--bg);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ─── Atmosphere Layer - Celestial Ambiance ─── */
html[data-theme="ramadan"] body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 20vh;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 45% 8%, rgba(255, 255, 255, 0.04) 2px, transparent 2px),
    radial-gradient(circle at 75% 12%, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 25% 18%, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 200px 200px, 300px 300px, 250px 250px, 180px 180px, 220px 220px;
  pointer-events: none;
  z-index: -1;
  opacity: 0.12;
}

/* ─── Crescent Glow - Emotional Warmth ─── */
html[data-theme="ramadan"] body::after {
  content: '';
  position: fixed;
  top: -10%;
  right: -15%;
  width: 40%;
  height: 60%;
  background: radial-gradient(ellipse at center, var(--gold-refined) 0%, transparent 60%);
  opacity: 0.085;
  filter: blur(110px);
  pointer-events: none;
  z-index: -1;
}

/* ─── Card Surfaces (non-destructive) ─── */
html[data-theme="ramadan"] .main-container,
html[data-theme="ramadan"] .results-container,
html[data-theme="ramadan"] .login-modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-primary);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

html[data-theme="ramadan"] .main-container:hover,
html[data-theme="ramadan"] .results-container:hover {
  box-shadow:
    0 14px 46px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(212, 175, 55, 0.06),
    0 0 28px rgba(212, 175, 55, 0.08);
}

html[data-theme="ramadan"] .card {
  background: rgba(18, 31, 63, 0.62);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

/* ─── Primary CTAs - Gold Luminance ─── */
html[data-theme="ramadan"] .cta-button,
html[data-theme="ramadan"] button[type="submit"] {
  background: var(--gold-refined);
  color: #000;
  border: none;
  font-weight: 600;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

html[data-theme="ramadan"] a {
  color: var(--text-secondary);
}

html[data-theme="ramadan"] a:hover {
  color: var(--gold-refined);
}

html[data-theme="ramadan"] .cta-button:hover,
html[data-theme="ramadan"] button[type="submit"]:hover {
  background: var(--gold-hover);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.25),
    0 0 22px rgba(212, 175, 55, 0.22);
  transform: translateY(-1px);
}

html[data-theme="ramadan"] .cta-button:active,
html[data-theme="ramadan"] button[type="submit"]:active {
  background: var(--gold-pressed);
  transform: translateY(0);
}

/* ─── Focus States ─── */
html[data-theme="ramadan"] input:focus,
html[data-theme="ramadan"] textarea:focus,
html[data-theme="ramadan"] select:focus {
  border-color: var(--gold-refined);
  box-shadow: 0 0 0 3px var(--gold-glow);
  outline: none;
}

html[data-theme="ramadan"] button:focus-visible,
html[data-theme="ramadan"] a:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.85);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.16);
}

/* ─── Success States - Emerald ─── */
html[data-theme="ramadan"] .success,
html[data-theme="ramadan"] .correct-answer,
html[data-theme="ramadan"] .streak-indicator.active {
  color: var(--emerald);
  border-color: var(--emerald);
}

/* ─── Progress Indicators ─── */
html[data-theme="ramadan"] .progress-bar {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

html[data-theme="ramadan"] .progress-fill {
  background: linear-gradient(90deg, var(--gold-refined) 0%, var(--gold-hover) 100%);
  transition: width var(--transition-medium);
}

/* ─── Ramadan Progress Tracker ─── */
.ramadan-tracker {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.5rem;
  margin: 2rem 0;
  backdrop-filter: blur(8px);
}

.ramadan-tracker-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  text-align: center;
}

.ramadan-days {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(32px, 1fr));
  gap: 8px;
  max-width: 600px;
  margin: 0 auto;
}

.ramadan-day {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: all var(--transition-medium);
  position: relative;
}

.ramadan-day.completed {
  background: linear-gradient(135deg, var(--gold-refined) 0%, var(--gold-hover) 100%);
  color: #000;
  border-color: var(--gold-refined);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
}

.ramadan-day.today {
  border: 2px solid var(--gold-refined);
  box-shadow: 0 0 16px var(--gold-glow);
}

.ramadan-day.completed::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-refined), var(--gold-hover));
  z-index: -1;
  opacity: 0;
  transition: opacity 600ms ease-out;
}

.ramadan-day.completed.animate::after {
  opacity: 0.3;
  animation: lightSpread 600ms ease-out;
}

@keyframes lightSpread {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ─── Time-Aware UI - Sunset Overlay ─── */
html[data-theme="ramadan"].sunset-mode::before {
  background: linear-gradient(180deg, rgba(255, 183, 77, 0.02) 0%, rgba(255, 140, 0, 0.03) 100%);
}

/* ─── Night Study Focus Mode ─── */
html[data-theme="ramadan"].night-study {
  --bg-primary: #0A1426;
  --bg-secondary: #081220;
  --bg-tertiary: #0F1B35;
  --gold-refined: #C4A434;
  --gold-hover: #D4B544;
}

html[data-theme="ramadan"].night-study body::before {
  display: none; /* Remove star field */
}

html[data-theme="ramadan"].night-study .main-container,
html[data-theme="ramadan"].night-study .results-container {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}

/* ─── Typography Enhancements ─── */
html[data-theme="ramadan"] h1,
html[data-theme="ramadan"] h2,
html[data-theme="ramadan"] h3 {
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
}

html[data-theme="ramadan"] .question-text {
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.6;
  font-size: 1.05rem;
}

/* ─── Navigation & Header ─── */
html[data-theme="ramadan"] .navbar,
html[data-theme="ramadan"] header {
  background: rgba(16, 27, 51, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

html[data-theme="ramadan"] .navbar a,
html[data-theme="ramadan"] .nav-link {
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

html[data-theme="ramadan"] .navbar a:hover,
html[data-theme="ramadan"] .nav-link:hover {
  color: var(--gold-refined);
}

/* ─── Answer Options ─── */
html[data-theme="ramadan"] .answer-option {
  background: var(--card-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-on-card);
  transition: all var(--transition-fast);
}

html[data-theme="ramadan"] .answer-option:hover {
  border-color: var(--gold-refined);
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.1);
}

html[data-theme="ramadan"] .answer-option.selected {
  border-color: var(--gold-refined);
  background: rgba(212, 175, 55, 0.05);
}

html[data-theme="ramadan"] .answer-option.correct {
  border-color: var(--emerald);
  background: rgba(15, 138, 95, 0.05);
}

/* ─── Modals & Overlays ─── */
html[data-theme="ramadan"] .modal-bg {
  background: rgba(16, 27, 51, 0.8);
  backdrop-filter: blur(8px);
}

/* ─── Responsive Design ─── */
@media (max-width: 768px) {
  .ramadan-days {
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
  }
  
  .ramadan-day {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  html[data-theme="ramadan"] body::after {
    width: 60%;
    height: 40%;
  }
  
  .ramadan-tracker {
    padding: 1rem;
  }
}

/* ─── Accessibility ─── */
@media (prefers-reduced-motion: reduce) {
  html[data-theme="ramadan"] * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── High Contrast Mode ─── */
@media (prefers-contrast: high) {
  html[data-theme="ramadan"] {
    --gold-refined: #F4D03F;
    --text-primary: #FFFFFF;
    --border-subtle: rgba(255, 255, 255, 0.2);
  }
}
