/* ===================================================================
 * Écran de connexion du backoffice (src/views/login.php).
 * Feuille autonome : n'hérite pas d'app.css (thème sombre dense du MDI).
 * Thème clair et sombre selon le système, contrastes AA, cibles ≥ 44 px,
 * orange RiLoPOS réservé à l'action principale et aux liens.
 * =================================================================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
  color-scheme: light dark;
  --bg:        #FFFFFF;
  --bg-soft:   #F6F6F7;
  --text:      #18181B;
  --muted:     #52525B;
  --faint:     #71717A;
  --line:      #E4E4E7;
  --line-hi:   #A1A1AA;
  --input:     #FFFFFF;
  --accent:    #C2410C;   /* 5,2:1 sur blanc */
  --accent-hi: #9A3412;
  --on-accent: #FFFFFF;
  --link:      #C2410C;
  --ring:      rgba(234, 88, 12, .28);
  --danger-bg: #FEF2F2;
  --danger-bd: #FECACA;
  --danger:    #B91C1C;
  --warn:      #A16207;

  --panel:     #141416;
  --panel-2:   #1C1C1F;
  --panel-tx:  #F4F4F5;
  --panel-mu:  #A1A1AA;
  --orange:    #F97316;

  --r:   10px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0E0E10;
    --bg-soft:   #17171A;
    --text:      #F4F4F5;
    --muted:     #A1A1AA;
    --faint:     #8B8B94;
    --line:      #27272A;
    --line-hi:   #52525B;
    --input:     #141417;
    --accent:    #F97316;
    --accent-hi: #FB923C;
    --on-accent: #1C0A00;  /* 8:1 sur l'orange */
    --link:      #FB923C;
    --ring:      rgba(249, 115, 22, .32);
    --danger-bg: rgba(239, 68, 68, .10);
    --danger-bd: rgba(239, 68, 68, .35);
    --danger:    #FCA5A5;
    --warn:      #FACC15;
    --panel:     #141416;
    --panel-2:   #1A1A1D;
  }
}

html, body { margin: 0; min-height: 100%; }
body.lp {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  font-size: 15px; line-height: 1.5;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Mise en page : formulaire | panneau ───────────────────────────── */
.lp-shell {
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 960px) {
  .lp-shell { grid-template-columns: minmax(480px, 5fr) minmax(0, 6fr); }
}

.lp-main {
  display: flex; flex-direction: column;
  padding: 24px 24px 20px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}
@media (min-width: 600px) { .lp-main { padding: 32px 48px 24px; } }

.lp-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lp-brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none;
  font-size: 15px; font-weight: 600; letter-spacing: -.01em;
}
.lp-brand img { display: block; border-radius: 8px; }
.lp-brand b { font-weight: 600; color: var(--muted); }

.lp-langs { display: flex; gap: 2px; }
.lp-langs a {
  min-width: 40px; height: 32px; padding: 0 8px;
  display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 600; letter-spacing: .04em;
  color: var(--faint); text-decoration: none; border-radius: 8px;
  transition: color .15s, background-color .15s;
}
.lp-langs a:hover { color: var(--text); background: var(--bg-soft); }
.lp-langs a[aria-current="true"] { color: var(--text); background: var(--bg-soft); }

.lp-center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 0; }

/* ── Formulaire ───────────────────────────────────────────────────── */
.lp-form { width: 100%; max-width: 380px; animation: lpIn .32s var(--ease) both; }
@keyframes lpIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.lp-form h1 { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -.025em; }
.lp-sub { margin: 8px 0 32px; color: var(--muted); font-size: 15px; }

.lp-alert {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 0 0 24px; padding: 12px 14px;
  background: var(--danger-bg); border: 1px solid var(--danger-bd); border-radius: var(--r);
  color: var(--danger); font-size: 14px; line-height: 1.45;
}
.lp-alert svg { flex: none; margin-top: 1px; }

.lp-field { margin-bottom: 20px; }
.lp-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.lp-field label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500; color: var(--text); }

