/*
 * 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.
 */

/* Signed-out pages (sign in, password reset, invitations). Nobody is signed in
   here, so there is no saved appearance to read: these pages follow the device
   via prefers-color-scheme, using the same palette as the app's dark theme. */
:root {
  color-scheme: light dark;
  --auth-ink: #1a1a2e;
  --auth-ink-soft: #6b7189;
  --auth-heading: #0f1226;
  --auth-label: #3a3f57;
  --auth-line: #e6e8f0;
  --auth-field-line: #d7dae6;
  --auth-field-bg: #fbfbfe;
  --auth-field-focus-bg: #ffffff;
  --auth-placeholder: #aab0c2;
  --auth-icon: #9aa0b5;
  --auth-card: #ffffff;
  --auth-card-shadow: 0 24px 55px -28px rgba(24, 27, 63, 0.45);
  --auth-sso-hover: #f7f8fc;
  --auth-sso-hover-line: #c3c8d6;
  --auth-accent: #4338ca;
  --auth-accent-soft: #7c6cf5;
  --auth-danger-bg: #fdecec;
  --auth-danger-line: #f3c2c2;
  --auth-danger-ink: #8a1f1f;
  --auth-bg:
    radial-gradient(1100px 520px at 12% -8%, #eef0ff 0%, rgba(238, 240, 255, 0) 60%),
    radial-gradient(900px 480px at 100% 0%, #efe9ff 0%, rgba(239, 233, 255, 0) 55%),
    linear-gradient(180deg, #f7f8fc 0%, #eef0f8 100%);
}
@media (prefers-color-scheme: dark) {
  :root {
    --auth-ink: #e9ebf2;
    --auth-ink-soft: #a0a7b8;
    --auth-heading: #ffffff;
    --auth-label: #c9cdd8;
    --auth-line: #262b3a;
    --auth-field-line: #353c4f;
    --auth-field-bg: #1a1e29;
    --auth-field-focus-bg: #161922;
    --auth-placeholder: #6f778a;
    --auth-icon: #6f778a;
    --auth-card: #161922;
    --auth-card-shadow: 0 24px 55px -20px rgba(0, 0, 0, 0.7);
    --auth-sso-hover: #1e2230;
    --auth-sso-hover-line: #454d63;
    --auth-accent: #a49dff;
    --auth-accent-soft: #8f88ff;
    --auth-danger-bg: rgba(248, 113, 113, 0.14);
    --auth-danger-line: rgba(248, 113, 113, 0.35);
    --auth-danger-ink: #fca5a5;
    --auth-bg:
      radial-gradient(1100px 520px at 12% -8%, #1d1b3a 0%, rgba(29, 27, 58, 0) 60%),
      radial-gradient(900px 480px at 100% 0%, #17203a 0%, rgba(23, 32, 58, 0) 55%),
      linear-gradient(180deg, #0f1117 0%, #0b0d13 100%);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--auth-ink);
  background: #f7f8fc;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-color-scheme: dark) { body { background: #0f1117; } }

.flash {
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.95rem;
}
.flash--notice { background: #e6f4ea; color: #1e4620; }
.flash--alert  { background: #fbe9e7; color: #611a15; }

.button {
  display: inline-block;
  padding: 0.65rem 1.4rem;
  border: 0;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button--primary { background: #4338ca; color: #fff; }
.button--primary:hover { background: #3730a3; }

.landing {
  max-width: 720px;
  margin: 0 auto;
  padding: 6rem 1.5rem;
  text-align: center;
}
.landing__hero h1 { font-size: 3rem; margin: 0 0 1rem; }
.landing__tagline { font-size: 1.25rem; color: #4a4a68; margin: 0 0 2rem; }

.auth {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
  background: var(--auth-bg);
}

.auth__card {
  margin: auto;
  width: 100%;
  max-width: 400px;
  background: var(--auth-card);
  border: 1px solid var(--auth-line);
  border-radius: 18px;
  padding: 2.5rem 2.25rem 2.25rem;
  box-shadow: var(--auth-card-shadow);
}

.auth__brand { text-align: center; margin-bottom: 1.75rem; }
.auth__logo { height: 68px; width: auto; margin-bottom: 1.1rem; }
.auth__brand h1 { margin: 0 0 0.35rem; font-size: 1.6rem; letter-spacing: -0.02em; color: var(--auth-heading); }
.auth__subtitle { margin: 0; color: var(--auth-ink-soft); font-size: 0.95rem; }

.auth__form .field { margin-bottom: 1.1rem; }
.auth__form label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--auth-label);
}

.field__control { position: relative; }
.field__icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--auth-icon);
  pointer-events: none;
  transition: color 0.15s ease;
}
.auth__form .field__control input {
  width: 100%;
  padding: 0.7rem 0.85rem 0.7rem 2.6rem;
  border: 1px solid var(--auth-field-line);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--auth-field-bg);
  color: var(--auth-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.auth__form .field__control input::placeholder { color: var(--auth-placeholder); }
.auth__form .field__control input:focus {
  outline: 0;
  border-color: var(--auth-accent-soft);
  background: var(--auth-field-focus-bg);
  box-shadow: 0 0 0 3px rgba(124, 108, 245, 0.22);
}
.field__control:focus-within .field__icon { color: var(--auth-accent); }

.auth__submit {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.8rem 1.4rem;
  background: linear-gradient(135deg, #4338ca 0%, #6d5df3 100%);
  box-shadow: 0 14px 26px -14px rgba(67, 56, 202, 0.85);
  transition: transform 0.06s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.auth__submit:hover { filter: brightness(1.05); box-shadow: 0 16px 30px -14px rgba(67, 56, 202, 0.95); }
.auth__submit:active { transform: translateY(1px); }

.auth__divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.3rem 0;
  color: var(--auth-icon);
  font-size: 0.82rem;
}
.auth__divider::before,
.auth__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--auth-line);
}

/* button_to renders a <form>; keep it from adding vertical space. */
.auth form.button_to { margin: 0; }
.auth__sso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--auth-field-line);
  border-radius: 10px;
  background: var(--auth-card);
  color: var(--auth-ink);
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth__sso:hover { background: var(--auth-sso-hover); border-color: var(--auth-sso-hover-line); box-shadow: 0 4px 12px -6px rgba(24, 27, 63, 0.25); }
.auth__sso:active { transform: translateY(1px); }

.auth__foot { margin: 1.4rem 0 0; text-align: center; font-size: 0.9rem; }
.auth__foot a { color: var(--auth-accent); font-weight: 600; text-decoration: none; }
.auth__foot a:hover { text-decoration: underline; }

.auth__meta {
  display: flex;
  justify-content: flex-end;
  margin: -0.4rem 0 1rem;
}
.auth__meta a { color: var(--auth-ink-soft); font-size: 0.85rem; text-decoration: none; }
.auth__meta a:hover { color: var(--auth-accent); text-decoration: underline; }

.auth__errors {
  margin-bottom: 1.1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--auth-danger-line);
  background: var(--auth-danger-bg);
  border-radius: 10px;
  color: var(--auth-danger-ink);
  font-size: 0.9rem;
}
.auth__errors ul { margin: 0; padding-left: 1.1rem; }

/* The second step of signing in: the passkey button, the code field, and the
   ways out of a page that is half-way through a sign-in. */
.auth__note { margin: 0.4rem 0 0; color: var(--auth-ink-soft); font-size: 0.82rem; }

.auth__form .field__control input.otp-code-field {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
}

.auth__details { margin-top: 1.2rem; }
.auth__details summary { cursor: pointer; color: var(--auth-ink-soft); font-size: 0.88rem; }
.auth__details[open] summary { margin-bottom: 0.8rem; }

.auth__errors--inline { margin: 0.7rem 0 0; }

/* "Sign in as someone else" — a button_to that has to read as a link. */
.auth__plain-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--auth-accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.auth__plain-link:hover { text-decoration: underline; }

/* The passkey button sits where the SSO button does; keep them apart. */
.auth__sso + .auth__sso, form.button_to + [data-controller="passkey"], [data-controller="passkey"] + form.button_to {
  margin-top: 0.6rem;
}
.auth__sso[disabled] { opacity: 0.65; cursor: progress; }

/* SweetAlert2 (sign-in errors) in the dark. */
@media (prefers-color-scheme: dark) {
  .swal2-popup { background: #161922; color: #e9ebf2; }
  .swal2-title, .swal2-html-container { color: #e9ebf2; }
}
