/* ==================================================================
   Auth pages (Log_in.php, forgot-password.php)
   ------------------------------------------------------------------
   Tokens mirror the .spos-* palette in header.html so these pages
   look like the app the user lands in afterwards. Dark mode follows
   the same data-bs-theme attribute the Phoenix theme uses.
   ================================================================== */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e6e9ef;
  --text: #2f3646;
  --text-strong: #1f2533;
  --muted: #7d879c;
  --accent: #3874ff;
  --accent-d: #2a5fd9;
  --accent-soft: #eaf1ff;
  --accent-border: #c3d8ff;
  --danger: #d9321a;
  --danger-bg: #ffe6e1;
  --danger-border: #ffc8be;
  --success: #1e8f02;
  --success-bg: #e3f5df;
  --success-border: #b9e6b0;
  --warning: #b35d05;
  --warning-bg: #fff3e0;
  --warning-border: #f5d9a8;
  --brand-a: #3874ff;
  --brand-b: #1d47c4;
  --shadow: 0 1px 2px rgba(24, 32, 51, .04), 0 8px 24px rgba(24, 32, 51, .06);
  --shadow-lg: 0 12px 40px rgba(24, 32, 51, .12);
  --radius: 10px;
  --radius-lg: 18px;
  --ring: 0 0 0 4px rgba(56, 116, 255, .18);
}
[data-bs-theme="dark"] {
  --bg: #0f1220;
  --surface: #16192a;
  --surface-2: #1e2236;
  --border: #2c3145;
  --text: #e6e9f2;
  --text-strong: #ffffff;
  --muted: #8b93ab;
  --accent: #7ba1ff;
  --accent-d: #5f8bff;
  --accent-soft: #232c47;
  --accent-border: #34457a;
  --danger: #ff7a66;
  --danger-bg: #3a1f1c;
  --danger-border: #5a2b25;
  --success: #6fd65a;
  --success-bg: #17301a;
  --success-border: #245a2a;
  --warning: #ffb45c;
  --warning-bg: #3a2a14;
  --warning-border: #5a4320;
  --brand-a: #2d5fe0;
  --brand-b: #142f80;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
  --ring: 0 0 0 4px rgba(123, 161, 255, .25);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Nunito Sans", "Segoe UI", Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
html[dir="rtl"] body { font-family: "Nunito Sans", "Segoe UI", Tahoma, "Noto Naskh Arabic", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.ico { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
.auth {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}

/* ---------- brand panel ---------- */
.brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 44px 56px;
  color: #fff;
  background: linear-gradient(150deg, var(--brand-a) 0%, var(--brand-b) 100%);
}
.brand::before, .brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  pointer-events: none;
}
.brand::before { width: 520px; height: 520px; right: -180px; top: -200px; }
.brand::after  { width: 380px; height: 380px; left: -140px; bottom: -160px; }
.brand > * { position: relative; z-index: 1; }

.brand__top { display: flex; align-items: center; gap: 12px; }
.brand__logo {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: #fff;
  object-fit: cover;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.brand__name { font-size: 1.15rem; font-weight: 900; letter-spacing: .02em; }

.brand__body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; max-width: 480px; padding: 48px 0; }
.brand__title { margin: 0 0 12px; font-size: clamp(1.7rem, 2.6vw, 2.3rem); line-height: 1.2; font-weight: 800; }
.brand__lead { margin: 0 0 30px; font-size: 1.02rem; color: rgba(255, 255, 255, .82); }

.brand__points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.brand__points li { display: flex; align-items: center; gap: 14px; font-weight: 600; }
.brand__points .pt-ico {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .18);
}
.brand__foot { font-size: .8rem; color: rgba(255, 255, 255, .65); }

/* ---------- form panel ---------- */
.panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 36px 30px;
}
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 26px; }
.card__logo { display: none; width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); object-fit: cover; margin-bottom: 14px; }
.card__title { margin: 0 0 4px; font-size: 1.55rem; font-weight: 800; color: var(--text-strong); line-height: 1.2; }
.card__sub { margin: 0; color: var(--muted); }
.card__foot { margin: 22px 0 0; text-align: center; font-size: .8rem; color: var(--muted); }

/* ---------- language switch ---------- */
.lang {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}
.lang button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.lang button[aria-pressed="true"] { background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow); }
.lang button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- alerts ---------- */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
  font-size: .92rem;
}
.alert .ico { margin-top: 2px; }
.alert ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.alert--success { border-color: var(--success-border); background: var(--success-bg); color: var(--success); }
.alert--caps {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning);
  margin: -6px 0 16px;
  padding: 8px 12px;
  font-size: .85rem;
}

/* ---------- fields ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; margin-bottom: 6px; font-size: .88rem; font-weight: 700; color: var(--text-strong); }
.control {
  position: relative;
  display: flex;
  align-items: center;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.control:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.control > .ico { position: absolute; inset-inline-start: 14px; color: var(--muted); pointer-events: none; }
.control input {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-strong);
  font: inherit;
  font-size: 1rem;
  padding-inline-start: 44px;
  padding-inline-end: 14px;
  border-radius: var(--radius);
}
.control input::placeholder { color: var(--muted); opacity: .8; }
.control input:-webkit-autofill { -webkit-box-shadow: 0 0 0 1000px var(--surface) inset; -webkit-text-fill-color: var(--text-strong); }
.control--pw input { padding-inline-end: 48px; }
.eye {
  position: absolute;
  inset-inline-end: 6px;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.eye:hover { background: var(--surface-2); color: var(--text-strong); }
.eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.eye .ico--off { display: none; }
.eye[aria-pressed="true"] .ico--on { display: none; }
.eye[aria-pressed="true"] .ico--off { display: block; }

.row { display: flex; justify-content: flex-end; align-items: center; margin: -6px 0 22px; font-size: .9rem; }
.row a { font-weight: 700; }

/* ---------- buttons ---------- */
.btn {
  position: relative;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .01em;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 6px 16px rgba(56, 116, 255, .28);
  transition: background 150ms ease, transform 100ms ease, box-shadow 150ms ease;
}
.btn:hover { background: var(--accent-d); box-shadow: 0 8px 20px rgba(56, 116, 255, .34); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn[disabled] { cursor: progress; opacity: .85; }
.btn .spin { display: none; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.is-loading .spin { display: inline-block; }
.btn.is-loading .btn__arrow { display: none; }
html[dir="rtl"] .btn__arrow { transform: scaleX(-1); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Secondary (ghost) button, e.g. "Back to sign in". */
.btn--ghost {
  background: var(--surface-2);
  color: var(--text-strong);
  border: 1px solid var(--border);
  box-shadow: none;
}
.btn--ghost:hover { background: var(--accent-soft); color: var(--accent-d); border-color: var(--accent-border); box-shadow: none; }
.btn--ghost .spin { border-color: rgba(56,116,255,.3); border-top-color: var(--accent); }

.actions { display: flex; gap: 12px; }
.actions .btn { width: auto; flex: 1 1 0; min-width: 0; }
.actions .btn--ghost { flex: 0 0 auto; padding: 0 22px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .brand { display: none; }
  .panel { min-height: 100%; padding: 28px 16px; background: radial-gradient(900px 500px at 50% -10%, var(--accent-soft) 0%, var(--bg) 60%); }
  .card { padding: 30px 24px 24px; }
  .card__logo { display: block; }
}
@media (max-width: 420px) {
  .actions { flex-direction: column-reverse; }
  .actions .btn--ghost { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
