/* ============================================
   ASKPOPS — Light mode, minimaliste, premium
   (Identique au bloc <style> inline dans index.html)
   ============================================ */

:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --border: #e5e9ee;
  --border-strong: #d1d7df;

  --text: #0d1117;
  --text-soft: #475569;
  --text-muted: #94a3b8;

  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --accent-soft: #e0f2fe;
  --accent-glow: rgba(14, 165, 233, 0.18);

  --success: #10b981;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -8px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 0 0 4px var(--accent-glow);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.app { display: flex; flex-direction: column; height: 100vh; width: 100%; }

/* Header */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.brand-emoji { font-size: 1.4rem; }
.brand-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  filter: drop-shadow(0 2px 6px rgba(14, 165, 233, 0.25));
  transition: transform 0.18s ease;
}
.brand:hover .brand-logo { transform: scale(1.08) rotate(-3deg); }
.brand-name { font-size: 1.15rem; font-weight: 800; color: var(--text); letter-spacing: -0.03em; }
.brand-name--accent { color: var(--accent); }

.header-right { display: flex; align-items: center; gap: 0.6rem; }

/* Lang switch */
.lang-switch {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.18rem;
  gap: 2px;
}
.lang-btn {
  padding: 0.3rem 0.65rem;
  background: transparent;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.02em;
}
.lang-btn:hover { color: var(--text-soft); }
.lang-btn--active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem; font-weight: 500;
  color: var(--text-soft);
}
.badge-dot {
  width: 0.45rem; height: 0.45rem;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Main */
.main {
  flex: 1; overflow-y: auto; padding: 0 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.main::-webkit-scrollbar { width: 8px; }
.main::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* Welcome */
.welcome { max-width: 720px; margin: 0 auto; padding: 3.5rem 0 2rem; text-align: center; }
.welcome-emoji-wrap { position: relative; display: inline-block; margin-bottom: 2rem; }
.welcome-emoji {
  font-size: 4.5rem; position: relative; z-index: 1; display: block;
  animation: bob 4s ease-in-out infinite;
}
.welcome-emoji-glow {
  position: absolute; inset: -20px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  filter: blur(20px); z-index: 0;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.welcome-title {
  font-size: 2.75rem; font-weight: 800; line-height: 1.1;
  letter-spacing: -0.03em; margin-bottom: 1rem; color: var(--text);
}
.welcome-title--accent {
  background: linear-gradient(120deg, var(--accent) 0%, #6366f1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.welcome-subtitle {
  font-size: 1.1rem; color: var(--text-soft);
  max-width: 520px; margin: 0 auto 3rem; line-height: 1.6;
}

/* Suggestions */
.suggestions {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.85rem;
  max-width: 620px; margin: 0 auto;
}
.suggestion {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-family: inherit; text-align: left; cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xs);
}
.suggestion:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.suggestion-emoji { font-size: 1.6rem; flex-shrink: 0; }
.suggestion-content { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.suggestion-title { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.suggestion-meta { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.suggestion-arrow { font-size: 1.2rem; color: var(--text-muted); transition: all 0.18s; flex-shrink: 0; }
.suggestion:hover .suggestion-arrow { color: var(--accent); transform: translateX(3px); }

/* Messages */
.messages {
  max-width: 720px; margin: 0 auto; padding: 2rem 0 1rem;
  display: flex; flex-direction: column; gap: 1.5rem;
}
.message { display: flex; gap: 0.9rem; animation: messageIn 0.35s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes messageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.message-avatar {
  width: 2.2rem; height: 2.2rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.message--user .message-avatar {
  background: var(--accent); border-color: var(--accent);
  color: white; font-weight: 700; font-size: 0.85rem;
}
.message-content {
  flex: 1; padding-top: 0.3rem; line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap; word-wrap: break-word;
  font-size: 0.98rem;
}
.message--loading .message-content { color: var(--text-muted); }
.message--loading .message-content::after {
  content: '▊'; display: inline-block;
  animation: blink 1s steps(2) infinite;
  margin-left: 2px; color: var(--accent);
}
@keyframes blink { 50% { opacity: 0; } }

/* === Reponses style "lecon de papa" === */
.papa-content { white-space: normal; }

.papa-p { margin: 0 0 0.6rem 0; }
.papa-p:last-child { margin-bottom: 0; }

.papa-list {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.papa-list li { line-height: 1.55; padding-left: 0.25rem; }
.papa-list:not(.papa-list--bullets) li::marker {
  font-weight: 700;
  color: var(--accent);
}

.papa-content strong { font-weight: 700; color: var(--text); }

/* Callout "⚡ Petit conseil de Papa" */
.papa-tip {
  margin-top: 1rem;
  padding: 0.9rem 1rem 0.9rem 2.6rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #fbbf24;
  border-left: 4px solid #f59e0b;
  border-radius: 12px;
  font-size: 0.93rem;
  position: relative;
  line-height: 1.5;
  color: #78350f;
}
.papa-tip::before {
  content: "⚡";
  position: absolute;
  left: 0.85rem;
  top: 0.85rem;
  font-size: 1.1rem;
}
.papa-tip strong { color: #78350f; }

/* === Bouton "Ecouter" sur les messages de Papa === */
.message-speak-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin-top: 0.8rem;
  padding: 0.35rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.message-speak-btn:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
}
.message-speak-btn.is-playing {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.message-speak-btn svg { width: 0.85rem; height: 0.85rem; }
.message-speak-icon { display: inline-flex; align-items: center; }
.message-speak-icon--stop { display: none; }
.message-speak-btn.is-playing .message-speak-icon--play { display: none; }
.message-speak-btn.is-playing .message-speak-icon--stop { display: inline-flex; }

/* === Bouton "Soutenir ASKPOPS" === */
.donate-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
  color: white;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.3);
}
.donate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.45);
}
.donate-btn__heart {
  font-size: 1rem;
  animation: donatePulse 1.6s ease-in-out infinite;
}
@keyframes donatePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@media (max-width: 760px) {
  .donate-btn__label { display: none; }
  .donate-btn { padding: 0.5rem 0.7rem; }
  .badge { display: none; }
}

/* === Bouton "Appeler Papa" === */
.call-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}
.call-btn:hover {
  background: #059669;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}
.call-btn__icon { width: 1rem; height: 1rem; }

/* === Modal d'appel === */
.call-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
  display: none;
  flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2rem 2rem 7rem;
}
.call-modal.is-active { display: flex; animation: callIn 0.3s ease-out; }
@keyframes callIn { from { opacity: 0; } to { opacity: 1; } }

.call-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 2rem; max-width: 480px; width: 100%; text-align: center;
}

.call-avatar-wrap {
  position: relative;
  width: 12rem; height: 12rem;
  display: flex; align-items: center; justify-content: center;
}
.call-avatar {
  font-size: 7rem; z-index: 3; position: relative;
  filter: drop-shadow(0 4px 30px rgba(14, 165, 233, 0.5));
  animation: callFloat 3s ease-in-out infinite;
}
@keyframes callFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.call-avatar-pulse {
  position: absolute; inset: 1rem;
  border-radius: 50%; background: var(--accent);
  opacity: 0;
  animation: callPulse 2.4s ease-out infinite;
}
.call-avatar-pulse--2 { animation-delay: 1.2s; }
@keyframes callPulse {
  0% { transform: scale(0.5); opacity: 0.5; }
  100% { transform: scale(1.6); opacity: 0; }
}
.call-modal[data-state="speaking"] .call-avatar-pulse {
  background: #f59e0b;
  animation-duration: 1.4s;
}

.call-status {
  color: white; font-size: 1.5rem;
  font-weight: 700; letter-spacing: -0.02em;
  margin: 0;
}

.call-visualizer {
  display: flex; gap: 5px; height: 44px; align-items: center;
}
.call-bar {
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  height: 25%;
  transition: background 0.2s;
}
.call-modal[data-state="listening"] .call-bar,
.call-modal[data-state="speaking"] .call-bar {
  animation: callWave 0.9s ease-in-out infinite;
}
.call-modal[data-state="listening"] .call-bar:nth-child(1) { animation-delay: 0s; }
.call-modal[data-state="listening"] .call-bar:nth-child(2) { animation-delay: 0.1s; }
.call-modal[data-state="listening"] .call-bar:nth-child(3) { animation-delay: 0.2s; }
.call-modal[data-state="listening"] .call-bar:nth-child(4) { animation-delay: 0.15s; }
.call-modal[data-state="listening"] .call-bar:nth-child(5) { animation-delay: 0.05s; }
.call-modal[data-state="speaking"] .call-bar { background: #f59e0b; animation-duration: 0.5s; }
.call-modal[data-state="speaking"] .call-bar:nth-child(1) { animation-delay: 0s; }
.call-modal[data-state="speaking"] .call-bar:nth-child(2) { animation-delay: 0.08s; }
.call-modal[data-state="speaking"] .call-bar:nth-child(3) { animation-delay: 0.16s; }
.call-modal[data-state="speaking"] .call-bar:nth-child(4) { animation-delay: 0.12s; }
.call-modal[data-state="speaking"] .call-bar:nth-child(5) { animation-delay: 0.04s; }
@keyframes callWave { 0%,100% { height: 20%; } 50% { height: 100%; } }

.call-transcript {
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.95rem; font-style: italic;
  min-height: 1.5em; max-width: 90%; line-height: 1.5;
}

.call-hangup {
  position: absolute; bottom: 3rem;
  width: 4.5rem; height: 4.5rem;
  background: #dc2626; color: white; border: none;
  border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.4);
}
.call-hangup:hover { background: #b91c1c; transform: scale(1.05); }
.call-hangup svg { width: 1.8rem; height: 1.8rem; transform: rotate(135deg); }

@media (max-width: 640px) {
  .call-btn__label { display: none; }
  .call-btn { padding: 0.55rem; }
  .call-avatar { font-size: 5.5rem; }
  .call-avatar-wrap { width: 10rem; height: 10rem; }
  .call-status { font-size: 1.25rem; }
}

/* Composer */
.composer-wrap {
  flex-shrink: 0;
  padding: 1rem 1.5rem 1.25rem;
  background: linear-gradient(to top, var(--bg) 60%, rgba(250, 251, 252, 0));
}
.composer {
  display: flex; align-items: flex-end; gap: 0.5rem;
  max-width: 720px; margin: 0 auto;
  padding: 0.6rem 0.6rem 0.6rem 1.25rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
  transition: all 0.18s ease;
}
.composer:focus-within { border-color: var(--accent); box-shadow: var(--shadow-lg), var(--shadow-glow); }
.composer-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-family: inherit;
  font-size: 1rem; line-height: 1.5;
  resize: none; padding: 0.6rem 0;
  max-height: 200px; overflow-y: auto;
  scrollbar-width: thin;
  letter-spacing: -0.005em;
}
.composer-input::placeholder { color: var(--text-muted); }

.composer-send {
  width: 2.6rem; height: 2.6rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: white; border: none;
  border-radius: 14px; cursor: pointer; flex-shrink: 0;
  transition: all 0.18s ease;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.composer-send svg { width: 1.2rem; height: 1.2rem; }
.composer-send:hover:not(:disabled) {
  background: var(--accent-hover); transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--accent-glow);
}
.composer-send:disabled {
  background: var(--border-strong); color: var(--text-muted);
  cursor: not-allowed; box-shadow: none; transform: none;
}

.composer-hint {
  text-align: center; margin-top: 0.75rem;
  font-size: 0.78rem; color: var(--text-muted);
  max-width: 720px; margin-left: auto; margin-right: auto;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 640px) {
  .header { padding: 0.9rem 1rem; }
  .main { padding: 0 1rem; }
  .composer-wrap { padding: 0.75rem 1rem 1rem; }
  .welcome { padding: 2rem 0 1.5rem; }
  .welcome-emoji { font-size: 3.5rem; }
  .welcome-title { font-size: 1.85rem; }
  .welcome-subtitle { font-size: 0.98rem; margin-bottom: 2rem; }
  .suggestions { grid-template-columns: 1fr; }
  .composer { padding: 0.55rem 0.55rem 0.55rem 1rem; border-radius: 20px; }
  .composer-send { width: 2.4rem; height: 2.4rem; }
}
