/* ==========================================================================
   Document Studio — Sign-in portal styles
   All styling lives here (no inline styles) so the page keeps working under
   the strict browser security rules planned for Phase 2.
   ========================================================================== */

/* Self-hosted fonts (no Google Fonts / external requests) */
@font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('../vendor/fonts/open-sans-400.woff2') format('woff2'); }
@font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('../vendor/fonts/open-sans-500.woff2') format('woff2'); }
@font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('../vendor/fonts/open-sans-600.woff2') format('woff2'); }
@font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('../vendor/fonts/open-sans-700.woff2') format('woff2'); }

:root {
  /* Brand Palette */
  --color-primary: #0a2e5c;        /* Headers, primary buttons, title text */
  --color-primary-hover: #072b54;  /* Hover state */
  --color-navy: #081d38;           /* Full viewport backdrop navy */
  --color-accent: #009cde;         /* Cyan focus ring */

  /* Text & Surface Tokens */
  --text-main: #333333;
  --text-secondary: #50647b;       /* Labels and subtitles */
  --text-muted: #868e96;
  --bg-card: #e6ecf2;              /* Soft light grey-blue card container */
  --bg-input: #f2f5f8;             /* Light off-white input surface */
  --border-light: #d0d7de;
  --border-focus: #009cde;

  /* Layout Sizing & Radii */
  --radius-md: 8px;                /* Buttons, inputs */
  --radius-xl: 12px;               /* Main card radius */
  --card-max-width: 480px;         /* Wide proportion matching reference */
  --font-family: 'Open Sans', 'Segoe UI', sans-serif;

  /* Message colours */
  --msg-error-bg: #fdecea;
  --msg-error-text: #a4260b;
  --msg-success-bg: #e6f6f4;
  --msg-success-text: #00695f;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--color-navy);
  color: var(--text-main);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

/* ── Card ───────────────────────────────────────────────────────────────── */
.login-card {
  width: 100%;
  max-width: var(--card-max-width);
  padding: 3rem 2.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.login-logo img { width: 84px; height: 123px; display: block; }

/* ── Views ──────────────────────────────────────────────────────────────── */
.view { display: none; }
.view.active {
  display: block;
  animation: fadeUp 0.25s ease-out;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .view.active { animation: none; }
}

/* ── Typography ─────────────────────────────────────────────────────────── */
.app-title {
  margin: 0 0 0.5rem;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
}
.app-sub {
  margin: 0 0 2rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  text-align: center;
}
.view-title {
  margin: 0 0 0.35rem;
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
}
.view-sub {
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  text-align: center;
}

/* ── Form fields ────────────────────────────────────────────────────────── */
.fg { margin-bottom: 1.15rem; }

.fg label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.fg input {
  width: 100%;
  padding: 0.8rem 0.95rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fg input::placeholder { color: var(--text-muted); }
.fg input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 156, 222, 0.25);
}

/* Password field with eye toggle inside the input */
.input-wrap { position: relative; }
.input-wrap input { padding-right: 3rem; }
.toggle-pw {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
}
.toggle-pw:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.toggle-pw[aria-pressed="true"] svg { opacity: 0.55; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.7; cursor: wait; }

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  border: 1px solid var(--color-primary);
}
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); }

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}
.btn-secondary:hover { background: rgba(10, 46, 92, 0.06); }

.landing-btns { display: flex; flex-direction: column; gap: 0.75rem; }

/* Spinner inside buttons */
.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-spinner.show { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Navigation links ───────────────────────────────────────────────────── */
.nav-line {
  margin: 1rem 0 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
}
.nav-line + .nav-line { margin-top: 0.5rem; }
.link-btn {
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--color-primary);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ── Messages ───────────────────────────────────────────────────────────── */
.msg {
  display: none;
  margin-bottom: 1.15rem;
  padding: 0.7rem 0.9rem;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
}
.msg.error   { display: block; background: var(--msg-error-bg);   color: var(--msg-error-text); }
.msg.success { display: block; background: var(--msg-success-bg); color: var(--msg-success-text); }

/* ── Success view ───────────────────────────────────────────────────────── */
.success-icon { display: flex; justify-content: center; margin-bottom: 1rem; }
.success-text {
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  text-align: center;
}

/* ── Small screens ──────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .login-card { padding: 2.25rem 1.5rem; }
  .app-title { font-size: 1.9rem; }
}
