/* ImmoWin — design system v2. Brand anchor #17E0BE (teal/mint).
   Replaces the borrowed purple palette. Token-based so the whole system is
   one-place-swappable — see :root. */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;900&display=swap');

:root {
  /* Brand */
  --brand: #17E0BE;
  --brand-hover: #12BFA2;
  --brand-pressed: #0E9E86;
  --brand-soft: rgba(23, 224, 190, .12);
  --brand-soft-strong: rgba(23, 224, 190, .22);
  --on-brand: #07110F; /* text/icons drawn on top of a brand-colored surface */

  /* Backgrounds — dark, derived from the brand color (cold teal cast, not neutral black) */
  --bg-base: #07110F;
  --bg-card: #0D1F1B;
  --bg-raised: #12291F;
  --border-subtle: rgba(23, 224, 190, .14);
  --border-strong: rgba(23, 224, 190, .28);

  /* Text */
  --text-primary: #F2FBF9;
  --text-secondary: #8FB5AC;
  --text-tertiary: #5C7972;

  /* Semantic */
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #E5484D;
  --danger-soft: rgba(229, 72, 77, .14);

  /* Spacing scale */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;

  /* Radii */
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-pill: 999px;

  /* Elevation — faint teal glow instead of heavy black drop shadows */
  --shadow-card: 0 1px 0 rgba(255,255,255,.02) inset, 0 8px 24px rgba(0,0,0,.35);
  --shadow-glow: 0 0 0 1px var(--border-subtle), 0 0 24px rgba(23,224,190,.10);
  --shadow-glow-strong: 0 0 0 1px var(--border-strong), 0 0 32px rgba(23,224,190,.22);

  /* Motion */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --duration-fast: 150ms;
  --duration-base: 220ms;
  --duration-slow: 320ms;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

* { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
  margin: 0;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse 60% 40% at 15% 0%, rgba(23,224,190,.07), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(23,224,190,.05), transparent 60%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3 { font-family: 'Plus Jakarta Sans', sans-serif; letter-spacing: -.01em; }

/* ---------- Header ---------- */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 10;
  background: rgba(7,17,15,.85);
  backdrop-filter: blur(10px);
}
.wordmark { display: flex; flex-direction: column; line-height: 1; }
.wordmark .title { font-weight: 900; font-size: 1.15rem; letter-spacing: .01em; color: var(--text-primary); }
.wordmark .title span { color: var(--brand); }
.wordmark .subtitle { font-size: .64rem; color: var(--text-tertiary); letter-spacing: .12em; text-transform: uppercase; margin-top: 3px; }

.header-actions { display: flex; align-items: center; gap: var(--space-2); }
.icon-btn {
  width: 34px; height: 34px; border-radius: var(--radius-sm); border: 1px solid var(--border-subtle);
  background: var(--bg-card); color: var(--text-secondary); font-size: .95rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all var(--duration-fast) var(--ease);
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--brand); }

nav.tabs { display: flex; gap: var(--space-1); background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 4px; }
nav.tabs button {
  border: none; background: transparent; color: var(--text-secondary);
  font-family: inherit; font-weight: 700; font-size: .78rem;
  padding: 7px 13px; border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--duration-fast) var(--ease);
}
nav.tabs button.active { background: var(--brand); color: var(--on-brand); }
nav.tabs button:not(.active):hover { color: var(--text-primary); }

/* ---------- Main ---------- */
main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: var(--space-8) var(--space-5) 88px; }
.view { width: 100%; max-width: 480px; display: none; flex-direction: column; align-items: center; }
.view.active { display: flex; animation: viewIn var(--duration-base) var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Record view ---------- */
.tagline { font-size: 1.1rem; font-weight: 700; margin: var(--space-2) 0 var(--space-1); text-align: center; }
.hint { font-size: .85rem; color: var(--text-secondary); text-align: center; margin-bottom: var(--space-10); max-width: 340px; line-height: 1.5; }

#recordBtn {
  width: 108px; height: 108px; border-radius: 50%;
  border: none; background: var(--brand); color: var(--on-brand);
  font-size: 2.1rem; cursor: pointer;
  box-shadow: 0 0 0 8px var(--brand-soft), 0 10px 28px rgba(23,224,190,.28);
  transition: transform var(--duration-fast) var(--ease), background var(--duration-base) var(--ease), box-shadow var(--duration-base) var(--ease);
  animation: idlePulse 2.6s ease-in-out infinite;
}
@keyframes idlePulse {
  0%, 100% { box-shadow: 0 0 0 8px var(--brand-soft), 0 10px 28px rgba(23,224,190,.28); }
  50% { box-shadow: 0 0 0 13px var(--brand-soft-strong), 0 10px 28px rgba(23,224,190,.28); }
}
#recordBtn:active { transform: scale(.95); }
#recordBtn.recording {
  background: var(--danger); box-shadow: 0 0 0 8px var(--danger-soft), 0 10px 28px rgba(229,72,77,.3);
  animation: recPulse 1.2s infinite;
}
@keyframes recPulse {
  0%,100% { box-shadow: 0 0 0 8px rgba(229,72,77,.22), 0 10px 28px rgba(229,72,77,.3); }
  50% { box-shadow: 0 0 0 22px rgba(229,72,77,.04), 0 10px 28px rgba(229,72,77,.3); }
}
#recordStatus { margin-top: var(--space-4); color: var(--text-secondary); font-size: .9rem; min-height: 1.2em; }

