/* ==========================================================================
   EQUITY INTELLIGENCE — SIGN-IN SYSTEM
   Strict adherence to UI_DESIGN_SYSTEM.md & Obsidian Canvas Standards
   ========================================================================== */

:root {
  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --letter-spacing-base: -0.01em;
  --letter-spacing-tight: -0.025em;

  /* Obsidian Surface Elevations */
  --bg-canvas: #0D0F14;
  --bg-surface: #11141B;
  --bg-panel: #161A23;
  --bg-hover: rgba(255, 255, 255, 0.025);
  --bg-active: rgba(255, 255, 255, 0.06);

  /* Hairlines & Structural Borders */
  --border-hairline: rgba(255, 255, 255, 0.045);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #ffffff;
  --border-input-idle: rgba(255, 255, 255, 0.12);
  --border-input-hover: rgba(255, 255, 255, 0.25);
  --border-input-error: #f43f5e;

  /* Typography & Content Colors (95% Monochrome) */
  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #8E8E93;
  --text-dim: #64748b;

  /* Financial Meaning Accents */
  --fin-positive: #10b981;
  --fin-negative: #f43f5e;
  --fin-warning: #f59e0b;
}

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

html, body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ==========================================================================
   PAGE LAYOUT & ELEVATED CONTAINER CARD
   ========================================================================== */

.signin-page-layout {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 36px;
  background-color: var(--bg-canvas);
}

.signin-card {
  position: relative;
  width: 100%;
  max-width: 1040px;
  min-height: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Linear Top Progress Indicator (Monochrome) */
.card-progress-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: transparent;
  overflow: hidden;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.card-progress-bar.active {
  opacity: 1;
}

.card-progress-indicator {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, #ffffff 50%, transparent 100%);
  transform-origin: left;
  animation: progressPulse 1.4s infinite cubic-bezier(0.65, 0, 0.35, 1);
}

@keyframes progressPulse {
  0% { transform: translateX(-100%) scaleX(0.2); }
  50% { transform: translateX(0%) scaleX(0.8); }
  100% { transform: translateX(100%) scaleX(0.2); }
}

.signin-card-inner {
  display: flex;
  flex-direction: row;
  padding: 56px 52px;
  flex: 1;
  gap: 56px;
}

/* ==========================================================================
   LEFT COLUMN: BRANDING & HEADLINE
   ========================================================================== */

.signin-left-col {
  flex: 0 0 380px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  user-select: none;
}

.signin-brand-header {
  margin-bottom: 28px;
}

.brand-logo-link {
  display: inline-flex;
  text-decoration: none;
  transition: opacity 0.16s ease;
}

.brand-logo-link:hover {
  opacity: 0.85;
}

.brand-logo-svg {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 1px 4px rgba(255, 255, 255, 0.1));
}

.signin-title-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.signin-heading {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: var(--letter-spacing-tight);
  color: var(--text-primary);
  line-height: 1.15;
  transition: opacity 0.16s ease;
}

.signin-subheading {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: var(--letter-spacing-base);
  line-height: 1.5;
  transition: opacity 0.16s ease;
}

/* ==========================================================================
   RIGHT COLUMN: INTERACTIVE FORM WORKFLOW
   ========================================================================== */

.signin-right-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 280px;
}

#signinForm {
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
}

.form-step-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1), transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.form-step-panel.step-active {
  display: flex;
  opacity: 1;
  transform: translateX(0);
}

/* ==========================================================================
   LIVING INPUTS (PILLAR 5)
   ========================================================================== */

.input-field-group {
  margin-bottom: 20px;
  position: relative;
}

.outline-input-wrapper {
  position: relative;
  width: 100%;
  height: 56px;
}

.outline-input {
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-input-idle);
  border-radius: 8px;
  padding: 16px 16px;
  font-size: 15px;
  font-family: var(--font-family);
  color: var(--text-primary);
  position: relative;
  z-index: 1;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.outline-input:hover:not(:focus) {
  border-color: var(--border-input-hover);
  background: rgba(255, 255, 255, 0.04);
}

.outline-input:focus {
  border-color: var(--border-focus);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

/* Floating Label Mechanics */
.floating-label {
  position: absolute;
  left: 12px;
  top: 19px;
  font-size: 15px;
  color: var(--text-muted);
  pointer-events: none;
  line-height: 1;
  padding: 0 6px;
  background-color: transparent;
  transition: transform 0.16s cubic-bezier(0.4, 0, 0.2, 1), color 0.16s ease, background-color 0.16s ease;
  transform-origin: left top;
  z-index: 2;
}

.outline-input:focus ~ .floating-label,
.outline-input:not(:placeholder-shown) ~ .floating-label {
  transform: translateY(-28px) scale(0.82);
  color: var(--text-primary);
  background-color: var(--bg-surface);
  font-weight: 500;
}

.outline-input:focus ~ .floating-label {
  color: #ffffff;
}

/* Error State */
.input-field-group.has-error .outline-input {
  border-color: var(--border-input-error) !important;
  background: rgba(244, 63, 94, 0.03) !important;
}

.input-field-group.has-error .floating-label {
  color: var(--border-input-error) !important;
}

.field-error-msg {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--fin-negative);
  font-weight: 500;
}

