/* style.css — Divine Mood
   1. Reset & Base
   2. Shared bits
   3. Screen transitions
   4. Welcome screen
   5. Mood grid
   6. Verse display
   7. Saved verses
   8. Bottom nav
   9. Toast
*/


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

body {
  font-family: 'DM Sans', sans-serif;
  background-color: #0C0C0F;
  color: #F0EDE8;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 440px;
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
  background: #0C0C0F;
}


/* --- Shared bits --- */

.btn-gold {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #D4A843, #F0C860);
  color: #0C0C0F;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: transform 0.15s, opacity 0.15s;
}
.btn-gold:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.btn-outline {
  width: 100%;
  padding: 15px;
  background: transparent;
  color: #8A8680;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 500;
  border: 1.5px solid #2A2A30;
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-outline:hover {
  border-color: #D4A843;
  color: #F0EDE8;
}

.gold-text { color: #D4A843; }

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #2A2A30;
  border-top-color: #D4A843;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 60px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-box { text-align: center; padding: 20px; }
.loading-box p { color: #6B6860; font-size: 14px; margin-top: 12px; }

.error-box { text-align: center; padding: 40px 20px; }
.error-box p { color: #6B6860; font-size: 14px; margin: 10px 0 20px; }


/* --- Screen transitions --- */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100dvh;
}
.screen.active {
  display: flex;
  animation: fadeUp 0.35s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* --- Welcome screen --- */
#screen-welcome {
  align-items: center;
  justify-content: space-between;
  /* extra top padding for the notch/dynamic island on iPhones */
  padding: calc(52px + env(safe-area-inset-top)) 28px calc(32px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 20%, rgba(212,168,67,0.12) 0%, transparent 65%);
}

.welcome-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  flex: 1;
  justify-content: center;
}

/* actual PNG logo */
.logo-img {
  width: 220px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 32px rgba(212,168,67,0.55));
  animation: floatUp 3.5s ease-in-out infinite;
}

/* SVG fallback — shown if logo.png fails to load */
.logo-arch {
  width: 100px;
  height: 100px;
  filter: drop-shadow(0 0 30px rgba(212,168,67,0.5));
  animation: floatUp 3.5s ease-in-out infinite;
}

@keyframes floatUp {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-10px); }
}

.welcome-title { text-align: center; }
.welcome-title h1 {
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  font-weight: 700;
  line-height: 1.1;
}
.welcome-subtitle {
  margin-top: 12px;
  font-size: 15px;
  color: #6B6860;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
}

.welcome-tagline {
  text-align: center;
  font-size: 16px;
  color: #8A8680;
  line-height: 1.7;
  max-width: 300px;
}

.welcome-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}


/* --- Mood grid --- */
#screen-moods {
  /* room for the fixed nav bar + phone gesture strip at the bottom */
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.moods-header {
  padding: calc(20px + env(safe-area-inset-top)) 24px 16px;
  text-align: center;
}
.moods-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}
.moods-header h2 em { font-style: italic; color: #D4A843; }
.moods-header p     { margin-top: 6px; font-size: 14px; color: #6B6860; }

/* small logo above the mood grid */
.logo-small {
  display: block;
  width: 130px;
  height: auto;
  object-fit: contain;
  margin: 0 auto 10px;
  filter: drop-shadow(0 0 14px rgba(212,168,67,0.4));
}

.mood-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px 20px;
}

.mood-card {
  border-radius: 20px;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: 1.5px solid transparent;
  background: #161618;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: cardPop 0.4s ease both;
}

.mood-card:nth-child(1) { animation-delay: 0.05s; }
.mood-card:nth-child(2) { animation-delay: 0.10s; }
.mood-card:nth-child(3) { animation-delay: 0.15s; }
.mood-card:nth-child(4) { animation-delay: 0.20s; }
.mood-card:nth-child(5) { animation-delay: 0.25s; }
.mood-card:nth-child(6) { animation-delay: 0.30s; }
.mood-card:nth-child(7) { animation-delay: 0.35s; }
.mood-card:nth-child(8) { animation-delay: 0.40s; }

@keyframes cardPop {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.mood-card:active { transform: scale(0.95); }
.mood-card:hover  { transform: scale(1.03); box-shadow: 0 8px 28px rgba(0,0,0,0.4); }

.mood-emoji { font-size: 2.4rem; line-height: 1; }
.mood-label { font-size: 15px; font-weight: 600; color: #F0EDE8; }
.mood-sub   { font-size: 11px; color: #6B6860; text-align: center; line-height: 1.4; }


/* --- Verse display --- */
#screen-verse {
  padding-bottom: 20px;
}

.verse-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* account for the notch/status bar */
  padding: calc(16px + env(safe-area-inset-top)) 20px 16px;
}

.back-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #1A1A1E;
  border: 1px solid #2A2A30;
  color: #8A8680;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.back-btn:hover { color: #D4A843; border-color: #D4A843; }

.mood-pill {
  background: rgba(212,168,67,0.12);
  border: 1px solid rgba(212,168,67,0.3);
  color: #D4A843;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
}

.tradition-toggle {
  display: flex;
  margin: 0 20px 20px;
  background: #161618;
  border: 1px solid #2A2A30;
  border-radius: 100px;
  padding: 4px;
  gap: 4px;
}
.toggle-option {
  flex: 1;
  padding: 9px;
  border-radius: 100px;
  border: none;
  background: transparent;
  color: #6B6860;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.toggle-option.active {
  background: linear-gradient(135deg, #D4A843, #F0C860);
  color: #0C0C0F;
}

.verse-card {
  margin: 0 20px;
  background: #141418;
  border: 1px solid rgba(212,168,67,0.25);
  border-radius: 24px;
  padding: 28px 24px;
  position: relative;
  overflow: hidden;
}
.verse-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #8B6E2A, #D4A843, #F0C860, #D4A843, #8B6E2A);
}

.verse-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(212,168,67,0.1);
  color: #D4A843;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
}

.arabic-text {
  font-family: 'Noto Naskh Arabic', serif;
  font-size: 26px;
  line-height: 2.1;
  direction: rtl;
  text-align: center;
  color: #F0EDE8;
  padding: 8px 0;
}

.verse-divider {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,168,67,0.4), transparent);
  margin: 18px 0;
}

