/* ============================================================
   Tablō Auth — card widget (v6 — 31 mai 2026)
   Pages : compte.html, connexion.html, inscription.html,
           inscription-entreprise.html, mot-de-passe-oublie.html,
           reinitialiser-mot-de-passe.html
   ============================================================ */

:root {
  --bg: #ebe3d5;             /* sable Tablo */
  --ink: #1d1812;             /* texte principal */
  --ink-mid: #2e2f31;         /* boutons secondaires + bordures */
  --orange-active: #ea7634;
  --frame-bg: #f7f6f4;        /* intérieur tableau */
  --field-bg: #cdc7be;
  --field-bg-focus: #e3ddd2;
  --siret-bg: #ffffff;
  --siret-border: #cdc7be;
  --muted: #6c6c6c;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Sora', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Page wrapper ---------- */
.auth-page {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---------- Logo + back ---------- */
.auth-logo {
  position: absolute;
  top: 36px;
  left: 56px;
  font-size: 44px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  z-index: 20;
  letter-spacing: -0.5px;
  transition: color 0.15s ease;
}
.auth-logo:hover { color: var(--orange-active); }
.auth-back {
  position: absolute;
  top: 44px;
  right: 56px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  z-index: 20;
  transition: color 0.15s ease;
}
.auth-back:hover { color: var(--ink); }

@media (max-width: 720px) {
  .auth-logo { top: 22px; left: 24px; font-size: 36px; }
  .auth-back { top: 30px; right: 24px; }
}

/* ---------- Stage ---------- */
.auth-stage {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px 64px;
  z-index: 1;
}

/* Art band + strings désactivés */
.auth-art-band,
.auth-strings { display: none; }

/* ---------- Widget simplifié au-dessus du card ---------- */
.auth-widget {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
.auth-widget-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--orange-active);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(234, 118, 52, 0.28);
}
.auth-widget-icon svg {
  width: 26px;
  height: 26px;
  stroke: #fff;
  fill: none;
}

/* ---------- Frame wrapper ---------- */
.auth-frame-wrap {
  position: relative;
  z-index: 2;
  width: min(520px, 92vw);
}

/* ---------- Card widget ---------- */
.auth-frame {
  position: relative;
  z-index: 2;
  background: var(--frame-bg);
  border: 1.5px solid rgba(29, 24, 18, 0.10);
  border-radius: 20px;
  padding: 44px 48px 40px;
  box-shadow:
    0 2px 8px rgba(20, 15, 8, 0.06),
    0 8px 32px rgba(20, 15, 8, 0.09);
}

@media (max-width: 720px) {
  .auth-frame { padding: 32px 24px 28px; }
}

/* ---------- Titles (centrés) ---------- */
.auth-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.1;
  text-align: center;
}
.auth-subtitle {
  font-size: 14px;
  color: var(--ink);
  margin: 0 0 28px;
  line-height: 1.45;
  font-weight: 400;
  text-align: center;
  opacity: 0.85;
}

@media (max-width: 720px) {
  .auth-title { font-size: 24px; }
  .auth-subtitle { font-size: 13px; margin-bottom: 22px; }
}

/* ---------- Form layout ---------- */
.auth-form { display: block; }

.auth-row {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}
.auth-row .auth-field { flex: 1; min-width: 0; margin-bottom: 0; }
@media (max-width: 480px) {
  .auth-row { flex-direction: column; gap: 14px; }
}

.auth-field {
  display: block;
  margin-bottom: 18px;
}
.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--orange-active);
  margin-bottom: 6px;
}
.auth-field input,
.auth-field select {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  background: var(--field-bg);
  border: none;
  border-radius: 999px;
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.auth-field input:focus,
.auth-field select:focus {
  background: var(--field-bg-focus);
  box-shadow: 0 0 0 2px rgba(234, 118, 52, 0.3);
}
.auth-field select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%231d1812' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

/* Password field + eye toggle */
.auth-pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-pw-wrap input { flex: 1; min-width: 0; padding-right: 48px; }
.auth-eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  transition: color 0.15s ease;
}
.auth-eye:hover { color: var(--ink); }
.auth-eye svg { width: 18px; height: 18px; }