/* ---------- Processing view: rooftop-hopping runner ---------- */
.runner-stage {
  width: 100%; height: 190px; background: linear-gradient(180deg, #0B1D18 0%, #07120F 100%);
  border-radius: var(--radius-lg); position: relative; overflow: hidden; margin-bottom: var(--space-5);
  border: 1px solid var(--border-subtle); box-shadow: var(--shadow-glow);
}
.stars { position: absolute; inset: 0; background-image:
  radial-gradient(1px 1px at 10% 20%, rgba(242,251,249,.4), transparent),
  radial-gradient(1px 1px at 30% 15%, rgba(242,251,249,.28), transparent),
  radial-gradient(1px 1px at 55% 30%, rgba(242,251,249,.32), transparent),
  radial-gradient(1px 1px at 75% 12%, rgba(242,251,249,.24), transparent),
  radial-gradient(1px 1px at 90% 25%, rgba(242,251,249,.36), transparent);
}

/* 5 rooftops spread across full width, with visible sky gaps between them */
.skyline { position: absolute; bottom: 0; left: 0; right: 0; height: 100%; }
.building {
  position: absolute; bottom: 0; width: 15%;
  background: linear-gradient(180deg, #123028, #08160F);
  border-top: 3px solid var(--brand);
}
.building .windows {
  position: absolute; inset: 8px 6px; display: grid;
  grid-template-columns: repeat(2, 1fr); gap: 5px 6px; align-content: start;
}
.building .windows i {
  display: block; width: 100%; aspect-ratio: 1; border-radius: 1px;
  background: rgba(23,224,190,.08);
  animation: windowGlow 5.2s ease-in-out infinite;
}
/* Windows light up teal in sequence timed to the agent's hop arrival at each rooftop —
   the progress cue for the async transcribe+extract pipeline, pure CSS via staggered delay. */
@keyframes windowGlow {
  0%, 92%, 100% { background: rgba(23,224,190,.08); box-shadow: none; }
  4%, 12%       { background: var(--brand); box-shadow: 0 0 6px rgba(23,224,190,.7); }
}
.building.b1 .windows i { animation-delay: 0s; }
.building.b2 .windows i { animation-delay: 1.25s; }
.building.b3 .windows i { animation-delay: 2.5s; }
.building.b4 .windows i { animation-delay: 3.75s; }
.building.b5 .windows i { animation-delay: 4.99s; }

.building.b1 { left: 2%;  height: 62px; }
.building.b2 { left: 21%; height: 100px; }
.building.b3 { left: 40%; height: 78px; }
.building.b4 { left: 59%; height: 118px; }
.building.b5 { left: 78%; height: 90px; }

#agentSprite {
  position: absolute; width: 30px; height: 42px;
  animation: rooftopHop 5.2s var(--ease) infinite;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.4));
}
/* Jump arc across 5 rooftops, eased (not stepped) for a smoother hop than v1. */
@keyframes rooftopHop {
  0%,  16%  { left: 6%;  bottom: 62px;  transform: translateY(0) rotate(0deg); }
  8%        { left: 13%; bottom: 100px; transform: translateY(-20px) rotate(-4deg); }
  24%, 40%  { left: 25%; bottom: 100px; transform: translateY(0) rotate(0deg); }
  32%       { left: 33%; bottom: 90px;  transform: translateY(-20px) rotate(4deg); }
  48%, 64%  { left: 44%; bottom: 78px;  transform: translateY(0) rotate(0deg); }
  56%       { left: 52%; bottom: 98px;  transform: translateY(-20px) rotate(-4deg); }
  72%, 88%  { left: 63%; bottom: 118px; transform: translateY(0) rotate(0deg); }
  80%       { left: 71%; bottom: 104px; transform: translateY(-20px) rotate(4deg); }
  96%, 100% { left: 82%; bottom: 90px;  transform: translateY(0) rotate(0deg); }
}

