/* ============================================================
   AlertIA-Tenders — Base styles
   Charte éditoriale : fonds chauds, encre profonde, brand bleu OKLCH.
   Newsreader (display) + Inter (UI) + JetBrains Mono (chiffres).
   ============================================================ */

:root {
  /* ── Fonds chauds très subtils ───────────────────────────── */
  --bg:        #F7F6F2;
  --bg-elev:   #FBFAF6;
  --surface:   #FFFFFF;
  --surface-2: #F2F1EC;

  /* ── Encre ──────────────────────────────────────────────── */
  --ink:    #16202B;
  --ink-2:  #3D4A57;
  --ink-3:  #6A7785;
  --ink-4:  #98A2AF;
  --line:   #E6E3DA;
  --line-2: #EDEAE1;

  /* ── Brand — bleu éditorial confiance ───────────────────── */
  --brand:      oklch(0.46 0.14 245);
  --brand-deep: oklch(0.34 0.12 248);
  --brand-soft: oklch(0.95 0.03 245);
  --brand-tint: oklch(0.98 0.015 245);

  /* ── Sources ─────────────────────────────────────────────── */
  --src-ted: oklch(0.50 0.13 250);   --src-ted-bg:   oklch(0.96 0.025 250);
  --src-boamp: oklch(0.46 0.16 305); --src-boamp-bg: oklch(0.96 0.03 305);
  --src-place: oklch(0.50 0.10 200); --src-place-bg: oklch(0.96 0.025 200);
  --src-eu: oklch(0.55 0.13 70);     --src-eu-bg:    oklch(0.96 0.04 80);

  /* ── Pertinence / urgence ────────────────────────────────── */
  --ok:   oklch(0.52 0.13 155);  --ok-bg:   oklch(0.95 0.04 155);
  --warn: oklch(0.65 0.14 75);   --warn-bg: oklch(0.96 0.05 80);
  --hot:  oklch(0.58 0.18 25);   --hot-bg:  oklch(0.96 0.04 30);
  --info: oklch(0.55 0.10 240);  --info-bg: oklch(0.96 0.025 240);

  /* ── Forme ───────────────────────────────────────────────── */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --sh-1: 0 1px 0 rgba(22,32,43,0.04), 0 1px 2px rgba(22,32,43,0.04);
  --sh-2: 0 1px 0 rgba(22,32,43,0.04), 0 4px 14px -6px rgba(22,32,43,0.08);

  /* ── Typo ────────────────────────────────────────────────── */
  --display: "Newsreader", "Georgia", "Times New Roman", serif;
  --ui:      "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:    "JetBrains Mono", "Menlo", "Consolas", monospace;

  /* ── Alias rétro-compatibles (auth/landing/admin héritent) ── */
  --bg-card:       var(--surface);
  --line-strong:   var(--ink-4);
  --fg:            var(--ink);
  --fg-dim:        var(--ink-2);
  --fg-faint:      var(--ink-3);
  --primary:       var(--brand);
  --primary-deep:  var(--brand-deep);
  --primary-bright: oklch(0.66 0.13 245);
  --success:       var(--ok);
  --error:         var(--hot);
  --sans:          var(--ui);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-weight: 400;
  font-feature-settings: "ss01", "cv11";
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Empêche le scroll horizontal du viewport (halos de dots, tooltips,
     titres longs) sans casser le rendu visuel. `clip` n'introduit pas
     de scroll-container et préserve les position:sticky éventuels. */
  overflow-x: hidden;
  
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { max-width: 1280px; margin: 0 auto; padding: 0 28px; }

/* ─────────── NAV / TOPBAR ─────────── */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.logo em {
  color: var(--brand);
  font-style: italic;
  font-weight: 500;
}
.logo-tag {
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.nav-cta {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Pastille utilisateur (avatar + email) dans la topbar. */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.user-chip__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ─────────── BUTTONS ─────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
  box-shadow: var(--sh-1);
}
.btn:hover {
  border-color: var(--ink-4);
  color: var(--ink);
  text-decoration: none;
}
.btn .icon { width: 14px; height: 14px; }

/* Ghost button : pas de border, pour "Déconnexion" et actions tertiaires. */
.btn-ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--ink-3);
}
.btn-ghost:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
  font-weight: 500;
}
.btn-primary:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
  color: #ffffff;
}
.btn[disabled], .btn-primary[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ─────────── ICONS (SVG inline lucide-style) ─────────── */
.icon {
  display: inline-block;
  vertical-align: -0.125em;
  flex-shrink: 0;
}
.icon--missing { width: 14px; height: 14px; }

/* ─────────── AUTH CARDS (login / register / reset) ─────────── */
.auth-wrap {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 40px 36px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.auth-card h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  color: var(--fg);
}
.auth-card .sub {
  color: var(--fg-dim);
  font-size: 14px;
  margin-bottom: 24px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-dim);
  margin-bottom: 6px;
}
.field input[type="email"],
.field input[type="password"],
.field input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font-size: 15px;
  font-family: inherit;
  color: var(--fg);
  background: var(--bg-card);
}
.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}
.field .hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--fg-faint);
}
.field--collapsible[aria-hidden="true"] { display: none; }