.input-field-group.has-error .field-error-msg {
  display: flex;
  animation: fadeInDown 0.18s ease;
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.error-icon {
  flex-shrink: 0;
  color: var(--fin-negative);
}

/* Links & Help (Monochrome Discipline) */
.field-aux-links {
  margin-top: 4px;
  margin-bottom: 32px;
}

.text-link-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  padding: 0;
  transition: color 0.16s ease;
}

.text-link-btn:hover {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.guest-mode-notice {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-muted);
  margin-bottom: 36px;
}

.text-link-inline {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: color 0.16s ease;
}

.text-link-inline:hover {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ==========================================================================
   USER CHIP (STEP 2)
   ========================================================================== */

.user-account-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-hairline);
  border-radius: 9999px;
  margin-bottom: 24px;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.16s ease, border-color 0.16s ease;
  user-select: none;
}

.user-account-chip:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border-subtle);
}

.chip-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-identifier-text {
  font-size: 13.5px;
  font-weight: 500;
  color: #ffffff;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-dropdown-icon {
  color: var(--text-muted);
}

/* Custom Checkbox */
.password-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  margin-bottom: 36px;
}

.custom-checkbox-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.sr-only-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.custom-checkbox-box {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.custom-checkbox-box svg {
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.sr-only-checkbox:checked + .custom-checkbox-box {
  background: #ffffff;
  border-color: #ffffff;
}

.sr-only-checkbox:checked + .custom-checkbox-box svg {
  opacity: 1;
  transform: scale(1);
}

.checkbox-label-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ==========================================================================
   BUTTONS & STEP ACTIONS (PILLAR 3 & 8)
   ========================================================================== */

.step-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid var(--border-hairline);
}

.step-action-row.step-action-row-end,
.step-action-row-end {
  justify-content: flex-end;
}

.btn-text-action {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  padding: 10px 18px;
  border-radius: 9999px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background 0.16s ease, color 0.16s ease;
}

.btn-text-action:hover {
  background: rgba(255, 255, 255, 0.06);
}

.btn-primary-pill {
  background: #ffffff;
  color: #0D0F14;
  border: none;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-family);
  padding: 11px 28px;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.16s ease, opacity 0.16s ease;
  position: relative;
  min-width: 96px;
  min-height: 40px;
  box-sizing: border-box;
  text-decoration: none;
}

.btn-primary-pill:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.14);
}

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

.btn-primary-pill:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary-pill.loading {
  cursor: wait;
}

.btn-spinner {
  display: none;
  animation: spin 0.8s linear infinite;
}

.btn-primary-pill.loading .btn-spinner {
  display: block;
}

.btn-primary-pill.loading span {
  display: none;
}

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

/* ==========================================================================
   FOOTER
   ========================================================================== */

.signin-page-footer {
  width: 100%;
  max-width: 1040px;
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  user-select: none;
}

.lang-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 0.16s ease, background 0.16s ease;
}

.lang-dropdown-trigger:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.footer-right {
  display: flex;
  gap: 28px;
}

.footer-link {
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: none;
  transition: color 0.16s ease;
}

.footer-link:hover {
  color: #ffffff;
}

/* ==========================================================================
   MODAL DIALOG (PILLAR 8)
   ========================================================================== */

.info-dialog {
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  background: var(--bg-panel);
  color: var(--text-primary);
  max-width: 500px;
  width: 90%;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.85);
  margin: auto;
  padding: 0;
}

.info-dialog::backdrop {
  background: rgba(13, 15, 20, 0.80);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.dialog-content {
  padding: 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: var(--letter-spacing-tight);
  color: #ffffff;
}

.dialog-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  transition: color 0.16s ease;
}

.dialog-close-btn:hover {
  color: #ffffff;
}

.dialog-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.dialog-body p {
  margin-bottom: 12px;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ==========================================================================
   RESPONSIVE (TABLET / MOBILE)
   ========================================================================== */

@media (max-width: 820px) {
  .signin-page-layout {
    padding: 24px 16px;
  }

  .signin-card {
    max-width: 480px;
    min-height: auto;
    border-radius: 20px;
  }

  .signin-card-inner {
    flex-direction: column;
    padding: 36px 28px;
    gap: 32px;
  }

  .signin-left-col {
    flex: none;
  }

  .signin-heading {
    font-size: 28px;
  }

  .signin-page-footer {
    max-width: 480px;
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
  }
}

/* Keyboard Accessibility — Swiss Monochrome :focus-visible */
:focus:not(:focus-visible) {
  outline: none;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: 1.5px solid rgba(255, 255, 255, 0.88);
  outline-offset: 2px;
}

input:not([type="checkbox"]):not([type="radio"]):focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1.5px solid rgba(255, 255, 255, 0.85);
  outline-offset: 1px;
}

