/**
 * Chronoia Identity & SSO (Project Janus) Stylesheet
 * System Identity: The Galilean Aurora (Jovian Celestial Resonance)
 * Scope: identity.chronoia.xyz (/login, /account)
 */

@import url('/theme/tokens.css');
@import url('/theme/fonts.css');

:root {
  /* Surfaces & Void */
  --color-void: #070911;
  --color-void-deep: #040508;
  --color-surface-slate: #0d111c;
  --color-surface-elevated: #121726;

  /* Glassmorphism */
  --glass-bg: rgba(13, 17, 28, 0.85);
  --glass-border: rgba(139, 92, 246, 0.24);
  --glass-inner-rim: rgba(56, 189, 248, 0.12);
  --glass-shadow: 0 20px 45px rgba(0, 0, 0, 0.65), 0 0 35px rgba(139, 92, 246, 0.08);

  /* Celestial Accents */
  --aurora-violet: #8b5cf6;
  --aurora-glow: rgba(139, 92, 246, 0.20);
  --cryo-ice: #38bdf8;
  --cryo-glow: rgba(56, 189, 248, 0.20);
  --lavender: #c4b5fd;

  /* Typography Colors */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #828fa3;
  --text-subtle: #475569;

  /* Status Telemetry */
  --status-emerald: #10b981;
  --status-emerald-bg: rgba(16, 185, 129, 0.14);
  --status-emerald-border: rgba(16, 185, 129, 0.35);
  --status-coral: #f87171;
  --status-coral-bg: rgba(239, 68, 68, 0.14);
  --status-coral-border: rgba(239, 68, 68, 0.35);
  --status-amber: #fbbf24;
  --status-amber-bg: rgba(245, 158, 11, 0.15);
  --status-amber-border: rgba(245, 158, 11, 0.35);

  /* Controls & Radii */
  --input-bg: rgba(8, 11, 20, 0.90);
  --input-border: rgba(139, 92, 246, 0.25);
  --input-border-focus: #38bdf8;
  --radius-squircle: 18px;
  --radius-control: 9px;

  /* CTA Gradients */
  --gradient-cta: linear-gradient(135deg, #0284c7 0%, #1e40af 50%, #4338ca 100%);
  --gradient-cta-shadow: 0 4px 18px rgba(2, 132, 199, 0.30), 0 2px 6px rgba(67, 56, 202, 0.35);
  --gradient-cta-hover-shadow: 0 6px 24px rgba(2, 132, 199, 0.45), 0 3px 10px rgba(67, 56, 202, 0.50);

  /* Font Stacks */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: 'Space Grotesk', var(--font-sans);
  --font-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  background-color: var(--color-void);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139, 92, 246, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 50% 120%, rgba(56, 189, 248, 0.10), transparent);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  -webkit-font-smoothing: antialiased;
}

/* Card Container & Frosted Glassmorphism */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-squircle);
  max-width: 440px;
  width: 100%;
  padding: 2.25rem 2rem;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-inner-rim);
  position: relative;
}

.card.card-wide {
  max-width: 560px;
  padding: 2.25rem 2.25rem;
}

/* Brand Lockup & Logos */
.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.25rem;
}

.card-wide .brand-lockup {
  flex-direction: row;
  align-items: center;
  gap: 0.95rem;
  margin-bottom: 0;
}

.brand-icon {
  width: 58px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.65rem;
  border-radius: 16px;
  background: var(--color-surface-slate);
  border: 1px solid rgba(139, 92, 246, 0.35);
  box-shadow: 0 4px 18px var(--aurora-glow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.card-wide .brand-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 0;
  border-radius: 14px;
  flex-shrink: 0;
}

.brand-icon svg {
  width: 44px;
  height: 44px;
}

.card-wide .brand-icon svg {
  width: 36px;
  height: 36px;
}

.brand-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.08em;
  text-transform: lowercase;
  font-family: var(--font-display);
}

.brand-sub {
  color: var(--cryo-ice);
}

/* Headings & Subtitles */
h1 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  text-align: center;
  letter-spacing: -0.01em;
}

.card-wide h1 {
  font-size: 1.35rem;
  text-align: left;
}

.subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Form Fields & Controls */
.field {
  margin-bottom: 1.15rem;
  position: relative;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.4rem;
}

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

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-control);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder {
  color: var(--text-subtle);
}

