/* SPDX-License-Identifier: AGPL-3.0-or-later
 * SPDX-FileCopyrightText: 2026 Denis Gerolini <https://effimera.dev>
 * This file is part of Effimera — https://github.com/effimera-dev/effimera
 */
/* Effimera Auth Portal — Design System */

/* ─── Fonts (self-hosted, niente CDN — parità 1:1 con /web @fontsource) ─ */
@font-face {
  font-family: 'Space Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/static/fonts/space-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/static/fonts/space-mono-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Syne'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/static/fonts/syne-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Syne'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/static/fonts/syne-latin-700-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Syne'; font-style: normal; font-weight: 800; font-display: swap;
  src: url('/static/fonts/syne-latin-800-normal.woff2') format('woff2');
}

/* ─── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ─── Variables ─────────────────────────────────────────────────────── */
:root {
  --bg:     #07090b;
  --bg2:    #0c1018;
  --bg3:    #111921;
  --acc:    #00e5a0;
  --acc2:   rgba(0,229,160,0.11);
  --acc3:   rgba(0,229,160,0.22);
  --tx:     #e6e9ed;
  --mu:     #3d4f5c;
  --mu2:    #617080;
  --br:     rgba(255,255,255,0.055);
  --bra:    rgba(0,229,160,0.2);
  --brerr:  rgba(224,92,92,0.2);
  --bgErr:  rgba(224,92,92,0.08);
  --txErr:  #e05c5c;
  --bgOk:   rgba(0,229,160,0.07);
  --brok:   rgba(0,229,160,0.25);
  --txOk:   #00e5a0;
  --mono: 'Space Mono', monospace;
  --disp: 'Syne', sans-serif;
}

/* ─── Base ───────────────────────────────────────────────────────────── */
html { font-size: 14px; }

body {
  background: var(--bg);
  color: var(--tx);
  font-family: var(--mono);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--acc);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ─── Background FX ─────────────────────────────────────────────────── */
.gbg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(0,229,160,0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,160,0.016) 1px, transparent 1px);
  background-size: 60px 60px;
}

.glw {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 500px;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(0,229,160,0.04) 0%, transparent 65%);
}

/* ─── Navbar ─────────────────────────────────────────────────────────── */
nav {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--br);
  background: rgba(7,9,11,0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-box {
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--acc);
  border-radius: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  flex-shrink: 0;
}

.logo-box i {
  border-radius: 1px;
  background: var(--acc);
  display: block;
}
.logo-box i:nth-child(2),
.logo-box i:nth-child(3) { opacity: 0.3; }
.logo-box i:nth-child(4) { opacity: 0.1; }

.brand-name {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.15em;
  color: var(--tx);
}

.nav-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--mu2);
}

.pulse-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--acc);
  animation: pulse-dot 2.2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.15; }
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mu2);
  transition: color 0.2s;
}
.nav-links a:hover {
  color: var(--tx);
  text-decoration: none;
}

/* ─── Main layout ────────────────────────────────────────────────────── */
.page-main {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 57px - 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ─── Footer ─────────────────────────────────────────────────────────── */
.page-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 2rem;
  border-top: 1px solid var(--br);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--mu);
  text-transform: uppercase;
}

.footer-badges {
  display: flex;
  gap: 0.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--br);
  background: transparent;
  color: var(--mu2);
  font-size: 8px;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: 2px;
  text-transform: uppercase;
  font-family: var(--mono);
}

.badge.accent {
  border-color: var(--bra);
  background: var(--acc2);
  color: var(--acc);
}

/* ─── Form card ──────────────────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.form-card {
  background: var(--bg2);
  border: 1px solid var(--br);
  border-radius: 4px;
  padding: 1.6rem;
  width: 100%;
  max-width: 400px;
  animation: fade-up 0.5s ease forwards;
}

.eyebrow-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--bra);
  background: var(--acc2);
  color: var(--acc);
  font-size: 9px;
  letter-spacing: 0.15em;
  padding: 4px 13px;
  border-radius: 2px;
  text-transform: uppercase;
  font-family: var(--mono);
  margin-bottom: 1rem;
}

.form-title {
  font-family: var(--disp);
  font-size: 22px;
  font-weight: 800;
  color: var(--tx);
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.form-subtitle {
  font-size: 10px;
  color: var(--mu2);
  letter-spacing: 0.06em;
  margin-bottom: 1.4rem;
}

/* ─── Progress bar ───────────────────────────────────────────────────── */
.progress-bar {
  height: 3px;
  background: var(--br);
  border-radius: 1px;
  margin-bottom: 1.3rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--acc);
  border-radius: 1px;
  transition: width 0.4s ease;
}

/* ─── Field group ────────────────────────────────────────────────────── */
.field-group {
  margin-bottom: 1rem;
}

.field-group label {
  display: block;
  font-size: 9px;
  color: var(--mu2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  font-family: var(--mono);
}

.field-group input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--br);
  border-radius: 2px;
  padding: 10px 12px;
  color: var(--tx);
  font-family: var(--mono);
  font-size: 12px;
  transition: border-color 0.2s;
  outline: none;
}

.field-group input:focus {
  border-color: var(--bra);
}