.lp-input {
  width: 100%; height: 46px; padding: 0 14px;
  font: inherit; font-size: 16px; color: var(--text);
  background: var(--input);
  border: 1px solid var(--line); border-radius: var(--r);
  outline: none; appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
.lp-input::placeholder { color: var(--faint); opacity: 1; }
.lp-input:hover { border-color: var(--line-hi); }
.lp-input:focus-visible, .lp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.lp-input:-webkit-autofill { -webkit-text-fill-color: var(--text); box-shadow: 0 0 0 1000px var(--input) inset; caret-color: var(--text); }
.lp-input:-webkit-autofill:focus { box-shadow: 0 0 0 1000px var(--input) inset, 0 0 0 4px var(--ring); }
@media (min-width: 600px) { .lp-input { font-size: 15px; } }

.lp-pw { position: relative; }
.lp-pw .lp-input { padding-right: 52px; }
.lp-eye {
  position: absolute; top: 3px; right: 3px;
  width: 40px; height: 40px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 8px; padding: 0;
  color: var(--faint); cursor: pointer;
  transition: color .15s, background-color .15s;
}
.lp-eye:hover { color: var(--text); background: var(--bg-soft); }
.lp-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lp-eye .i-off { display: none; }
.lp-eye[aria-pressed="true"] .i-on { display: none; }
.lp-eye[aria-pressed="true"] .i-off { display: block; }

.lp-caps { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 13px; color: var(--warn); }
.lp-caps[hidden] { display: none; }

.lp-link {
  color: var(--link); font-size: 14px; font-weight: 500;
  text-decoration: none; border-radius: 4px;
}
.lp-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.lp-link:focus-visible, .lp-brand:focus-visible, .lp-langs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.lp-check {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px; margin: -4px 0 16px;
  font-size: 14px; color: var(--muted); cursor: pointer; user-select: none;
}
.lp-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }

.lp-submit {
  position: relative; width: 100%; height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-size: 15px; font-weight: 600; letter-spacing: -.005em;
  color: var(--on-accent); background: var(--accent);
  border: 0; border-radius: var(--r); cursor: pointer;
  transition: background-color .15s, transform .1s;
}
.lp-submit:hover { background: var(--accent-hi); }
.lp-submit:active { transform: scale(.985); }
.lp-submit:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
.lp-submit[aria-busy="true"] { cursor: progress; }
.lp-spin {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: lpSpin .7s linear infinite;
}
.lp-submit[aria-busy="true"] .lp-spin { display: block; }
@keyframes lpSpin { to { transform: rotate(360deg); } }

.lp-alt { margin: 24px 0 0; text-align: center; font-size: 14px; color: var(--muted); }

/* Pied légal (src/views/_legal_footer.php) */
.lp-foot .legal-foot {
  padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12px; line-height: 1.6; color: var(--faint); text-align: center;
}
.lp-foot .legal-foot-id { display: block; }
.lp-foot .legal-foot-links { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 2px; }
.lp-foot .legal-foot-links a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.lp-foot .legal-foot-links a:hover { color: var(--text); }

