/* ╔══════════════════════════════════════════════════════════════╗
   ║  SAFE IMMO PWA — Design System (style Yango)               ║
   ║  Mode clair/sombre · couleurs de marque · mobile-first     ║
   ╚══════════════════════════════════════════════════════════════╝ */

:root {
  /* Couleurs de marque */
  --brand: #1800ad;
  --brand-dark: #12008a;
  --brand-light: #f0eeff;
  /* Mode CLAIR (défaut) */
  --bg: #ffffff;
  --bg-soft: #f4f4f8;
  --card: #ffffff;
  --card-border: #ebebf5;
  --text: #111114;
  --text-soft: #6a6a7a;
  --text-mute: #a0a0b0;
  --input-bg: #f8f8fc;
  --input-border: #e0e0ef;
  --shadow: 0 2px 16px rgba(0,0,0,.06);
  --nav-bg: #ffffff;
  --nav-border: #eeeef4;
}

[data-theme="dark"] {
  --bg: #0e0e16;
  --bg-soft: #16161f;
  --card: #1a1a24;
  --card-border: #2a2a38;
  --text: #f2f2f7;
  --text-soft: #a0a0b5;
  --text-mute: #6a6a7f;
  --input-bg: #22222e;
  --input-border: #33333f;
  --shadow: 0 2px 16px rgba(0,0,0,.4);
  --nav-bg: #14141c;
  --nav-border: #26262f;
  --brand-light: #241a4d;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .25s, color .25s;
}

/* App container : occupe TOUTE la hauteur (fix espace vide) */
.app {
  min-height: 100dvh;              /* dvh = hauteur réelle mobile, corrige l'espace vide */
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

/* Zone de contenu qui pousse la nav en bas */
.app-body { flex: 1 1 auto; display: flex; flex-direction: column; }

/* ── En-tête ── */
.app-top {
  padding: calc(env(safe-area-inset-top) + 16px) 20px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.app-logo { display: flex; align-items: center; gap: 10px; }
.app-logo img { height: 32px; width: auto; display: block; }
.app-logo-txt { font-size: 19px; font-weight: 800; letter-spacing: -.3px; color: var(--text); }
.app-logo-txt span { color: var(--brand); }

/* Bouton thème */
.theme-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--card-border);
  background: var(--card); color: var(--text); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ── Titres ── */
.h1 { font-size: 26px; font-weight: 800; line-height: 1.2; letter-spacing: -.5px; }
.h2 { font-size: 18px; font-weight: 700; }
.muted { color: var(--text-soft); font-size: 14px; line-height: 1.6; }

/* ── Champs ── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 14px 16px; border: 1.5px solid var(--input-border); border-radius: 14px;
  font-size: 16px; background: var(--input-bg); color: var(--text); outline: none; transition: .15s;
  font-family: inherit;
}
.field input:focus { border-color: var(--brand); }
.field input::placeholder { color: var(--text-mute); }

/* ── Boutons ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px; border: none; border-radius: 14px;
  font-size: 16px; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: transform .1s, opacity .15s; font-family: inherit;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-soft { background: var(--brand-light); color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Cartes ── */
.card {
  background: var(--card); border: 1.5px solid var(--card-border); border-radius: 18px;
  padding: 18px; box-shadow: var(--shadow);
}

/* ── Barre de navigation du bas (style app) ── */
.tabbar {
  position: sticky; bottom: 0; z-index: 100;
  display: flex; background: var(--nav-bg); border-top: 1.5px solid var(--nav-border);
  padding: 8px 0 calc(env(safe-area-inset-bottom) + 8px);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  text-decoration: none; color: var(--text-mute); font-size: 11px; font-weight: 600;
  padding: 4px 0; transition: color .15s;
}
.tab.active { color: var(--brand); }
.tab-ic { font-size: 22px; line-height: 1; }

/* ── Alertes ── */
.alert { padding: 12px 16px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; }
.alert-err { background: #fff0f0; color: #c0392b; }
.alert-ok { background: #e6f9f0; color: #0a7a56; }
[data-theme="dark"] .alert-err { background: #3a1a1a; color: #ff8080; }
[data-theme="dark"] .alert-ok { background: #163020; color: #4ade80; }

/* ── OTP inputs ── */
.otp-row { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }
.otp-row input {
  width: 48px; height: 56px; text-align: center; font-size: 24px; font-weight: 700;
  border: 1.5px solid var(--input-border); border-radius: 12px; background: var(--input-bg); color: var(--text);
}
.otp-row input:focus { border-color: var(--brand); outline: none; }

/* Utilitaires */
.pad { padding: 20px; }
.center { text-align: center; }
.mt-auto { margin-top: auto; }
.link { color: var(--brand); text-decoration: none; font-weight: 600; }
.stack > * + * { margin-top: 12px; }
