/* ═══════════════════════════════════════════
   MÉNAGÉNIE — Design System
   Premium Dark Theme + Glassmorphism
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ── */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-active: rgba(212, 175, 55, 0.4);

  --text-primary: #f0f0f5;
  --text-secondary: #8e8ea0;
  --text-muted: #5a5a6e;

  --accent-gold: #d4af37;
  --accent-gold-light: #f0d060;
  --accent-emerald: #34d399;
  --accent-blue: #60a5fa;
  --accent-rose: #fb7185;
  --accent-violet: #a78bfa;
  --accent-orange: #fb923c;

  --gradient-gold: linear-gradient(135deg, #d4af37, #f0d060);
  --gradient-emerald: linear-gradient(135deg, #059669, #34d399);
  --gradient-blue: linear-gradient(135deg, #2563eb, #60a5fa);
  --gradient-premium: linear-gradient(135deg, #d4af37 0%, #f0d060 50%, #d4af37 100%);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(212, 175, 55, 0.15);

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

  --font-main: 'Inter', -apple-system, sans-serif;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Background Ambient ── */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 20%, rgba(212, 175, 55, 0.04) 0%, transparent 50%),
              radial-gradient(circle at 70% 80%, rgba(52, 211, 153, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 80px;
}

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
h3 { font-size: 1.1rem; font-weight: 600; line-height: 1.4; }
p { line-height: 1.6; color: var(--text-secondary); }
small { font-size: 0.8rem; color: var(--text-muted); }

.text-gradient {
  background: var(--gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Glass Card ── */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-normal);
}

.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-gold);
  color: #0a0a0f;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(212, 175, 55, 0.4);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 16px;
}
.btn-ghost:hover { color: var(--accent-gold); }

.btn-full { width: 100%; }
.btn-lg { padding: 16px 32px; font-size: 1.05rem; border-radius: var(--radius-lg); }

/* ── Option Cards ── */
.option-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
}
.option-card:hover, .option-card.active {
  background: var(--bg-card-hover);
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-glow);
}
.option-card.active { border-color: var(--accent-gold); }
.option-card .icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1.3rem;
  flex-shrink: 0;
}
.option-card .info { flex: 1; }
.option-card .info h3 { font-size: 0.95rem; margin-bottom: 2px; }
.option-card .info p { font-size: 0.8rem; margin: 0; }

/* ── Header ── */
.page-header {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-header .back-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.2rem;
  transition: all var(--transition-fast);
}
.page-header .back-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-gold);
}

/* ── Page Content ── */
.page-content { padding: 0 20px 20px; }
.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-left: 4px;
}

/* ── Stack Layout ── */
.stack { display: flex; flex-direction: column; }
.stack-xs { gap: 4px; }
.stack-sm { gap: 8px; }
.stack-md { gap: 12px; }
.stack-lg { gap: 16px; }
.stack-xl { gap: 24px; }

/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition-fast);
  background: none;
  border: none;
  font-family: var(--font-main);
}
.nav-item .nav-icon { font-size: 1.3rem; }
.nav-item.active { color: var(--accent-gold); }
.nav-item:hover { color: var(--accent-gold-light); }

/* ── Progress Bar ── */
.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--gradient-gold);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-gold { background: rgba(212,175,55,0.15); color: var(--accent-gold); }
.badge-emerald { background: rgba(52,211,153,0.15); color: var(--accent-emerald); }
.badge-rose { background: rgba(251,113,133,0.15); color: var(--accent-rose); }

/* ── Checklist ── */
.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  -webkit-user-select: none;
  user-select: none;
}
.check-item .checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--text-muted);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  font-size: 0.75rem;
  color: transparent;
}
.check-item.checked .checkbox {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald);
  color: #fff;
}
.check-item.checked { border-color: rgba(52,211,153,0.3); }
.check-item .check-text { font-size: 0.9rem; font-weight: 500; }
.check-item.checked .check-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* ── Chat ── */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.5;
  animation: bubbleIn 0.3s ease;
}
.chat-bubble.ai {
  align-self: flex-start;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--gradient-gold);
  color: #0a0a0f;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
}
.chat-input-bar input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast);
}
.chat-input-bar input:focus { border-color: var(--accent-gold); }
.chat-input-bar input::placeholder { color: var(--text-muted); }
.chat-input-bar button {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--gradient-gold);
  border: none;
  color: #0a0a0f;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.chat-input-bar button:hover { transform: scale(1.05); }

/* ── MFSA Steps ── */
.mfsa-step {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
}
.mfsa-step .step-num {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.mfsa-step .step-content h3 { font-size: 0.95rem; margin-bottom: 4px; }
.mfsa-step .step-content p { font-size: 0.8rem; margin: 0; }

/* ── Urgency Banner ── */
.urgency-banner {
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 12px;
}
.urgency-banner.warning {
  background: rgba(251, 146, 60, 0.1);
  border: 1px solid rgba(251, 146, 60, 0.3);
}
.urgency-banner.critical {
  background: rgba(251, 113, 133, 0.1);
  border: 1px solid rgba(251, 113, 133, 0.3);
}

/* ── Animations ── */
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-in { animation: fadeIn 0.4s ease both; }
.animate-in-delay-1 { animation: fadeIn 0.4s ease 0.1s both; }
.animate-in-delay-2 { animation: fadeIn 0.4s ease 0.2s both; }
.animate-in-delay-3 { animation: fadeIn 0.4s ease 0.3s both; }
.animate-in-delay-4 { animation: fadeIn 0.4s ease 0.4s both; }

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 14px 18px;
}
.typing-indicator span {
  width: 8px;
  height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: pulse 1.2s ease infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* ── Page Transitions ── */
.page { display: none; min-height: 100dvh; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-glass); border-radius: 4px; }

/* ── Utility ── */
.text-gold { color: var(--accent-gold); }
.text-emerald { color: var(--accent-emerald); }
.text-rose { color: var(--accent-rose); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.px-1 { padding-left: 8px; padding-right: 8px; }
.hidden { display: none !important; }

/* ── Image Upload & Preview ── */
.chat-image-preview-container {
  display: flex;
  gap: 8px;
  padding: 8px 20px;
  overflow-x: auto;
  background: rgba(10, 10, 15, 0.9);
  border-top: 1px solid var(--border-glass);
}
.chat-image-preview {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border-glass);
}
.chat-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.chat-image-preview .remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.7);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  cursor: pointer;
  border: none;
}
.chat-bubble-image {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}
.btn-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.btn-icon:hover { background: rgba(255,255,255,0.1); }