/* Strength indicator */
.auth-strength {
  display: none;
  margin: 8px 0 0;
}
.auth-strength.is-visible { display: block; }
.auth-strength-bar {
  height: 4px;
  background: var(--field-bg);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 5px;
}
.auth-strength-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  width: 0%;
  transition: width 0.25s ease, background 0.25s ease;
}
.auth-strength-label {
  font-size: 12px;
  font-weight: 600;
}
.auth-strength[data-level="weak"]   .auth-strength-fill  { width: 33%; background: #c93c1f; }
.auth-strength[data-level="weak"]   .auth-strength-label { color: #c93c1f; }
.auth-strength[data-level="ok"]     .auth-strength-fill  { width: 66%; background: var(--orange-active); }
.auth-strength[data-level="ok"]     .auth-strength-label { color: var(--orange-active); }
.auth-strength[data-level="strong"] .auth-strength-fill  { width: 100%; background: #2a7d3f; }
.auth-strength[data-level="strong"] .auth-strength-label { color: #2a7d3f; }

.auth-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
}

/* ---------- Checkbox CGU ---------- */
.auth-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 24px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
}
.auth-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--field-bg);
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  margin: 1px 0 0;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.auth-checkbox input[type="checkbox"]:checked {
  background: var(--orange-active);
  border-color: var(--orange-active);
}
.auth-checkbox input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 13px 13px;
}
.auth-checkbox a {
  color: var(--orange-active);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- CTA button ---------- */
.auth-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  padding: 0 24px;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--ink-mid);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.auth-cta:hover {
  background: var(--orange-active);
  color: #fff;
  border-color: var(--orange-active);
  box-shadow: 0 14px 26px rgba(234, 118, 52, 0.32);
}
.auth-cta:active { transform: translateY(1px); }
.auth-cta:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #fff;
  color: var(--ink);
  border-color: var(--ink-mid);
  box-shadow: none;
}

.auth-cta--secondary {
  background: transparent;
  border-color: var(--ink-mid);
  color: var(--ink);
}
.auth-cta--secondary:hover {
  background: var(--ink-mid);
  color: #fff;
  box-shadow: 0 12px 22px rgba(46, 47, 49, 0.28);
  border-color: var(--ink-mid);
}

/* ---------- Choices block (compte.html) ---------- */
.auth-choices {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 12px;
}

/* ⭐ TOUS LES TEXTES SECONDAIRES SOUS LES BOUTONS EN ORANGE ⭐ */
.auth-cta-sub {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--orange-active);
  margin-top: 8px;
  font-weight: 500;
}

.auth-forgot {
  display: block;
  font-size: 13px;
  color: var(--orange-active);
  text-decoration: none;
  text-align: right;
  margin: -6px 0 18px;
  font-weight: 500;
}
.auth-forgot:hover { text-decoration: underline; }

.auth-link-bottom {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--orange-active);
  margin-top: 18px;
  text-decoration: none;
  font-weight: 500;
}
.auth-link-bottom span {
  color: var(--orange-active);
  font-weight: 700;
}
.auth-link-bottom:hover { text-decoration: underline; }

.auth-out-link {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--orange-active);
  text-decoration: none;
  margin: 18px auto 0;
  font-weight: 500;
  position: relative;
  z-index: 10;
}
.auth-out-link:hover { text-decoration: underline; }

/* ---------- SIRET block (inscription-entreprise) ---------- */
.auth-siret-block {
  margin: 14px 0 22px;
  padding: 16px 16px 14px;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  position: relative;
}
.auth-siret-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  text-align: center;
}
.auth-siret-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-siret-label {
  display: block;
  font-size: 12px;
  color: var(--orange-active);
  font-weight: 500;
}
.auth-siret-input {
  width: 100%;
  max-width: 320px;
  height: 38px;
  padding: 0 14px;
  background: var(--siret-bg);
  border: 1.5px solid var(--siret-border);
  border-radius: 6px;
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  letter-spacing: 0.5px;
}
.auth-siret-input:focus { border-color: var(--orange-active); }

.auth-siret-arrow {
  position: absolute;
  right: 8px;
  top: -10px;
  width: 88px;
  height: 72px;
  pointer-events: none;
}

.auth-siret-promise {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--orange-active);
  line-height: 1.4;
  font-weight: 500;
  text-align: center;
}

@media (max-width: 720px) {
  .auth-cta { height: 48px; font-size: 15px; }
  .auth-field input, .auth-field select { height: 42px; }
}

/* ============ Messages d'erreur / succès / loading (ajout 2026-05-25 wiring backend) ============ */
.auth-msg {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  display: none;
}
.auth-msg.is-visible { display: block; }
.auth-msg--error {
  background: #fde6e2;
  color: #8a2412;
  border: 1px solid #f5b8ad;
}
.auth-msg--success {
  background: #e2f4e5;
  color: #145025;
  border: 1px solid #b6dbc0;
}
.auth-msg--info {
  background: #fdf0e2;
  color: #6f3a10;
  border: 1px solid #f1cfa6;
}
.auth-field-error {
  display: none;
  font-size: 12px;
  color: #c93c1f;
  margin-top: 6px;
  font-weight: 500;
}
.auth-field-error.is-visible { display: block; }
.auth-field input[aria-invalid="true"],
.auth-field select[aria-invalid="true"] {
  border-color: #c93c1f;
  box-shadow: 0 0 0 1px #c93c1f inset;
}
.auth-cta[disabled] { opacity: 0.6; cursor: not-allowed; }
.auth-cta.is-loading { position: relative; }
.auth-cta.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 18px;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
