/* PhobiaFree — Design System Dark Mode */

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

:root {
  /* Brand colors */
  --bleu-fonce: #1E3A5F;
  --bleu-principal: #4A90D9;
  --violet: #9B89C4;
  --turquoise: #4ECDC4;

  /* Dark backgrounds */
  --bg-profond: #080f1c;
  --bg-sombre: #0e1b2e;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --bg-input: rgba(255, 255, 255, 0.06);

  /* Text */
  --texte-principal: rgba(255, 255, 255, 0.92);
  --texte-secondaire: rgba(180, 210, 240, 0.75);
  --texte-discret: rgba(140, 180, 220, 0.5);

  /* Borders */
  --border-subtil: rgba(255, 255, 255, 0.1);
  --border-active: rgba(74, 144, 217, 0.6);

  /* States */
  --alerte-rouge: #E53E3E;
  --alerte-orange: #DD6B20;
  --succes-vert: #38A169;

  /* Shadows */
  --ombre: 0 4px 24px rgba(0, 0, 0, 0.4);
  --ombre-forte: 0 8px 48px rgba(0, 0, 0, 0.6);
  --ombre-bleu: 0 4px 20px rgba(74, 144, 217, 0.25);

  /* Radii */
  --rayon: 16px;
  --rayon-petit: 8px;
  --rayon-pill: 50px;

  --transition: all 0.3s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, #080f1c 0%, #0e1b2e 50%, #080f1c 100%);
  min-height: 100vh;
  color: var(--texte-principal);
  line-height: 1.6;
}

/* ── LAYOUT ── */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 20px;
}

/* ── HEADER ── */
.app-header {
  text-align: center;
  padding: 40px 20px 20px;
}

.app-logo {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #4A90D9, #9B89C4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.app-logo span {
  background: linear-gradient(135deg, #4ECDC4, #4A90D9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-tagline {
  font-size: 1rem;
  color: var(--texte-discret);
  margin-top: 4px;
}

/* ── CARDS ── */
.card {
  background: var(--bg-card);
  border-radius: var(--rayon);
  padding: 32px;
  box-shadow: var(--ombre);
  margin-bottom: 20px;
  transition: var(--transition);
  border: 1px solid var(--border-subtil);
  backdrop-filter: blur(8px);
}

.card:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--ombre-forte);
}

.card-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--bleu-principal);
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 0.9rem;
  color: var(--texte-discret);
  margin-bottom: 24px;
}

/* ── FORMULAIRES ── */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--texte-secondaire);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-subtil);
  border-radius: var(--rayon-petit);
  font-size: 1rem;
  color: var(--texte-principal);
  background: var(--bg-input);
  transition: var(--transition);
  outline: none;
  font-family: 'Inter', system-ui, sans-serif;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--bleu-principal);
  background: rgba(74, 144, 217, 0.08);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.15);
}

input::placeholder, textarea::placeholder {
  color: var(--texte-discret);
}

select option {
  background: #0e1b2e;
  color: var(--texte-principal);
}

textarea { resize: vertical; min-height: 100px; }

/* ── SLIDER SUD ── */
.sud-container { text-align: center; }

.sud-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--texte-discret);
  margin-bottom: 8px;
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #38A169, #DD6B20, #E53E3E);
  outline: none;
  border: none;
  padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bleu-principal);
  border: 3px solid rgba(255, 255, 255, 0.9);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.sud-value {
  font-size: 3rem;
  font-weight: 700;
  color: var(--bleu-principal);
  margin-top: 12px;
  transition: var(--transition);
}

/* ── BOUTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--rayon-pill);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  font-family: 'Inter', system-ui, sans-serif;
}

.btn-primary {
  background: linear-gradient(135deg, var(--bleu-fonce), var(--bleu-principal));
  color: white;
  box-shadow: var(--ombre-bleu);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(74, 144, 217, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--texte-secondaire);
  border: 1px solid var(--border-subtil);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-vert {
  background: linear-gradient(135deg, #276749, #38A169);
  color: white;
}

.btn-danger {
  background: var(--alerte-rouge);
  color: white;
}

.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── CHAT INTERFACE ── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  min-height: 500px;
  background: rgba(8, 15, 28, 0.7);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  overflow: hidden;
  border: 1px solid var(--border-subtil);
  backdrop-filter: blur(12px);
}

.chat-header {
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.9), rgba(74, 144, 217, 0.5));
  color: white;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtil);
}

.chat-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(74, 144, 217, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border: 1px solid rgba(74, 144, 217, 0.4);
}

.chat-info h3 { font-size: 1rem; font-weight: 600; color: white; }
.chat-info p { font-size: 0.8rem; color: var(--texte-secondaire); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.message {
  max-width: 80%;
  animation: fadeInUp 0.3s ease;
}

.message-assistant { align-self: flex-start; }
.message-user { align-self: flex-end; }

.message-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.message-assistant .message-bubble {
  background: rgba(74, 144, 217, 0.12);
  color: var(--texte-principal);
  border: 1px solid rgba(74, 144, 217, 0.2);
  border-bottom-left-radius: 4px;
}

.message-user .message-bubble {
  background: linear-gradient(135deg, var(--bleu-fonce), var(--bleu-principal));
  color: white;
  border-bottom-right-radius: 4px;
}

.message-crise .message-bubble {
  background: rgba(229, 62, 62, 0.1);
  border: 1px solid rgba(229, 62, 62, 0.4);
  color: #FC8181;
}

.message-time {
  font-size: 0.75rem;
  color: var(--texte-discret);
  margin-top: 4px;
  padding: 0 4px;
}

.message-user .message-time { text-align: right; }

/* ── INDICATEUR DE FRAPPE ── */
.typing-indicator {
  display: none;
  align-self: flex-start;
  max-width: 80%;
}

