/* ============================================================
   style.css — Design "dark tech" premium
   Palette : bleu nuit profond + accents cyan électrique
   Police  : Syne (titres) + DM Sans (corps)
   ============================================================ */

/* --- VARIABLES GLOBALES --- */
:root {
  --bg:         #070b14;        /* Fond principal quasi-noir bleuté */
  --surface:    #0d1526;        /* Surface des cartes */
  --surface-2:  #111d35;        /* Surface secondaire */
  --border:     rgba(96, 165, 250, 0.12); /* Bordures subtiles */
  --accent:     #3b82f6;        /* Bleu principal */
  --accent-glow:#60a5fa;        /* Bleu lumineux pour les effets */
  --accent-2:   #06b6d4;        /* Cyan pour les accents secondaires */
  --text:       #e8edf5;        /* Texte principal */
  --text-muted: #5a6a88;        /* Texte secondaire */
  --text-dim:   #3d4f6b;        /* Texte très discret */
  --success:    #22d3a5;        /* Vert succès */
  --error:      #f87171;        /* Rouge erreur */
  --radius:     14px;
  --radius-sm:  8px;
}

/* --- RESET & BASE --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ============================================================
   FOND ANIMÉ — Grille + halos lumineux
   ============================================================ */
.bg-grid {
  position: fixed; inset: 0; z-index: 0;
  background-image:
    linear-gradient(rgba(59,130,246,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

/* Halos de lumière animés en arrière-plan */
.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  animation: float 12s ease-in-out infinite;
}
.glow-1 {
  width: 500px; height: 500px;
  background: rgba(59,130,246,0.08);
  top: -100px; left: -100px;
}
.glow-2 {
  width: 400px; height: 400px;
  background: rgba(6,182,212,0.06);
  bottom: 0; right: 0;
  animation-delay: -6s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50%       { transform: translateY(-30px) scale(1.05); }
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.container {
  position: relative; z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ============================================================
   EN-TÊTE
   ============================================================ */
.header {
  text-align: center;
  margin-bottom: 40px;
  animation: fadeUp 0.6s ease both;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.logo-icon {
  font-size: 1.6rem;
  color: var(--accent-glow);
  text-shadow: 0 0 20px var(--accent-glow);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 20px var(--accent-glow); }
  50%       { text-shadow: 0 0 40px var(--accent-glow), 0 0 60px var(--accent); }
}

.logo-text {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 30%, var(--accent-glow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 300;
}

/* ============================================================
   ONGLETS DE MODE
   ============================================================ */
.mode-tabs {
  display: flex;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 24px;
  animation: fadeUp 0.6s 0.1s ease both;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.25s ease;
  color: var(--text-muted);
  background: transparent;
  position: relative;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  color: #fff;
  box-shadow: 0 4px 20px rgba(59,130,246,0.35);
}

.tab-btn:hover:not(.active) {
  color: var(--text);
  background: var(--surface-2);
}

.tab-icon { font-size: 1rem; }

/* Petit badge "Beta" */
.badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, var(--accent-2), #0891b2);
  color: #fff;
  padding: 2px 7px;
  border-radius: 20px;
}

/* ============================================================
   CARTES
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  animation: fadeUp 0.6s 0.15s ease both;
  transition: border-color 0.3s;
}
.card:hover { border-color: rgba(96,165,250,0.2); }

.section { margin-bottom: 24px; }

/* ============================================================
   LABELS
   ============================================================ */
.label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Syne', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.label-num {
  font-size: 0.65rem;
  color: var(--accent-glow);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 700;
}

/* ============================================================
   INDICATEUR DE SENTIMENT
   ============================================================ */
.sentiment-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 0.8rem;
}

.sentiment-label { color: var(--text-muted); font-style: italic; }

.sentiment-dots { display: flex; gap: 6px; }
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: all 0.4s ease;
}
.dot.active-neg { background: var(--error); box-shadow: 0 0 8px var(--error); }
.dot.active-neu { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.dot.active-pos { background: var(--success); box-shadow: 0 0 8px var(--success); }

/* ============================================================
   TEXTAREA & INPUT
   ============================================================ */
.textarea, .input-field {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 300;
  padding: 14px 16px;
  resize: vertical;
  transition: border-color 0.25s, box-shadow 0.25s;
  outline: none;
  line-height: 1.6;
}

.input-field { resize: none; }

.textarea::placeholder, .input-field::placeholder { color: var(--text-dim); }

.textarea:focus, .input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12), inset 0 1px 2px rgba(0,0,0,0.3);
}