.field-group input::placeholder {
  color: var(--mu);
}

.field-hint {
  display: block;
  font-size: 9px;
  color: var(--mu);
  letter-spacing: 0.04em;
  margin-top: 0.3rem;
  font-family: var(--mono);
}

.field-error {
  display: block;
  font-size: 9px;
  color: var(--txErr);
  letter-spacing: 0.04em;
  margin-top: 0.3rem;
  font-family: var(--mono);
}

/* ─── Buttons ────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--acc);
  color: #040e08;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 13px 36px;
  border: none;
  border-radius: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

.btn-primary:hover { opacity: 0.85; text-decoration: none; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--mu2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 11px 24px;
  border: 1px solid var(--br);
  border-radius: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: var(--bra);
  color: var(--tx);
  text-decoration: none;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--mu2);
  letter-spacing: 0.06em;
  font-family: var(--mono);
  margin-top: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
}
.btn-back:hover { color: var(--tx); text-decoration: none; }

.btn-link {
  display: inline-block;
  font-size: 10px;
  color: var(--mu2);
  letter-spacing: 0.06em;
  font-family: var(--mono);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
  padding: 0;
}
.btn-link:hover { color: var(--acc); text-decoration: underline; }

/* ─── Alert messages ─────────────────────────────────────────────────── */
.alert-error {
  background: var(--bgErr);
  border: 1px solid var(--brerr);
  border-radius: 2px;
  color: var(--txErr);
  font-size: 10px;
  padding: 8px 10px;
  margin-bottom: 0.8rem;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.alert-success {
  background: var(--bgOk);
  border: 1px solid var(--brok);
  border-radius: 2px;
  color: var(--txOk);
  font-size: 10px;
  padding: 8px 10px;
  margin-bottom: 0.8rem;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

/* ─── OTP row ────────────────────────────────────────────────────────── */
.otp-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 1rem 0;
}

.otp-row input {
  width: 42px;
  height: 52px;
  background: var(--bg3);
  border: 1px solid var(--br);
  border-radius: 2px;
  color: var(--tx);
  font-family: var(--disp);
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
  caret-color: var(--acc);
}

.otp-row input:focus {
  border-color: var(--bra);
}

/* ─── TOTP / QR setup ────────────────────────────────────────────────── */
.qr-wrapper {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

.qr-image {
  width: 160px;
  height: 160px;
  border-radius: 4px;
  background: #fff;
  padding: 8px;
  display: block;
}

.secret-display {
  background: var(--bg3);
  border: 1px solid var(--br);
  border-radius: 2px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--acc);
  letter-spacing: 0.12em;
  word-break: break-all;
  text-align: center;
  margin: 0.6rem 0;
  cursor: default;
}

/* ─── Backup codes ───────────────────────────────────────────────────── */
.codes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 1rem 0;
}

.code-item {
  background: var(--bg3);
  border: 1px solid var(--br);
  border-radius: 2px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--acc);
  letter-spacing: 0.1em;
  text-align: center;
}

.code-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
}

.code-actions .btn-secondary {
  flex: 1;
  padding: 9px 16px;
}

/* ─── Password strength ──────────────────────────────────────────────── */
.pw-bar {
  height: 3px;
  background: var(--br);
  border-radius: 1px;
  margin-top: 6px;
  overflow: hidden;
}

.pw-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 1px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.pw-strength-label {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--mu2);
  margin-top: 4px;
  font-family: var(--mono);
  text-transform: uppercase;
  display: block;
}

/* Password checklist */
.pw-checklist {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.pw-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
  color: var(--mu2);
  letter-spacing: 0.04em;
  font-family: var(--mono);
  transition: color 0.2s;
}

.pw-check-item.ok { color: var(--acc); }

.pw-check-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--mu);
  flex-shrink: 0;
  transition: background-color 0.2s;
}
.pw-check-item.ok .pw-check-dot { background: var(--acc); }

/* ─── Success page ───────────────────────────────────────────────────── */
.success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--bra);
  background: var(--acc2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.2rem;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 10px;
  font-family: var(--mono);
}

.summary-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--br);
  vertical-align: middle;
}

.summary-table td:first-child {
  color: var(--mu2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  width: 50%;
}

.summary-table td:last-child {
  color: var(--acc);
  letter-spacing: 0.04em;
}

.summary-table tr:last-child td { border-bottom: none; }

/* ─── Divider ─────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--br);
  margin: 1.2rem 0;
}

/* ─── Admin wrapper ───────────────────────────────────────────────────── */
.admin-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  nav { padding: 0.9rem 1rem; }
  .nav-links { display: none; }
  .nav-status { font-size: 9px; }
  .form-card { padding: 1.25rem; }
  .otp-row input { width: 36px; height: 42px; font-size: 16px; }
  .codes-grid { grid-template-columns: 1fr 1fr; }
  .page-footer { flex-direction: column; gap: 0.6rem; align-items: flex-start; }

  /* Touch targets */
  .btn-primary,
  .btn-secondary { min-height: 44px; }
  .otp-row input { min-height: 44px; }
  .field-group input { min-height: 44px; padding: 12px; }
}
