/* =========================================================
   21 SPARKS - UNIFIED DESIGN SYSTEM & MULTI-THEME ENGINE
   Theme 1: Blush & Champagne (Light Mode)
   Twilight: Cyber-Romantic Glassmorphism (Dark Mode)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Playfair+Display:ital,wght@0,600;0,700;1,400;1,600&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root, [data-theme="light"] {
  /* Color Palette — Blush & Champagne Light Mode */
  --bg-dark: #FFFBF7;
  --bg-deep-violet: #FDF6EE;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: #FFFFFF;
  --bg-card-solid: #FFFFFF;
  --bg-subtle-box: #FDF6EE;
  --bg-subtle-box-hover: #FFF5F7;
  --bg-input: #FDF6EE;
  --bg-header-pill: rgba(255, 255, 255, 0.85);
  --bg-header-pill-hover: #FFFFFF;
  --bg-nav-bar: rgba(255, 255, 255, 0.88);
  --bg-modal: #FFFFFF;
  --bg-modal-backdrop: rgba(43, 35, 33, 0.55);
  --bg-chat-scroll: #FFFBF7;
  --bg-partner-bubble: #FFFFFF;
  --bg-sim-bar: rgba(255, 255, 255, 0.95);
  --bg-sim-btn: #FDF6EE;
  --bg-sim-btn-hover: #FFF5F7;
  --bg-surface-glass: rgba(255, 255, 255, 0.7);
  --bg-card-glass: #FDF6EE;
  
  --border-subtle: rgba(255, 77, 109, 0.28);
  --border-glow: rgba(255, 77, 109, 0.48);
  --border-glass: rgba(255, 77, 109, 0.36);

  /* Primary Brand Accents */
  --accent-rose: #FF4D6D;
  --accent-rose-glow: rgba(255, 77, 109, 0.28);
  --accent-purple: #9333EA;
  --accent-purple-glow: rgba(147, 51, 234, 0.25);
  --accent-amber: #D97706;
  --accent-cyan: #0284C7;
  --accent-emerald: #059669;
  --accent-emerald-glow: rgba(5, 150, 105, 0.25);

  /* Typography Colors */
  --text-primary: #2B2321;
  --text-secondary: #6E6260;
  --text-muted: #9C8E8B;
  --text-dark: #1A1312;

  /* Typography Families */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;

  /* Elevation & Shadows */
  --shadow-sm: 0 2px 10px rgba(160, 100, 80, 0.06), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 8px 24px rgba(160, 100, 80, 0.09), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 18px 45px rgba(160, 100, 80, 0.12), 0 4px 14px rgba(0, 0, 0, 0.05);
  --shadow-rose: 0 8px 24px rgba(255, 77, 109, 0.25);
  --shadow-purple: 0 8px 24px rgba(147, 51, 234, 0.22);

  /* Border Radii */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  /* Ambient Dynamic Themes */
  --body-bg-gradient: radial-gradient(at 15% 10%, rgba(255, 117, 143, 0.1) 0px, transparent 50%),
    radial-gradient(at 85% 90%, rgba(254, 215, 170, 0.15) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(253, 246, 238, 0.8) 0px, transparent 100%);
  --brand-title-gradient: linear-gradient(135deg, #1A1312 10%, #FF4D6D 80%, #9333EA 100%);
  --orb1-bg: radial-gradient(circle, rgba(255, 117, 143, 0.12) 0%, transparent 70%);
  --orb2-bg: radial-gradient(circle, rgba(251, 146, 60, 0.1) 0%, transparent 70%);
}