/* ── Panneau de marque (≥ 960 px) ─────────────────────────────────── */
.lp-panel { display: none; }
@media (min-width: 960px) {
  .lp-panel {
    display: flex; flex-direction: column; justify-content: space-between;
    position: relative; overflow: hidden;
    margin: 12px; border-radius: 20px;
    padding: 56px 56px 40px;
    background: var(--panel); color: var(--panel-tx);
  }
}
.lp-art { position: absolute; right: -56px; bottom: -56px; width: min(44%, 400px); height: auto; pointer-events: none; }
.lp-panel-inner { position: relative; max-width: 460px; }
.lp-eyebrow {
  margin: 0 0 16px; font-size: 13px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--orange);
}
.lp-panel h2 { margin: 0 0 40px; font-size: 40px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; }
.lp-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 24px; }
.lp-points li { display: grid; grid-template-columns: 24px 1fr; gap: 14px; align-items: start; }
.lp-points svg { margin-top: 1px; color: var(--orange); }
.lp-points strong { display: block; font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.lp-points span { display: block; font-size: 15px; color: var(--panel-mu); line-height: 1.5; }
.lp-panel-foot { position: relative; font-size: 13px; color: var(--panel-mu); }

@media (prefers-reduced-motion: reduce) {
  .lp-form { animation: none; }
  .lp-submit, .lp-input, .lp-eye, .lp-langs a { transition: none; }
  .lp-submit:active { transform: none; }
  .lp-spin { animation-duration: 1.6s; }
}

/* Petits écrans : la marque tient sur une ligne. */
.lp-brand span { white-space: nowrap; }
@media (max-width: 420px) {
  .lp-brand b { display: none; }
  .lp-langs a { min-width: 36px; padding: 0 6px; }
}
/* Sombre : le panneau se détache du fond par un filet. */
@media (prefers-color-scheme: dark) {
  .lp-panel { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); }
}

/* ── Avertissement de panne de l'API (assets/outage.js) ─────────────── */
.lp-outage {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg); color: var(--text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .28), 0 2px 8px rgba(0, 0, 0, .12);
  overflow: auto;
}
.lp-outage[open] { animation: lpIn .24s var(--ease) both; }
.lp-outage::backdrop { background: rgba(9, 9, 11, .48); }
.lp-ow-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 8px 12px 20px; border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.lp-ow-bar h2 { flex: 1; margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.lp-ow-degraded .lp-ow-bar > svg { color: var(--warn); }
.lp-ow-major .lp-ow-bar > svg { color: var(--danger); }
.lp-ow-major .lp-ow-bar { box-shadow: inset 3px 0 0 var(--danger); }
.lp-ow-degraded .lp-ow-bar { box-shadow: inset 3px 0 0 var(--warn); }
/* Maintenance (en cours ou prévue) : une information, pas une alerte. */
.lp-ow-maintenance .lp-ow-bar > svg, .lp-ow-maintenance_planned .lp-ow-bar > svg { color: var(--text); }
.lp-ow-maintenance .lp-ow-bar, .lp-ow-maintenance_planned .lp-ow-bar { box-shadow: inset 3px 0 0 var(--line-hi); }
.lp-ow-x {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--faint); cursor: pointer;
}
.lp-ow-x:hover { color: var(--text); background: var(--line); }
.lp-ow-x:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lp-ow-body { padding: 20px 20px 4px; font-size: 15px; line-height: 1.55; }
.lp-ow-body p { margin: 0 0 12px; color: var(--muted); }
.lp-ow-body .lp-ow-lead { color: var(--text); font-weight: 600; font-size: 16px; }
.lp-ow-pos {
  display: grid; grid-template-columns: 18px 1fr; gap: 10px; align-items: start;
  padding: 12px 14px; border-radius: var(--r);
  background: var(--bg-soft); border: 1px solid var(--line);
}
.lp-ow-body .lp-ow-pos { color: var(--text); }
.lp-ow-pos svg { margin-top: 2px; color: #16A34A; }
.lp-ow-end { font-size: 14px; }
.lp-ow-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px 20px;
}
.lp-ow-ok {
  margin-left: auto; min-width: 120px; height: 44px; padding: 0 20px;
  font: inherit; font-size: 15px; font-weight: 600;
  color: var(--on-accent); background: var(--accent);
  border: 0; border-radius: var(--r); cursor: pointer;
  transition: background-color .15s;
}
.lp-ow-ok:hover { background: var(--accent-hi); }
.lp-ow-ok:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--ring); }
@media (prefers-color-scheme: dark) {
  .lp-outage { box-shadow: 0 24px 64px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(255, 255, 255, .04); }
  .lp-ow-pos svg { color: #4ADE80; }
}
@media (prefers-reduced-motion: reduce) {
  .lp-outage[open] { animation: none; }
  .lp-ow-ok { transition: none; }
}
