/* Roalla Auth Hub — shared sign-in and auth flow styles */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

html[data-theme="dark"] body.auth-page,
html:not([data-theme]) body.auth-page {
  --bg: #0f1419;
  --card: #1a2332;
  --text: #e8ecf1;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --border: #2d3a4d;
  --ok: #4ade80;
  --accent-soft: rgba(59, 130, 246, 0.14);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body.auth-page {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.auth-main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 1.25rem 1rem 2rem;
  background:
    radial-gradient(ellipse 80% 55% at 50% -15%, var(--gradient-blue), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, var(--gradient-green), transparent),
    var(--bg);
}

.auth-shell {
  width: 100%;
  max-width: 920px;
  display: grid;
  gap: 1.5rem;
  align-items: stretch;
}

.auth-shell--simple {
  max-width: 440px;
}

.auth-aside {
  display: none;
}

.auth-form-panel {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.auth-shell:not(.auth-shell--simple) .auth-form-panel {
  max-width: none;
}

.card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: var(--shadow, 0 8px 32px rgba(0, 0, 0, 0.12));
}

.auth-header {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.auth-header-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.auth-header-text h1,
.card > h1 {
  margin: 0 0 0.3rem;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

p.lead,
.card > p.lead {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.auth-header-text .lead {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--muted);
}

.field {
  margin-bottom: 0.85rem;
}

.field input,
.card > input,
.card input.auth-input {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input {
  margin-bottom: 0;
}

.field input:focus,
.card > input:focus,
.card input.auth-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(59, 130, 246, 0.15));
}

.field input[aria-invalid="true"] {
  border-color: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15);
}

.field-error {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #f87171;
  line-height: 1.35;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: auto;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--text);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.password-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
  pointer-events: none;
}

button,
.btn {
  display: block;
  width: 100%;
  padding: 0.72rem 1rem;
  border-radius: 10px;
  border: none;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: filter 0.15s ease, opacity 0.15s ease, transform 0.12s ease;
}

button.primary {
  background: var(--accent);
  color: #fff;
}

button.primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

button.primary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.primary:disabled {
  opacity: 0.72;
  cursor: wait;
}

button.primary.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

.social {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.btn.social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background: var(--social-btn-bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
  padding: 0.65rem 1rem;
}

.btn.social:hover {
  background: var(--nav-hover-bg, rgba(255, 255, 255, 0.04));
  border-color: var(--muted-dim, var(--muted));
}

.btn.social:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.social-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.social-label {
  line-height: 1.2;
}

.passkey-btn {
  font: inherit;
}

.passkey-btn:disabled {
  opacity: 0.72;
  cursor: wait;
}

.expand-more {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.45rem 0 0.7rem;
  width: 100%;
  text-align: center;
}

.expand-more:hover {
  text-decoration: underline;
}

#socialMore {
  margin-bottom: 0.85rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 1.1rem 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider span {
  flex-shrink: 0;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  font-size: 0.82rem;
}

.error {
  color: #f87171;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.success {
  color: var(--ok);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.msg {
  font-size: 0.9rem;
  margin-top: 1rem;
  line-height: 1.45;
}

.msg.ok {
  color: var(--ok);
}

.msg.err {
  color: #f87171;
}

.hidden {
  display: none !important;
}

.links {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.85rem;
  text-align: center;
  line-height: 1.5;
}

.links a,
.auth-back-link {
  color: var(--accent);
  text-decoration: none;
}

.links a:hover,
.auth-back-link:hover {
  text-decoration: underline;
}

.auth-toggle-row {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.auth-toggle-row a {
  color: var(--accent);
  text-decoration: none;
}

.auth-toggle-row a:hover {
  text-decoration: underline;
}

.hub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 1.35rem;
  text-align: center;
  line-height: 1.45;
}

.hub-trust {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  width: 100%;
}

.hub-lock {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
  opacity: 0.75;
}

.hub a {
  color: var(--accent);
  text-decoration: none;
}

.hub a:hover {
  text-decoration: underline;
}

/* Desktop split layout */
@media (min-width: 900px) {
  .auth-shell:not(.auth-shell--simple) {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
  }

  .auth-aside {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
  }

  .auth-aside-inner {
    max-width: 340px;
  }

  .auth-aside-brand {
    margin-bottom: 1.25rem;
  }

  .auth-aside-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
  }

  .auth-aside-mark {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.35rem;
    color: #fff;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
  }

  .auth-aside-title {
    margin: 0 0 0.65rem;
    font-size: 1.65rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.2;
  }

  .auth-aside-lead {
    margin: 0 0 1.5rem;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.55;
  }

  .auth-aside-shield {
    color: var(--accent);
    opacity: 0.55;
  }

  .auth-aside-shield svg {
    width: 2.5rem;
    height: 2.5rem;
    fill: currentColor;
  }

  .auth-shell--branded .auth-header--card {
    display: none;
  }

  .auth-form-panel {
    margin: 0;
  }
}

/* Verify email dialog */
.verify-dialog {
  border: none;
  padding: 0;
  max-width: min(420px, calc(100vw - 2rem));
  width: 100%;
  background: transparent;
  color: var(--text);
}

.verify-dialog::backdrop {
  background: var(--modal-backdrop, rgba(8, 12, 18, 0.72));
  backdrop-filter: blur(4px);
}

.verify-dialog-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.5rem 1.25rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.verify-dialog-icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  margin: 0 auto 1rem;
  background: rgba(74, 222, 128, 0.14);
  color: var(--ok);
}

.verify-dialog-icon svg {
  width: 1.65rem;
  height: 1.65rem;
  fill: currentColor;
}

.verify-dialog h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
  line-height: 1.25;
}

.verify-dialog-lead {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
  line-height: 1.5;
}

.verify-dialog-email {
  display: block;
  margin-top: 0.35rem;
  color: var(--text);
  font-weight: 600;
  word-break: break-word;
}

.verify-steps {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.verify-steps li + li {
  margin-top: 0.45rem;
}

.verify-tip {
  margin: 0 0 1.1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: var(--accent-soft, rgba(59, 130, 246, 0.1));
  border: 1px solid rgba(59, 130, 246, 0.22);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.verify-dialog-actions {
  display: grid;
  gap: 0.55rem;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  font-weight: 500;
}

.verify-dialog-status {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  text-align: center;
  color: var(--ok);
  line-height: 1.4;
}

.verify-dialog-status.is-error {
  color: #f87171;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
