/* TDE Developer Portal — Auth CSS (terminal dark theme) */

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  --bg:          #0a0c0d;
  --bg-elev:     #121517;
  --bg-elev2:    #1a1e21;
  --border:      #272d31;
  --text:        #e8ebed;
  --text-dim:    #8f989f;
  --text-faint:  #5c656c;
  --accent:      #fb7c3d;
  --accent-text: #1f1006;
  --danger:      #ff6b6b;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  min-height: 100vh;
  margin: 0;
}

body.overlay-open { overflow: hidden; }

/* Bootstrap utility compat (used in auth.js) */
.d-none { display: none !important; }

/* ── Overlay base ────────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 11000;
}
.overlay.is-visible { display: flex; }

/* ── Sign-in overlay — full page with grid & radial glow ─────────────────── */
#auth-modal {
  background: radial-gradient(circle at 50% 22%, rgba(251,124,61,0.09), transparent 55%), var(--bg);
  overflow: hidden;
}

.auth-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.3;
  pointer-events: none;
}

.auth-center {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

/* ── Brand bar ───────────────────────────────────────────────────────────── */
.auth-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-faint);
}
.auth-brand-logo    { width: 20px; height: 20px; object-fit: contain; }
.auth-brand-name    { color: var(--text-dim); }
.auth-brand-sep     { color: var(--text-faint); }
.auth-brand-section { color: var(--text-faint); }

/* ── Auth card ───────────────────────────────────────────────────────────── */
.auth-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px 28px 26px;
  box-shadow: 0 24px 60px -28px rgba(0,0,0,0.6);
}

/* ── Terminal prompt ─────────────────────────────────────────────────────── */
.auth-prompt {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  color: var(--text-faint);
  margin-bottom: 18px;
}
.auth-prompt-dollar { color: var(--accent); }
.auth-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--accent);
  margin-left: 4px;
  vertical-align: -2px;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Auth headings ───────────────────────────────────────────────────────── */
.auth-heading {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.auth-subheading {
  margin: 0 0 24px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ── Form elements ───────────────────────────────────────────────────────── */
.auth-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}
.auth-input {
  display: block;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  font-size: 14px;
  padding: 11px 13px;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.auth-input:focus    { border-color: var(--accent); }
.auth-input:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Remember me ─────────────────────────────────────────────────────────── */
.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-dim);
}
.auth-remember input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

/* ── Submit button ───────────────────────────────────────────────────────── */
.auth-btn {
  display: block;
  width: 100%;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  padding: 12px;
  cursor: pointer;
  transition: filter 0.15s;
  font-family: inherit;
}
.auth-btn:hover:not(:disabled) { filter: brightness(1.08); }
.auth-btn:disabled              { opacity: 0.5; cursor: not-allowed; }

/* ── Footer links ────────────────────────────────────────────────────────── */
.auth-footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.auth-link {
  font-size: 12.5px;
  color: var(--text-faint);
  text-decoration: none;
  transition: color 0.15s;
}
.auth-link:hover { color: var(--text-dim); }

/* ── Status bar ──────────────────────────────────────────────────────────── */
.auth-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-faint);
  font-family: 'IBM Plex Mono', monospace;
}
.auth-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ── Disabled form state ─────────────────────────────────────────────────── */
#login-form.is-disabled { pointer-events: none; opacity: 0.7; }

/* ── Secondary overlays (forgot / reset / totp / change-pw / error) ─────── */
.overlay-secondary {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}
.auth-card-sm {
  width: 100%;
  max-width: 380px;
  margin: 1rem;
}
.auth-card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 20px;
}
.auth-card-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  margin-bottom: 10px;
}
.auth-card-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 4px;
}
.auth-card-subtitle {
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.5;
}

/* ── TOTP QR ─────────────────────────────────────────────────────────────── */
.totp-qr-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.totp-qr { max-width: 180px; border-radius: 8px; }

/* ── Error layout ────────────────────────────────────────────────────────── */
.error-layout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}
.error-icon { width: 36px; height: 36px; flex-shrink: 0; object-fit: contain; }
.error-text h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; color: var(--text); }
.error-text p  { font-size: 13.5px; color: var(--text-dim); margin: 0; }

/* ── Busy modal ──────────────────────────────────────────────────────────── */
#busy-modal {
  z-index: 12000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}
.busy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 40px;
}
.busy-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(251,124,61,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.busy-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-faint);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Platform header (only visible while transitioning post-auth) ─────────── */
.page-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  z-index: 1040;
}
body:not(.app-active) .page-header { display: none; }
.page-header-left  { display: flex; align-items: center; gap: 10px; }
.header-logo       { width: 28px; height: 28px; object-fit: contain; }
.header-title      { font-size: 14px; font-weight: 600; color: var(--text); }
.page-header-right { display: flex; align-items: center; gap: 12px; }
.user-name         { font-size: 13px; color: var(--text-dim); }
.logout-btn {
  font-size: 12px;
  color: var(--text-dim);
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}
.logout-btn:hover { color: var(--text); border-color: var(--text-dim); }

/* ── Page footer ─────────────────────────────────────────────────────────── */
.page-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 1030;
}