.password-wrap { position: relative; }
.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 4px;
  color: var(--fg-faint);
}
.password-toggle svg { width: 18px; height: 18px; }

.forgot-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--fg-dim);
}

.btn-primary[type="submit"] {
  width: 100%;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 8px;
}

.foot {
  margin-top: 20px;
  font-size: 14px;
  text-align: center;
  color: var(--fg-dim);
}
.foot a { font-weight: 500; }

.error, .success {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}
.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

[data-state="signin"] [data-only="forgot"] { display: none; }
[data-state="forgot"] [data-only="signin"] { display: none; }

/* ─────────── LANDING ─────────── */
.hero {
  padding: 80px 24px 60px;
  text-align: center;
  max-width: 820px;
  margin: 0 auto;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 48px;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 20px;
  color: var(--fg);
}
.hero h1 em {
  color: var(--primary);
  font-style: italic;
}
.hero p {
  font-size: 18px;
  color: var(--fg-dim);
  margin-bottom: 32px;
  line-height: 1.6;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-cta .btn-primary { padding: 12px 28px; font-size: 15px; }

/* ─────────── DASHBOARD PLACEHOLDER (Phase 1 — real SPA in Phase 6) ─────────── */
.dash-shell {
  padding: 40px 24px;
  max-width: 1200px;
  margin: 0 auto;
}
.dash-shell h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 32px;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.dash-shell .sub {
  color: var(--fg-dim);
  font-size: 15px;
  margin-bottom: 32px;
}
.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
}
.dash-card h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 18px;
  margin-bottom: 12px;
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: #e0f2fe;
  color: var(--primary-deep);
}
.badge-warn { background: #fef3c7; color: #92400e; }

@media (max-width: 640px) {
  .hero h1 { font-size: 36px; }
  .auth-card { padding: 28px 24px; }
  nav { padding: 14px 16px; }
}

/* ─────────── MOBILE OVERRIDES (CEO usage smartphone) ─────────── */
/* Référence breakpoints : --bp-sm 480, --bp-md 768, --bp-lg 1024.
   Les anciennes règles @640/@700/@900 restent en place pour le legacy ;
   les nouveaux ajouts mobile-friendly suivent les 3 paliers ci-dessus. */

/* Utilitaire de masquage mobile. */
@media (max-width: 480px) {
  .hide-on-mobile { display: none !important; }
}

/* Hit-targets tactiles (WCAG 2.2 — Target Size minimum 44×44).
   Conditionné à `hover: none` + `pointer: coarse` pour cibler les vrais
   périphériques tactiles (iPhone/iPad/Android) sans gonfler les boutons
   sur écran souris/devtools. */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .btn-primary {
    min-height: 44px;
    padding: 12px 18px;
  }
  .password-toggle {
    padding: 12px;
  }
  .password-toggle svg {
    width: 22px;
    height: 22px;
  }
  .field input[type="email"],
  .field input[type="password"],
  .field input[type="text"] {
    min-height: 44px;
    padding: 12px 14px;
    font-size: 16px;          /* empêche le zoom automatique sur iOS Safari */
  }
}

/* Nav mobile compacte : wrap des CTAs, padding réduit, logo tag + user-chip masqués. */
@media (max-width: 768px) {
  nav { padding: 14px 18px; }
  .user-chip { display: none; }
}

@media (max-width: 480px) {
  nav {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
  }
  .nav-cta {
    flex-wrap: wrap;
    gap: 6px;
  }
  .nav-cta .btn { padding: 8px 12px; font-size: 12.5px; }
  .logo { font-size: 18px; }
  .logo-tag { display: none; }
}