.char-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ============================================================
   BOUTON GÉNÉRER (principal)
   ============================================================ */
.btn-generate {
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--accent) 0%, #1e40af 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-bottom: 24px;
}

.btn-generate::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-generate:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(59,130,246,0.4);
}
.btn-generate:hover::before { opacity: 1; }
.btn-generate:active { transform: translateY(0); }
.btn-generate:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-text, .btn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-icon { font-size: 1rem; }

/* --- Spinner --- */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   ZONE DE RÉSULTAT
   ============================================================ */
.result-section {
  animation: fadeUp 0.4s ease both;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.badge-quality {
  font-size: 0.7rem;
  color: var(--success);
  border: 1px solid rgba(34,211,165,0.3);
  border-radius: 20px;
  padding: 3px 10px;
  background: rgba(34,211,165,0.08);
}

.result-box {
  background: var(--bg);
  border: 1px solid rgba(34,211,165,0.2);
  border-left: 3px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.75;
  color: var(--text);
  min-height: 60px;
  white-space: pre-wrap;
}

/* Curseur clignotant pendant l'effet machine à écrire */
.typing-cursor::after {
  content: '▋';
  color: var(--accent-glow);
  animation: blink 0.8s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ============================================================
   BOUTONS D'ACTION (Copier / Régénérer)
   ============================================================ */
.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.btn-copy, .btn-regenerate {
  flex: 1;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-copy {
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.25);
  color: var(--accent-glow);
}
.btn-copy:hover {
  background: rgba(59,130,246,0.2);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.btn-copy.copied {
  background: rgba(34,211,165,0.12);
  border-color: rgba(34,211,165,0.3);
  color: var(--success);
}

.btn-regenerate {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-regenerate:hover {
  border-color: rgba(96,165,250,0.3);
  color: var(--text);
  transform: translateY(-1px);
}

/* ============================================================
   MESSAGES D'ERREUR
   ============================================================ */
.error-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.25);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--error);
  font-size: 0.9rem;
  animation: fadeUp 0.3s ease both;
}
.error-icon { font-size: 1.1rem; flex-shrink: 0; }

/* ============================================================
   MODE AUTOMATIQUE
   ============================================================ */
.auto-intro { margin-bottom: 28px; }

.flow-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.flow-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 20px;
  min-width: 90px;
  text-align: center;
}
.flow-icon { font-size: 1.4rem; }
.flow-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }
.flow-arrow { font-size: 1.2rem; color: var(--accent); flex-shrink: 0; }

.success-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(34,211,165,0.08);
  border: 1px solid rgba(34,211,165,0.25);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 16px;
  font-size: 1.4rem;
}
.success-banner strong { display: block; color: var(--success); margin-bottom: 2px; }
.success-banner p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

.preview-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ============================================================
   STATS
   ============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
  animation: fadeUp 0.6s 0.3s ease both;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 16px;
  text-align: center;
  transition: border-color 0.3s, transform 0.2s;
}
.stat-card:hover {
  border-color: rgba(96,165,250,0.2);
  transform: translateY(-2px);
}

.stat-num {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  background: linear-gradient(135deg, #fff, var(--accent-glow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================================
   ANIMATION GLOBALE
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE MOBILE
   ============================================================ */
@media (max-width: 540px) {
  .container { padding: 24px 14px 60px; }
  .card { padding: 20px; }
  .mode-tabs { flex-direction: column; }
  .stats-row { grid-template-columns: 1fr; }
  .flow-diagram { gap: 4px; }
  .flow-step { min-width: 70px; padding: 10px 12px; }
  .action-buttons { flex-direction: column; }
}
