/* ================================================================
   Auth Pages - Minimal Design
   Clean, focused, professional
   ================================================================ */

/* ===== CSS VARIABLES ===== */
:root {
    --auth-bg: #0a0f1a;
    --auth-card-bg: rgba(24, 37, 79, 0.6);
    --auth-card-border: rgba(255, 255, 255, 0.08);
    --auth-input-bg: rgba(255, 255, 255, 0.05);
    --auth-input-border: rgba(255, 255, 255, 0.12);
    --auth-input-focus: rgba(255, 255, 255, 0.2);
    --auth-text: #ffffff;
    --auth-text-secondary: #9ca3af;
    --auth-text-muted: #6b7280;
    --auth-accent: #667eea;
    --auth-error: #f87171;
    --auth-success: #4ade80;
}

/* ===== PAGE ===== */
.auth-page {
    background:
        linear-gradient(rgba(54, 147, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(54, 147, 255, 0.03) 1px, transparent 1px),
        radial-gradient(ellipse 60% 50% at 50% 40%, rgba(102, 126, 234, 0.08), transparent),
        var(--auth-bg);
    background-size: 60px 60px, 60px 60px, 100% 100%, 100% 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* ===== AUTH CARD ===== */
.auth-card {
    background: var(--auth-card-bg);
    border: 1px solid rgba(54, 147, 255, 0.15);
    border-radius: 1rem;
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    box-shadow:
        0 0 30px rgba(54, 147, 255, 0.15),
        0 0 60px rgba(54, 147, 255, 0.08),
        0 0 100px rgba(54, 147, 255, 0.04);
}


/* ===== LOGO ===== */
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin-bottom: 2rem;
}

.auth-logo img {
    height: 36px;
    width: auto;
}

.auth-logo-name {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    background: linear-gradient(90deg, #06b6d4, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===== HEADINGS ===== */
.auth-title {
    color: var(--auth-text);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-subtitle {
    color: var(--auth-text-secondary);
    font-size: 0.925rem;
    text-align: center;
    margin-bottom: 2rem;
}

/* ===== FORM ===== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ===== INPUTS ===== */
.auth-page .form-control {
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: 0.5rem;
    color: var(--auth-text);
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    transition: border-color 0.15s ease;
}

.auth-page .form-control:focus {
    background: var(--auth-input-bg);
    border-color: var(--auth-input-focus);
    box-shadow: none;
    color: var(--auth-text);
    outline: none;
}

.auth-page .form-control::placeholder {
    color: var(--auth-text-muted);
}

.auth-page .form-control.is-invalid {
    border-color: var(--auth-error);
}

/* ===== LABELS ===== */
.auth-page .form-label {
    color: var(--auth-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* ===== BUTTON ===== */
.auth-page .btn-primary,
.auth-page .btn-brand {
    background: var(--auth-accent);
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-weight: 600;
    padding: 0.875rem 1.5rem;
    width: 100%;
    margin-top: 0.5rem;
    transition: opacity 0.15s ease;
}

.auth-page .btn-primary:hover,
.auth-page .btn-brand:hover {
    background: var(--auth-accent);
    opacity: 0.9;
    color: white;
}

.auth-page .btn-primary:active,
.auth-page .btn-brand:active {
    opacity: 0.8;
}

/* ===== LINKS ===== */
.auth-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--auth-card-border);
}

.auth-page a,
.auth-page .link-brand {
    color: var(--auth-text-secondary);
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-page a:hover,
.auth-page .link-brand:hover {
    color: var(--auth-text);
}

/* ===== CHECKBOX ===== */
.auth-page .form-check {
    margin-top: 0.5rem;
}

.auth-page .form-check-input {
    background-color: var(--auth-input-bg);
    border-color: var(--auth-input-border);
}

.auth-page .form-check-input:checked {
    background-color: var(--auth-accent);
    border-color: var(--auth-accent);
}

.auth-page .form-check-label {
    color: var(--auth-text-secondary);
    font-size: 0.875rem;
}

/* ===== TOAST MESSAGES (server-side feedback: login errors, etc.) ===== */
.auth-page .auth-messages {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1055;
    width: min(92vw, 420px);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.auth-page .auth-message-alert {
    margin-bottom: 0;
    pointer-events: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
    animation: auth-toast-in 0.28s ease-out;
    transition: opacity 0.4s ease;
}

@keyframes auth-toast-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== ALERTS ===== */
.auth-page .alert {
    border-radius: 0.5rem;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.auth-page .alert-danger {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: var(--auth-error);
}

.auth-page .alert-success {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.2);
    color: var(--auth-success);
}

/* ===== VALIDATION =====
   custom.css:345 globally forces `.invalid-feedback { display: block }`,
   which makes the fallback text visible on page load. Re-instate the
   Bootstrap-default hidden state within .auth-page and only reveal the
   feedback when the sibling input has .is-invalid (added by our submit
   handler in base_auth.html). Higher specificity wins over custom.css. */
.auth-page .invalid-feedback {
    display: none;
    color: var(--auth-error);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.auth-page .form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

/* ===== HELPER TEXT ===== */
.auth-page small {
    color: var(--auth-text-muted);
    font-size: 0.8rem;
}

/* ===== DIVIDER ===== */
.auth-page .auth-divider {
    border-color: var(--auth-card-border);
}

/* ===== FEATURES (minimal tags) ===== */
.auth-features {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--auth-card-border);
}

.auth-features span {
    color: var(--auth-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-features span::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 4px;
    background: var(--auth-accent);
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* ===== TWO COLUMN INPUTS ===== */
.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 480px) {
    .auth-row {
        grid-template-columns: 1fr;
    }
}

/* ===== LOCK SCREEN ===== */
.lock-screen-container {
    background: var(--auth-card-bg);
    border: 1px solid var(--auth-card-border);
    border-radius: 1rem;
    max-width: 400px;
    width: 100%;
}

.lock-screen-container .avatar-placeholder {
    background: var(--auth-accent);
    font-weight: 600;
}

/* ===== PAIR PAGES ===== */

/* Device info display */
.auth-device-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--auth-input-bg);
    border-radius: 0.5rem;
}

.auth-device-code {
    font-family: monospace;
    font-size: 1rem;
    color: var(--auth-text);
    letter-spacing: 0.1em;
}

.auth-device-ip {
    font-size: 0.75rem;
    color: var(--auth-text-muted);
}

/* Permissions list */
.auth-permissions {
    margin-bottom: 1.5rem;
    text-align: left;
}

.auth-permissions-label {
    display: block;
    font-size: 0.8rem;
    color: var(--auth-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.auth-permissions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.auth-permissions li {
    padding: 0.5rem 0;
    color: var(--auth-text-secondary);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--auth-card-border);
}

.auth-permissions li:last-child {
    border-bottom: none;
}

.auth-permissions li::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--auth-accent);
    border-radius: 50%;
    margin-right: 0.75rem;
    vertical-align: middle;
}

/* Action buttons (two columns) */
.auth-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.auth-actions form {
    display: contents;
}

.btn-deny {
    background: transparent;
    border: 1px solid var(--auth-card-border);
    color: var(--auth-text-secondary);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn-deny:hover {
    border-color: var(--auth-error);
    color: var(--auth-error);
}

/* Inline action buttons */
.auth-actions-inline {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.auth-actions-inline .btn {
    flex: 1;
    max-width: 140px;
}

/* Secondary button */
.auth-page .btn-secondary {
    background: transparent;
    border: 1px solid var(--auth-card-border);
    color: var(--auth-text-secondary);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.auth-page .btn-secondary:hover {
    border-color: var(--auth-text-muted);
    color: var(--auth-text);
}

/* Footer note */
.auth-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--auth-text-muted);
    margin: 0;
}

/* Status icons */
.auth-status-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 1.5rem;
}

.auth-status-success {
    background: rgba(74, 222, 128, 0.1);
    color: var(--auth-success);
}

.auth-status-error {
    background: rgba(248, 113, 113, 0.1);
    color: var(--auth-error);
}

/* Info box */
.auth-info-box {
    background: var(--auth-input-bg);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.auth-info-box p {
    margin: 0;
    color: var(--auth-text-secondary);
    font-size: 0.875rem;
}

.auth-info-box .auth-info-detail {
    color: var(--auth-text-muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.auth-info-error {
    background: rgba(248, 113, 113, 0.05);
}

/* Help text */
.auth-help {
    margin-bottom: 1.5rem;
}

.auth-help p {
    color: var(--auth-text-muted);
    font-size: 0.875rem;
    margin: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .auth-page {
        padding: 1rem;
    }

    .auth-card {
        padding: 2rem 1.5rem;
    }

    .auth-links {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
}


/* ===== ONBOARDING WIZARD ===== */

/* Override auth-page background for onboarding */
body.auth-page:has(.onboarding-card) {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(54, 147, 255, 0.06), transparent 60%),
    linear-gradient(180deg, #0b1220 0%, #0f1b33 50%, #0b1220 100%);
  background-size: 100% 100%;
}

.onboarding-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  width: 100%;
  max-width: 560px;
  padding: 2.5rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Top-left brand */
.onboarding-brand {
  position: fixed;
  top: 1.5rem;
  left: 2rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 10;
}

.onboarding-brand img {
  width: 28px;
  height: 28px;
}

.onboarding-brand-name {
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}

.onboarding-brand-tagline {
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  border-left: 1px solid rgba(255,255,255,.15);
  padding-left: 0.6rem;
  background: linear-gradient(90deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 600;
}

/* Stepper indicator */
.onboarding-stepper {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin-bottom: 2rem;
}

.stepper-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 60px;
}

.stepper-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.15);
  background: transparent;
  color: var(--auth-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .25s ease;
}

.stepper-label {
  color: var(--auth-text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  transition: color .25s ease;
}

.stepper-item.active .stepper-dot {
  border-color: var(--auth-accent);
  background: var(--auth-accent);
  color: #fff;
}

.stepper-item.active .stepper-label {
  color: var(--auth-text);
}

.stepper-item.completed .stepper-dot {
  border-color: var(--auth-success);
  background: var(--auth-success);
  color: #fff;
}

.stepper-item.completed .stepper-label {
  color: var(--auth-success);
}

.stepper-line {
  flex: 1;
  height: 2px;
  background: rgba(255,255,255,.1);
  margin-top: 14px; /* center with dot */
  min-width: 30px;
  transition: background .25s ease;
}

.stepper-line.completed {
  background: var(--auth-success);
}

/* Skip link */
.onboarding-skip {
  text-align: center;
  margin-top: 1rem;
}

.onboarding-skip a {
  color: var(--auth-text-muted) !important;
  font-size: 0.8rem;
}

.onboarding-skip a:hover {
  color: var(--auth-text-secondary) !important;
}

/* Form fields */
.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ob-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ob-label {
  color: var(--auth-text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ob-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Option button group (trading style, risk tolerance) */
.option-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.option-btn {
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  border: 1px solid var(--auth-input-border);
  background: transparent;
  color: var(--auth-text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}

.option-btn:hover {
  border-color: var(--auth-accent);
  color: var(--auth-text);
}

.option-btn.active {
  background: var(--auth-accent);
  border-color: var(--auth-accent);
  color: #fff;
}

/* Avatar upload */
.ob-avatar-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.ob-avatar-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  overflow: hidden;
}

.ob-avatar-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--auth-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.ob-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.ob-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s ease;
}

.ob-avatar-overlay i {
  color: #fff;
  font-size: 1.25rem;
}

.ob-avatar-wrapper:hover .ob-avatar-overlay {
  opacity: 1;
}

.ob-avatar-hint {
  color: var(--auth-text-muted);
  font-size: 0.75rem;
}

/* Done icon */
.onboarding-done-icon {
  text-align: center;
  margin-bottom: 1rem;
}

.onboarding-done-icon i {
  font-size: 3.5rem;
  color: var(--auth-success);
}

/* Mobile */
@media (max-width: 575.98px) {
  .onboarding-brand {
    position: static;
    justify-content: center;
    margin-bottom: 1rem;
  }

  .onboarding-brand-tagline {
    display: none;
  }

  .onboarding-card {
    padding: 2rem 1.5rem;
    max-width: 100%;
  }

  .ob-row {
    grid-template-columns: 1fr;
  }

  .option-group {
    gap: 0.4rem;
  }

  .option-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }
}