.processing-text { font-weight: 700; font-size: .95rem; }
.processing-text .dots::after { content: ''; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75%,100% { content: '...'; } }

/* ---------- Review view ---------- */
.review-header { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); }
.review-header h2 { font-size: 1.05rem; margin: 0; font-weight: 800; }
.review-header .badge-ok { color: var(--success); font-size: .8rem; font-weight: 700; }

.field-card { width: 100%; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 4px var(--space-4); margin-bottom: var(--space-4); box-shadow: var(--shadow-card); }
.field-row { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3) 0; border-bottom: 1px solid rgba(255,255,255,.05); gap: var(--space-3); transition: background var(--duration-base) var(--ease); }
.field-row:last-child { border-bottom: none; }
.field-row .label { color: var(--text-secondary); font-size: .82rem; flex-shrink: 0; }
.field-row input {
  background: transparent; border: none; border-bottom: 1px solid transparent;
  color: var(--text-primary); font-family: inherit; font-size: .9rem; font-weight: 500; text-align: right; width: 100%;
  padding: 2px 0; transition: border-color var(--duration-fast) var(--ease);
}
.field-row input:focus { outline: none; border-bottom-color: var(--brand); }
.field-row.flagged .label::before { content: '⚠ '; color: var(--warning); }
.field-row.flagged input { color: var(--warning); }
.field-row.just-updated { background: var(--brand-soft); border-radius: var(--radius-sm); }

.btn-row { display: flex; gap: var(--space-3); width: 100%; }
.btn {
  flex: 1; padding: 14px; border-radius: var(--radius-md); border: none; font-family: inherit;
  font-weight: 700; font-size: .9rem; cursor: pointer; transition: all var(--duration-fast) var(--ease);
}
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:active { background: var(--brand-pressed); transform: scale(.98); }
.btn-ghost { background: transparent; border: 1.5px solid var(--border-strong); color: var(--text-primary); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger-ghost { background: transparent; border: 1.5px solid var(--danger-soft); color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn.recording { background: var(--danger); border-color: var(--danger); color: #fff; animation: recPulse 1.2s infinite; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.toast { margin-top: var(--space-4); color: var(--success); font-weight: 700; font-size: .85rem; text-align: center; min-height: 1.2em; }

/* ---------- Modifier (typed or voice correction) ---------- */
.refine-section { width: 100%; margin-top: var(--space-6); }
.refine-section .refine-label { font-size: .8rem; color: var(--text-secondary); font-weight: 700; margin-bottom: var(--space-2); }
.refine-row { display: flex; gap: var(--space-2); align-items: flex-start; }
.refine-row textarea {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  color: var(--text-primary); font-family: inherit; font-size: .85rem; padding: 10px 12px; resize: vertical; min-height: 56px;
  transition: border-color var(--duration-fast) var(--ease);
}
.refine-row textarea:focus { outline: none; border-color: var(--brand); }
#refineMicBtn {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--border-strong);
  background: transparent; color: var(--brand); font-size: 1.1rem; cursor: pointer; transition: all var(--duration-fast) var(--ease);
}
#refineMicBtn.recording { background: var(--danger); border-color: var(--danger); color: #fff; animation: recPulse 1.2s infinite; }
#refineMicBtn:disabled { opacity: .3; cursor: not-allowed; }
#refineSubmitBtn { width: 100%; margin-top: var(--space-2); padding: 10px; border-radius: var(--radius-md); border: none;
  background: var(--bg-raised); border: 1px solid var(--border-strong); color: var(--text-primary); font-family: inherit; font-weight: 700; font-size: .82rem; cursor: pointer; }
#refineSubmitBtn:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- Estimation result ---------- */
.estimate-result { margin-top: var(--space-3); background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: var(--space-4); text-align: center; }
.estimate-range { font-size: 1.2rem; font-weight: 900; color: var(--brand); }
.estimate-meta { font-size: .78rem; color: var(--text-secondary); margin-top: 4px; }
.estimate-geo { font-size: .74rem; color: var(--warning); margin-top: var(--space-2); }
.estimate-error { font-size: .82rem; color: var(--warning); }

/* ---------- Visits list view ---------- */
.visit-card {
  width: 100%; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  padding: var(--space-4); margin-bottom: var(--space-3); box-shadow: var(--shadow-card);
  transition: border-color var(--duration-fast) var(--ease);
}
.visit-card:hover { border-color: var(--border-strong); }
.visit-card .addr { font-weight: 700; font-size: .95rem; }
.visit-card .meta { color: var(--text-secondary); font-size: .78rem; margin-top: 4px; }
.visit-card .review-pill {
  display: inline-block; margin-top: var(--space-2); font-size: .7rem; font-weight: 700;
  background: rgba(245,158,11,.14); color: var(--warning); padding: 3px 8px; border-radius: var(--radius-sm);
}
.visit-card .match-pill {
  display: inline-block; margin-top: var(--space-2); margin-left: 6px; font-size: .7rem; font-weight: 700;
  background: var(--brand-soft); color: var(--brand); padding: 3px 8px; border-radius: var(--radius-sm);
}
.card-actions { display: flex; gap: var(--space-2); margin-top: var(--space-3); }
.card-estimate-btn { flex: 1; padding: 8px; font-size: .76rem; }
.card-delete-btn { width: 34px; flex-shrink: 0; padding: 8px 0; font-size: .85rem; }
.visit-card .estimate-result { margin-top: var(--space-2); padding: 10px 12px; }
.empty-state { text-align: center; color: var(--text-secondary); margin-top: 60px; }
.empty-state .big { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: var(--space-2); }
.empty-state .pixel-illustration { margin: 0 auto var(--space-4); opacity: .9; }

/* ---------- Skeleton loaders (Visites list) ---------- */
.skeleton-card {
  width: 100%; height: 76px; border-radius: var(--radius-lg); margin-bottom: var(--space-3);
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-raised) 37%, var(--bg-card) 63%);
  background-size: 400% 100%; animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- Roadmap-aware nav hints ("bientôt") ---------- */
