/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ===========================
   Reset & Base
   =========================== */

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

:root {
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-text: #1a1a2e;
  --color-text-secondary: #555;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-border: #d1d5db;
  --color-border-focus: #93a3f8;
  --color-error-bg: #fef2f2;
  --color-error-text: #991b1b;
  --color-error-border: #fca5a5;
  --color-alert-bg: #fffbeb;
  --color-alert-text: #92400e;
  --color-alert-border: #fcd34d;
  --color-success-bg: #ecfdf5;
  --color-success-text: #065f46;
  --color-success-border: #6ee7b7;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1rem;
}

/* ===========================
   Navigation
   =========================== */

body > p:first-child {
  width: 100%;
  max-width: 480px;
  padding: 1rem 0 0;
}

body > p:first-child a {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

body > p:first-child a:hover {
  color: var(--color-primary);
}

/* ===========================
   Typography
   =========================== */

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--color-text-secondary);
}

p {
  margin-bottom: 0.75rem;
}

/* ===========================
   Main Content Card
   =========================== */

body > h1,
body > h2,
body > div,
body > form,
body > hr {
  width: 100%;
  max-width: 480px;
}

body > h1:first-of-type,
body > h2:first-of-type {
  margin-top: 2rem;
}

body > div,
body > form {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-top: 1rem;
}

body > div + div,
body > form + form,
body > div + form,
body > form + div {
  margin-top: 0.75rem;
}

/* ===========================
   Forms
   =========================== */

form {
  width: 100%;
}

form > div {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 0.625rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input[type="submit"],
button {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background-color: var(--color-primary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  margin-top: 0.5rem;
}

input[type="submit"]:hover,
button:hover {
  background-color: var(--color-primary-hover);
  box-shadow: var(--shadow);
}

input[type="submit"]:active,
button:active {
  transform: translateY(1px);
}

input[type="submit"]:disabled,
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

input[type="submit"]:disabled:hover,
button:disabled:hover {
  background-color: var(--color-primary);
  box-shadow: none;
}

/* ===========================
   Links
   =========================== */

a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

a:hover {
  text-decoration: underline;
}

/* ===========================
   Ordered Lists (Steps)
   =========================== */

ol {
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}

ol li {
  margin-bottom: 0.375rem;
  padding-left: 0.25rem;
}

/* ===========================
   Flash Messages / Alerts
   =========================== */

div[role="alert"] {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  background-color: var(--color-alert-bg);
  color: var(--color-alert-text);
  border: 1px solid var(--color-alert-border);
  margin-top: 0.75rem;
}

/* ===========================
   Error Messages
   =========================== */

.errors {
  margin-top: 0.75rem;
}

.errors span {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  background-color: var(--color-error-bg);
  color: var(--color-error-text);
  border: 1px solid var(--color-error-border);
}

/* ===========================
   Horizontal Rule
   =========================== */

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.25rem auto;
  max-width: 480px;
  width: 100%;
}

/* ===========================
   Passkey Page
   =========================== */

div[data-controller*="passkey"] p span {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

div[data-controller*="passkey"] p {
  margin-bottom: 0.375rem;
}

/* ===========================
   Confirmation Page
   =========================== */

body > div:has(> h1) {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

body > div:has(> h1) h1 {
  margin-bottom: 0.75rem;
}

body > div:has(> h1) a {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  background-color: var(--color-primary);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  margin-top: 0.5rem;
  transition: background-color 0.15s ease;
}

body > div:has(> h1) a:hover {
  background-color: var(--color-primary-hover);
  text-decoration: none;
}

/* ===========================
   Definition Lists
   =========================== */

dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.375rem 1rem;
}

dt {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

dd {
  font-size: 0.875rem;
}

/* ===========================
   Tables
   =========================== */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem 0.75rem 0.5rem 0;
  white-space: nowrap;
}

tbody td {
  padding: 0.625rem 0.75rem 0.625rem 0;
  border-bottom: 1px solid var(--color-bg);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

.truncate {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===========================
   Badges
   =========================== */

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background-color: var(--color-success-bg);
  color: var(--color-success-text);
  border: 1px solid var(--color-success-border);
  white-space: nowrap;
}