input:focus {
  outline: none;
  border-color: var(--cryo-ice);
  box-shadow: 0 0 0 3px var(--cryo-glow);
}

input:focus-visible {
  outline: 2px solid var(--cryo-ice);
  outline-offset: 1px;
}

/* Validate Input After Interaction (:user-invalid) */
input:user-invalid {
  border-color: var(--status-coral);
  background-color: rgba(239, 68, 68, 0.05);
}

input:user-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}

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

.pw-toggle-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
  transition: color 0.15s ease;
}

.pw-toggle-btn:hover {
  color: var(--text-primary);
}

.pw-toggle-btn:focus-visible {
  outline: 2px solid var(--cryo-ice);
  outline-offset: 2px;
}

.field-error-hint {
  display: none;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--status-coral);
  align-items: center;
  gap: 0.35rem;
}

input:user-invalid ~ .field-error-hint {
  display: flex;
}

/* Primary Action Buttons */
.btn-submit {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-control);
  border: none;
  cursor: pointer;
  background: var(--gradient-cta);
  color: #ffffff;
  margin-top: 0.75rem;
  box-shadow: var(--gradient-cta-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--gradient-cta-hover-shadow);
}

.btn-submit:active:not(:disabled) {
  transform: translateY(0);
}

.btn-submit:focus-visible {
  outline: 3px solid var(--cryo-ice);
  outline-offset: 2px;
}

.btn-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* Status Notifications & Live Region */
.status-container {
  margin-top: 1.15rem;
  min-height: 1.5rem;
}

.status {
  display: none;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-control);
  font-size: 0.875rem;
  text-align: left;
  line-height: 1.4;
  align-items: flex-start;
  gap: 0.55rem;
}

.status.visible,
.status.error,
.status.step-up,
.status.info,
.status.success {
  display: flex;
}

.status.info {
  background: rgba(56, 189, 248, 0.10);
  border: 1px solid var(--cryo-glow);
  color: #bae6fd;
}

.status.step-up {
  background: var(--status-amber-bg);
  border: 1px solid var(--status-amber-border);
  color: #fef3c7;
  animation: pulse-border 2s infinite ease-in-out;
}

.status.error {
  background: var(--status-coral-bg);
  border: 1px solid var(--status-coral-border);
  color: #fecaca;
}

.status.success {
  background: var(--status-emerald-bg);
  border: 1px solid var(--status-emerald-border);
  color: #a7f3d0;
}

.status-icon {
  flex-shrink: 0;
  margin-top: 0.1rem;
  width: 16px;
  height: 16px;
}

/* Dashboard Claims List (<dl>) */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.18);
  gap: 1rem;
}

.status-pill {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6ee7b7;
  background: var(--status-emerald-bg);
  border: 1px solid var(--status-emerald-border);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.20);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse-dot 2s infinite;
}

.claims-list {
  display: flex;
  flex-direction: column;
}

.claim-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(139, 92, 246, 0.12);
  gap: 1.25rem;
}

.claim-item:last-child {
  border-bottom: none;
}

dt.label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

dd.value {
  font-size: 0.92rem;
  color: var(--text-primary);
  text-align: right;
  word-break: break-word;
  font-weight: 400;
}

.value-mono {
  font-family: var(--font-mono);
  font-size: 0.88rem !important;
  color: #bae6fd;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: var(--color-surface-slate);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.badge-factor {
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.10);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.15);
}

.badge-aal {
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.40);
  background: rgba(139, 92, 246, 0.15);
  font-weight: 600;
}

/* Dashboard Action Buttons & Footer */
.actions {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(139, 92, 246, 0.18);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.realm-indicator {
  font-size: 0.78rem;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.realm-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--aurora-violet);
}

.btn-logout {
  min-height: 42px;
  padding: 0.6rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-control);
  border: 1px solid rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: var(--status-coral);
  color: #fecaca;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
}

.btn-logout:focus-visible {
  outline: 2px solid var(--status-coral);
  outline-offset: 2px;
}

/* Spinner & Animations */
.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-submit.loading .spinner {
  display: inline-block;
}

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

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(245, 158, 11, 0.35); box-shadow: 0 0 0 rgba(245, 158, 11, 0); }
  50% { border-color: rgba(245, 158, 11, 0.75); box-shadow: 0 0 14px rgba(245, 158, 11, 0.25); }
}

.hidden {
  display: none;
}

.consent-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.consent-actions .btn-logout {
  width: 100%;
  justify-content: center;
}