.typing-indicator.active { display: block; }

.typing-bubble {
  background: rgba(74, 144, 217, 0.12);
  border: 1px solid rgba(74, 144, 217, 0.2);
  padding: 14px 18px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bleu-principal);
  animation: typing 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* ── INPUT ZONE ── */
.chat-input-zone {
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtil);
  background: rgba(8, 15, 28, 0.6);
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-subtil);
  border-radius: 24px;
  font-size: 0.95rem;
  resize: none;
  max-height: 120px;
  background: var(--bg-input);
  color: var(--texte-principal);
  outline: none;
  transition: var(--transition);
  font-family: 'Inter', system-ui, sans-serif;
}

.chat-input:focus {
  border-color: var(--bleu-principal);
  background: rgba(74, 144, 217, 0.08);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.12);
}

.chat-input::placeholder { color: var(--texte-discret); }

.btn-send {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bleu-fonce), var(--bleu-principal));
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  transition: var(--transition);
  box-shadow: var(--ombre-bleu);
}

.btn-send:hover { transform: scale(1.1); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── ANIMATION EMDR (BLS) ── */
.emdr-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #0a1628 0%, #060e18 100%);
  z-index: 1000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
}

.emdr-overlay.active { display: flex; }

.emdr-track {
  width: min(700px, 90vw);
  height: 120px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 60px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.emdr-dot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle, #b8e0ff, var(--bleu-principal));
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 10px;
  box-shadow: 0 0 30px rgba(74, 144, 217, 0.9), 0 0 60px rgba(74, 144, 217, 0.4);
  transition: left 0.6s ease-in-out;
}

.emdr-instruction {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.1rem;
  text-align: center;
  max-width: 500px;
  line-height: 1.7;
}

.emdr-counter { color: var(--texte-discret); font-size: 0.9rem; }

.btn-emdr-stop {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 24px;
  border-radius: var(--rayon-pill);
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition);
  font-family: 'Inter', system-ui, sans-serif;
}

.btn-emdr-stop:hover {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.85);
}

/* ── EFT GUIDE ── */
.eft-guide {
  background: rgba(155, 137, 196, 0.08);
  border: 1px solid rgba(155, 137, 196, 0.2);
  border-radius: var(--rayon);
  padding: 24px;
  margin: 16px 0;
}

.eft-point {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border-radius: var(--rayon-petit);
  margin-bottom: 8px;
  transition: var(--transition);
  color: var(--texte-secondaire);
}

.eft-point.active {
  background: rgba(155, 137, 196, 0.2);
  color: white;
  transform: scale(1.02);
  border: 1px solid rgba(155, 137, 196, 0.4);
}

.eft-point-numero {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(155, 137, 196, 0.3);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  border: 1px solid rgba(155, 137, 196, 0.5);
}

.eft-point.active .eft-point-numero {
  background: var(--violet);
}

/* ── PROGRESSION ── */
.progress-bar {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(to right, #38A169, var(--bleu-principal));
  transition: width 0.8s ease;
}

.semaines-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin: 16px 0;
}

.semaine-dot {
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--texte-discret);
  transition: var(--transition);
}

.semaine-dot.completee {
  background: rgba(56, 161, 105, 0.25);
  border-color: #38A169;
  color: #68D391;
}

.semaine-dot.actuelle {
  background: rgba(74, 144, 217, 0.3);
  border-color: var(--bleu-principal);
  color: white;
  transform: scale(1.2);
}

/* ── ALERTE CRISE ── */
.crise-banner {
  display: none;
  background: rgba(229, 62, 62, 0.1);
  border: 1px solid rgba(229, 62, 62, 0.4);
  border-radius: var(--rayon);
  padding: 20px 24px;
  margin-bottom: 20px;
  animation: fadeInUp 0.3s ease;
  backdrop-filter: blur(8px);
}

.crise-banner.active { display: block; }

.crise-titre {
  color: #FC8181;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 8px;
}

.crise-numero {
  font-size: 1.5rem;
  font-weight: 700;
  color: #FC8181;
}

/* ── SUD BADGE ── */
.sud-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.85rem;
}

.sud-badge.low {
  background: rgba(56, 161, 105, 0.15);
  color: #68D391;
  border: 1px solid rgba(56, 161, 105, 0.3);
}

.sud-badge.medium {
  background: rgba(221, 107, 32, 0.15);
  color: #F6AD55;
  border: 1px solid rgba(221, 107, 32, 0.3);
}

.sud-badge.high {
  background: rgba(229, 62, 62, 0.15);
  color: #FC8181;
  border: 1px solid rgba(229, 62, 62, 0.3);
}

/* ── ANIMATIONS ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pulse { animation: pulse 2s infinite; }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .container { padding: 12px; }
  .card { padding: 20px; }
  .chat-container { height: calc(100vh - 140px); }
  .emdr-track { height: 80px; }
  .emdr-dot { width: 36px; height: 36px; }
  .semaines-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.03); }
::-webkit-scrollbar-thumb {
  background: rgba(74, 144, 217, 0.4);
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(74, 144, 217, 0.7);
}