[data-theme="dark"] {
  /* Color Palette — Twilight Glassmorphism Dark Mode */
  --bg-dark: #080611;
  --bg-deep-violet: #0f0a1c;
  --bg-card: rgba(23, 17, 42, 0.78);
  --bg-card-hover: rgba(35, 26, 64, 0.90);
  --bg-card-solid: #17112a;
  --bg-subtle-box: rgba(255, 255, 255, 0.04);
  --bg-subtle-box-hover: rgba(255, 255, 255, 0.08);
  --bg-input: rgba(15, 10, 28, 0.85);
  --bg-header-pill: rgba(255, 255, 255, 0.06);
  --bg-header-pill-hover: rgba(255, 255, 255, 0.12);
  --bg-nav-bar: rgba(23, 17, 42, 0.85);
  --bg-modal: #16102a;
  --bg-modal-backdrop: rgba(4, 2, 8, 0.75);
  --bg-chat-scroll: #0b0718;
  --bg-partner-bubble: rgba(255, 255, 255, 0.08);
  --bg-sim-bar: rgba(15, 10, 28, 0.92);
  --bg-sim-btn: rgba(255, 255, 255, 0.08);
  --bg-sim-btn-hover: rgba(255, 255, 255, 0.15);
  --bg-surface-glass: rgba(23, 17, 42, 0.65);
  --bg-card-glass: rgba(255, 255, 255, 0.04);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(255, 51, 102, 0.35);
  --border-glass: rgba(255, 255, 255, 0.14);

  /* Primary Brand Accents */
  --accent-rose: #ff2a6d;
  --accent-rose-glow: rgba(255, 42, 109, 0.4);
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.4);
  --accent-amber: #f59e0b;
  --accent-cyan: #00f0ff;
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.45);

  /* Typography Colors */
  --text-primary: #ffffff;
  --text-secondary: #c4b5fd;
  --text-muted: #8c82a5;
  --text-dark: #0f0a1c;

  /* Elevation & Shadows */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-rose: 0 10px 30px rgba(255, 42, 109, 0.35);
  --shadow-purple: 0 10px 30px rgba(139, 92, 246, 0.35);

  /* Ambient Dynamic Themes */
  --body-bg-gradient: radial-gradient(at 0% 0%, rgba(255, 42, 109, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.18) 0px, transparent 50%),
    radial-gradient(at 50% 50%, #080611 0px, #0f0a1c 100%);
  --brand-title-gradient: linear-gradient(135deg, #FFFFFF 20%, #FF2A6D 75%, #C084FC 100%);
  --orb1-bg: radial-gradient(circle, rgba(255, 42, 109, 0.25) 0%, transparent 70%);
  --orb2-bg: radial-gradient(circle, rgba(139, 92, 246, 0.22) 0%, transparent 70%);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  background-image: var(--body-bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Background Ambient Glow Orbs */
.bg-ambient-orb-1 {
  position: fixed;
  top: 5%;
  left: 10%;
  width: 420px;
  height: 420px;
  background: var(--orb1-bg);
  filter: blur(70px);
  pointer-events: none;
  z-index: 0;
  transition: background 0.4s ease;
}

.bg-ambient-orb-2 {
  position: fixed;
  bottom: 10%;
  right: 10%;
  width: 480px;
  height: 480px;
  background: var(--orb2-bg);
  filter: blur(90px);
  pointer-events: none;
  z-index: 0;
  transition: background 0.4s ease;
}

/* App Container Layout */
#app-root {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 100px 16px;
}

/* Top App Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.brand-logo-wrap {
  display: flex;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.4, 1);
}

.brand-logo-wrap:hover {
  transform: scale(1.03);
}

.brand-icon {
  font-size: 2.38rem;
  line-height: 1;
  filter: drop-shadow(0 2px 10px rgba(255, 77, 109, 0.45));
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.4, 1);
}

.brand-logo-wrap:hover .brand-icon {
  transform: scale(1.15) rotate(10deg);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 2.05rem;
  font-weight: 900;
  letter-spacing: -0.7px;
  line-height: 1;
  background: var(--brand-title-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: background 0.3s ease;
}

.brand-badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: rgba(255, 77, 109, 0.1);
  border: 1px solid rgba(255, 77, 109, 0.3);
  color: var(--accent-rose);
}

/* Header Right Controls */
.header-meta-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 5px;
  background: var(--bg-header-pill);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.header-user-pill:hover {
  background: var(--bg-header-pill-hover);
  transform: translateY(-1px);
  border-color: var(--accent-rose);
  box-shadow: var(--shadow-md);
}

.header-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--accent-rose);
}