.english-text {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-style: italic;
  line-height: 1.75;
  color: #E8E5E0;
}

.translation-label {
  margin-top: 14px;
  font-size: 11px;
  color: #404040;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.audio-player {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 16px 20px 0;
  background: #161618;
  border: 1px solid #2A2A30;
  border-radius: 16px;
  padding: 14px 18px;
}

.play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4A843, #F0C860);
  border: none;
  color: #0C0C0F;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.play-btn:active { transform: scale(0.92); }

.audio-info { flex: 1; }
.audio-info span   { display: block; font-size: 12px; color: #6B6860; }
.audio-info strong { font-size: 14px; font-weight: 600; color: #F0EDE8; }

.wave-bars {
  display: flex;
  align-items: center;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.3s;
}
.wave-bars.playing { opacity: 1; }
.wave-bars span {
  display: block;
  width: 3px;
  border-radius: 3px;
  background: #D4A843;
  animation: wave 1.1s ease-in-out infinite;
}
.wave-bars span:nth-child(1) { height: 8px;  animation-delay: 0.0s; }
.wave-bars span:nth-child(2) { height: 16px; animation-delay: 0.15s; }
.wave-bars span:nth-child(3) { height: 22px; animation-delay: 0.3s; }
.wave-bars span:nth-child(4) { height: 16px; animation-delay: 0.45s; }
.wave-bars span:nth-child(5) { height: 8px;  animation-delay: 0.6s; }
@keyframes wave {
  0%, 100% { transform: scaleY(0.5); opacity: 0.5; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

.verse-actions {
  display: flex;
  gap: 10px;
  margin: 14px 20px 0;
}
.action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 13px 8px;
  background: #141418;
  border: 1px solid #2A2A30;
  border-radius: 14px;
  color: #6B6860;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.action-btn:hover { border-color: #D4A843; color: #F0EDE8; }
.action-btn.saved {
  border-color: #D4A843;
  color: #D4A843;
  background: rgba(212,168,67,0.08);
}


/* --- Saved verses --- */
#screen-saved {
  padding-bottom: calc(90px + env(safe-area-inset-bottom));
}

.saved-header {
  /* notch spacing */
  padding: calc(20px + env(safe-area-inset-top)) 24px 20px;
}
.saved-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
}
.saved-header h2 em { font-style: italic; color: #D4A843; }
.saved-header p     { margin-top: 6px; font-size: 14px; color: #6B6860; }

.saved-list { padding: 0 20px; display: flex; flex-direction: column; gap: 14px; }

.saved-item {
  background: #141418;
  border: 1px solid #2A2A30;
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.2s;
}
.saved-item:hover { border-color: rgba(212,168,67,0.3); }

.saved-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.source-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
}
.badge-quran { background: rgba(212,168,67,0.12); color: #D4A843; }
.badge-bible { background: rgba(100,150,200,0.12); color: #7AA8D4; }

.remove-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1E1E24;
  border: none;
  color: #404040;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: color 0.2s, background 0.2s;
}
.remove-btn:hover { background: rgba(224,80,80,0.15); color: #E05050; }

.saved-arabic {
  font-family: 'Noto Naskh Arabic', serif;
  font-size: 20px;
  line-height: 2;
  direction: rtl;
  text-align: right;
  color: #D4A843;
}

.saved-english {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-style: italic;
  line-height: 1.65;
  color: #C0BDB8;
}

.saved-meta { display: flex; justify-content: space-between; align-items: center; }
.saved-ref  { font-size: 12px; color: #6B6860; }
.saved-date { font-size: 11px; color: #404040; }

.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon  { font-size: 52px; opacity: 0.3; margin-bottom: 16px; }
.empty-state h3 { font-family: 'Playfair Display', serif; font-size: 22px; color: #6B6860; }
.empty-state p  { margin-top: 8px; font-size: 14px; color: #404040; }


/* --- Bottom nav ---
   safe-area-inset-bottom keeps it above the home indicator / gesture strip */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  display: flex;
  background: rgba(12,12,15,0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid #1E1E24;
  padding: 10px 0 calc(14px + env(safe-area-inset-bottom));
  z-index: 50;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: #404040;
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.2s;
}
.nav-btn.active { color: #D4A843; }
.nav-btn svg    { width: 22px; height: 22px; }


/* --- Toast --- */
#toast {
  position: fixed;
  /* floats just above the bottom nav */
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1E1E24;
  border: 1px solid rgba(212,168,67,0.3);
  color: #F0EDE8;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 200;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
