/* Sign-in surfaces of the platform: /login and /setup.
 *
 * Same identity as the dashboard (extension/ui/theme.css): deep Elm navy as
 * the ground, the logo's prism carrying light, Amiri for the title and IBM
 * Plex Sans Arabic for everything read fast. The tokens are repeated here on
 * purpose — these two pages are shown before sign-in, so they must not pull
 * anything from the signed-in side of the server.
 *
 * Engineered & Developed by Rakan Alharbi.
 */
:root {
  color-scheme: dark;
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, Arial, sans-serif;
  --font-display: 'Amiri', 'IBM Plex Sans Arabic', 'Traditional Arabic', serif;

  --ink: #eef2fc;
  --ink-2: #c5cfe8;
  --muted: #94a2c4;
  --line: #1d2a53;
  --line-strong: #2d3f70;
  --paper: #101c42;
  --canvas: #070e24;

  --brand: #4a9ff0;
  --focus: #00a1e1;
  --gold: #b78fe8;
  --gold-line: rgba(138, 122, 232, .45);
  --gold-grad: linear-gradient(135deg, #7d3fc4 0%, #5b4bd0 42%, #0971ce 100%);
  --gold-grad-text: linear-gradient(100deg, #cb8adb 0%, #a06ee0 32%, #4a9ff0 66%, #00a1e1 100%);
  --danger: #ff8a6b;
  --danger-soft: #34181a;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-lift: 0 2px 4px rgba(3, 8, 24, .5), 0 18px 40px -12px rgba(3, 8, 24, .8);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  gap: 24px;
  padding: 32px 16px 20px;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
}

/* The prism, thrown softly behind the card — decorative only. */
body::before {
  content: '';
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(60% 55% at 72% 8%, rgba(117, 60, 186, .34), transparent 70%),
    radial-gradient(50% 50% at 18% 0%, rgba(9, 113, 206, .28), transparent 72%);
  pointer-events: none;
  z-index: 0;
}

/* ------------------------------------------------------------------ card */

.auth {
  position: relative;
  z-index: 1;
  align-self: center;
  width: 100%;
  max-width: 420px;
  background: linear-gradient(180deg, #16295c 0%, var(--paper) 58%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 30px 28px 26px;
  overflow: hidden;
}

body.wide .auth { max-width: 560px; }

/* Prism hairline across the top edge. */
.auth::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 2px;
  background: var(--gold-grad-text);
}

.auth__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.auth__mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border: 1px solid var(--gold-line);
  border-radius: 12px;
  background: rgba(7, 14, 36, .55);
}

.auth__mark img { width: 30px; height: auto; }

.auth__title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
}

.auth__sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: .82rem;
}

.auth__lead {
  margin: 0 0 20px;
  color: var(--ink-2);
  font-size: .88rem;
}

/* ------------------------------------------------------------------ form */

form { display: grid; gap: 6px; }

label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-top: 10px;
}

input {
  font: inherit;
  color: inherit;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(7, 14, 36, .6);
  transition: border-color .15s ease, box-shadow .15s ease;
}

input::placeholder { color: var(--muted); }
input:hover, .select:hover { border-color: var(--gold-line); }

input:focus-visible, .select:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(0, 161, 225, .25);
}

/* A rank picker reads as one of the fields, not as a browser control. */
.select {
  font: inherit;
  color: inherit;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(7, 14, 36, .6);
  cursor: pointer;
}

.select--sm { padding: 5px 8px; font-size: .82rem; }
.select option { background: var(--paper); color: var(--ink); }

/* A section of accounts on the setup page. */
.auth h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 24px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--gold);
}

button[type="submit"] {
  margin-top: 22px;
  font: inherit;
  font-weight: 600;
  padding: 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--gold-grad);
  color: #fff;
  cursor: pointer;
  transition: filter .15s ease, transform .15s ease;
}

button[type="submit"]:hover { filter: brightness(1.12); }
button[type="submit"]:active { transform: translateY(1px); }
button[type="submit"]:disabled { opacity: .6; cursor: progress; filter: none; }

button[type="submit"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 138, 107, .4);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: .87rem;
}

.auth__note {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
}

.auth__note a { color: var(--brand); }

/* ------------------------------------------------------------------ footer */

.auth-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: .72rem;
}

/* The Elm wordmark is dark, so it sits on the same white plate the dashboard
   footer gives it rather than fading into the navy. */
.auth-foot img {
  display: block;
  height: 20px;
  width: auto;
  background: #fff;
  border-radius: 10px;
  padding: 7px 12px;
  box-shadow: 0 8px 22px -14px rgba(3, 8, 24, .75);
}
.auth-foot b { font-weight: 600; color: var(--ink-2); }

@media (max-width: 420px) {
  .auth { padding: 24px 20px 22px; }
  .auth-foot { flex-direction: column; gap: 6px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