.header-user-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.header-user-name-text {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.reset-countdown-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-header-pill);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.countdown-icon {
  animation: pulse-glow 2s infinite ease-in-out;
}

#header-countdown {
  font-family: monospace;
  font-size: 0.95rem;
  color: var(--accent-rose);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-icon-btn {
  background: var(--bg-header-pill);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.header-icon-btn:hover {
  background: var(--bg-header-pill-hover);
  border-color: var(--accent-rose);
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* Toast Notifications */
.toast-popup {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: rgba(43, 35, 33, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-full);
  box-shadow: 0 12px 36px rgba(43, 35, 33, 0.25), 0 0 20px rgba(255, 77, 109, 0.2);
  z-index: 100000;
  font-weight: 600;
  font-size: 0.9rem;
  color: #FFFFFF;
  animation: toast-slide-up 0.3s cubic-bezier(0.2, 0.8, 0.4, 1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-popup.toast-success {
  border-color: var(--accent-emerald);
  box-shadow: 0 12px 36px rgba(5, 150, 105, 0.25);
}

.toast-popup.toast-error {
  border-color: #EF4444;
  box-shadow: 0 12px 36px rgba(239, 68, 68, 0.25);
}

.toast-popup.toast-info {
  border-color: #0284C7;
  box-shadow: 0 12px 36px rgba(2, 132, 199, 0.25);
}

@keyframes toast-slide-up {
  from {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Primary Navigation Tabs */
.app-nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-nav-bar);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.4, 1);
  position: relative;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 77, 109, 0.08);
}

.nav-tab-btn.active {
  background: linear-gradient(135deg, var(--accent-rose) 0%, #FF758F 100%);
  color: #FFFFFF;
  box-shadow: var(--shadow-rose);
}

.nav-badge-bubble {
  display: none !important;
}

/* Glass Card Component */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

/* Buttons System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  border-radius: var(--radius-full);
  border: none;
  padding: 12px 26px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.2, 0.8, 0.4, 1);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-rose) 0%, #FF758F 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 18px rgba(255, 77, 109, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 77, 109, 0.45);
}

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

.btn-glow {
  position: relative;
}

.btn-glow::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: inherit;
  filter: blur(10px);
  opacity: 0.35;
  z-index: -1;
}

.btn-secondary {
  background: var(--bg-header-pill);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-header-pill-hover);
  border-color: var(--accent-rose);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px dashed var(--border-subtle);
}

.btn-ghost:hover {
  background: rgba(255, 77, 109, 0.06);
  color: var(--accent-rose);
  border-color: var(--accent-rose);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.84rem;
}

/* Badge Pills */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-green {
  background: rgba(5, 150, 105, 0.12);
  border: 1px solid rgba(5, 150, 105, 0.35);
  color: #059669;
}

.badge-orange {
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: #D97706;
}

.badge-purple {
  background: rgba(147, 51, 234, 0.12);
  border: 1px solid rgba(147, 51, 234, 0.35);
  color: #9333EA;
}

.badge-muted {
  background: rgba(156, 142, 139, 0.12);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

/* Utility Animations */
@keyframes pulse-glow {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 2px 4px rgba(255, 77, 109, 0.3)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 4px 12px rgba(255, 77, 109, 0.5)); }
}

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

.animate-fade-in {
  animation: fadeIn 0.35s ease forwards;
}

.hidden {
  display: none !important;
}

/* App Views Container */
.app-view {
  width: 100%;
  animation: fadeIn 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  .header-meta-controls {
    width: 100%;
    justify-content: space-between;
  }
  .app-nav-bar {
    overflow-x: auto;
    justify-content: flex-start;
    padding: 4px;
  }
  .nav-tab-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    white-space: nowrap;
  }
}