.roadmap-section { width: 100%; margin-top: var(--space-8); }
.roadmap-section .roadmap-label { font-size: .78rem; color: var(--text-tertiary); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: var(--space-3); }
.roadmap-row {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: var(--bg-card); border: 1px dashed var(--border-subtle); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4); margin-bottom: var(--space-2); opacity: .7;
}
.roadmap-row .roadmap-name { font-size: .86rem; font-weight: 600; color: var(--text-secondary); }
.roadmap-row .roadmap-desc { font-size: .72rem; color: var(--text-tertiary); margin-top: 2px; }
.roadmap-row .soon-pill { font-size: .68rem; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 3px 8px; border-radius: var(--radius-pill); flex-shrink: 0; margin-left: var(--space-3); }

/* ---------- Consent / first-run overlay ---------- */
.consent-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(7,17,15,.92); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center; padding: var(--space-4);
  animation: fadeIn var(--duration-base) var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.consent-sheet {
  width: 100%; max-width: 480px; background: var(--bg-card); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: var(--space-6) var(--space-5) var(--space-8);
  box-shadow: var(--shadow-glow-strong); animation: sheetUp var(--duration-slow) var(--ease);
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.consent-sheet .shield { font-size: 1.6rem; margin-bottom: var(--space-3); }
.consent-sheet h2 { font-size: 1.1rem; margin: 0 0 var(--space-3); }
.consent-sheet p { font-size: .84rem; color: var(--text-secondary); line-height: 1.6; margin: 0 0 var(--space-2); }
.consent-sheet ul { margin: var(--space-2) 0 var(--space-4); padding-left: 18px; }
.consent-sheet li { font-size: .82rem; color: var(--text-secondary); line-height: 1.6; }
.consent-sheet a { color: var(--brand); text-decoration: none; }
.consent-sheet a:hover { text-decoration: underline; }

/* ---------- Confidentialité settings view ---------- */
.settings-section { width: 100%; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: var(--space-4); margin-bottom: var(--space-4); }
.settings-section h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary); margin: 0 0 var(--space-3); }
.settings-row { display: flex; justify-content: space-between; align-items: center; padding: var(--space-2) 0; font-size: .88rem; }
.settings-row .settings-value { color: var(--text-secondary); font-size: .82rem; }
.settings-row .settings-value.ok { color: var(--success); }
.settings-note { font-size: .78rem; color: var(--text-secondary); line-height: 1.5; margin-top: var(--space-2); }

/* ---------- Acquéreurs correspondants panel ---------- */
.buyers-panel { width: 100%; }
.buyer-card {
  width: 100%; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4); margin-bottom: var(--space-2); display: flex; justify-content: space-between; align-items: center;
}
.buyer-card .buyer-name { font-weight: 700; font-size: .88rem; }
.buyer-card .buyer-criteria { color: var(--text-secondary); font-size: .76rem; margin-top: 2px; }
.buyer-card .match-score { font-size: .78rem; font-weight: 800; color: var(--brand); background: var(--brand-soft); padding: 4px 10px; border-radius: var(--radius-pill); flex-shrink: 0; margin-left: var(--space-3); }
