@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --verde:    #002a2b;
  --verde-m:  #2e7474;
  --terra:    #b2512b;
  --terra-l:  #d86d42;
  --cinza:    #5b595b;
  --cinza-l:  #e8e5e5;
  --areia:    #f3daba;
  --branco:   #ffffff;
  --font:     'Inter', sans-serif;
  --mono:     'Courier New', monospace;
}

html, body { height: 100%; background: var(--verde); font-family: var(--font); }

/* ═══════════════════════════════════════════
   LAYOUT DUAS COLUNAS
═══════════════════════════════════════════ */
.page {
  min-height: 100vh;
  display: flex;
}

/* ── Lado esquerdo — marca ── */
.brand-side {
  width: 42%;
  background: var(--verde);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 48px 52px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

/* Círculos decorativos */
.brand-side::before {
  content: '';
  position: absolute;
  top: -120px; right: -120px;
  width: 400px; height: 400px;
  border: 1px solid rgba(178,81,43,.2);
  pointer-events: none;
}
.brand-side::after {
  content: '';
  position: absolute;
  bottom: -160px; left: -80px;
  width: 420px; height: 420px;
  border: 1px solid rgba(46,116,116,.2);
  pointer-events: none;
}

.brand-deco {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 340px; height: 340px;
  border: 1px solid rgba(255,255,255,.04);
  pointer-events: none;
}

.brand-logo {
  position: relative; z-index: 1;
}
.brand-logo img {
  height: 56px;
  width: auto;
  filter: brightness(10);
}

.brand-tagline {
  position: relative; z-index: 1;
  margin-top: auto;
  margin-bottom: auto;
}
.brand-tagline h2 {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 16px;
}
.brand-tagline h2 span {
  color: var(--terra-l);
}
.brand-tagline p {
  font-size: 14px;
  color: rgba(255,255,255,.45);
  line-height: 1.7;
  max-width: 300px;
}

.brand-features {
  position: relative; z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.feature-dot {
  width: 32px; height: 32px;
  background: rgba(178,81,43,.2);
  border: 1px solid rgba(178,81,43,.3);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}
.feature-item span {
  font-size: 13px;
  color: rgba(255,255,255,.5);
}

/* ── Lado direito — formulário ── */
.form-side {
  flex: 1;
  background: #f6f4f0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
}

.card {
  width: 100%;
  max-width: 400px;
  background: var(--branco);
  border-radius: 6px;
  padding: 44px 40px;
  box-shadow: 0 8px 48px rgba(0,42,43,.1);
  animation: slideUp .5s cubic-bezier(.22,1,.36,1) both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header do card ── */
.card-header {
  margin-bottom: 28px;
}
.card-header .step-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(178,81,43,.1);
  color: var(--terra);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.card-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--verde);
  letter-spacing: -.4px;
  margin-bottom: 4px;
}
.card-header p {
  font-size: 13px;
  color: var(--cinza);
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--cinza-l);
  margin: 0 0 24px;
}

/* ── Alert ── */
.alert {
  display: none;
  padding: 11px 14px;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 16px;
  align-items: center;
  gap: 8px;
}
.alert.error {
  display: flex;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

/* ── Campos ── */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--cinza);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.input-wrap { position: relative; }
.input-wrap > svg {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: #b0adb0;
  pointer-events: none;
}
.input-wrap input {
  width: 100%;
  border: 1.5px solid var(--cinza-l);
  border-radius: 4px;
  padding: 12px 13px 12px 40px;
  font-size: 14px;
  font-family: var(--font);
  color: var(--verde);
  background: #fafaf8;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.input-wrap input::placeholder { color: #c5c2c5; }
.input-wrap input:focus {
  border-color: var(--terra);
  box-shadow: 0 0 0 3px rgba(178,81,43,.1);
  background: #fff;
}
.input-wrap input.error { border-color: #fca5a5; }

.toggle-pw {
  position: absolute;
  right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: #b0adb0; padding: 4px;
  display: flex; align-items: center;
  transition: color .2s;
}
.toggle-pw:hover { color: var(--cinza); }

.error-msg {
  display: none;
  font-size: 12px;
  color: #b91c1c;
  margin-top: 5px;
  align-items: center;
  gap: 4px;
}
.error-msg.show { display: flex; }

/* ── Botão principal ── */
.btn-login {
  width: 100%;
  padding: 13px;
  margin-top: 6px;
  background: var(--terra);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  letter-spacing: .02em;
  transition: background .2s, transform .1s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.btn-login:hover {
  background: #9e461f;
  box-shadow: 0 4px 20px rgba(178,81,43,.3);
  transform: translateY(-1px);
}
.btn-login:active  { transform: translateY(0); }
.btn-login:disabled { opacity: .65; cursor: not-allowed; transform: none; }

.btn-login .spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin: 0 auto;
}
.btn-login.loading .spinner  { display: block; }
.btn-login.loading .btn-text { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer ── */
.login-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 12px;
  color: #b0adb0;
}
.login-footer a {
  color: var(--terra);
  text-decoration: none;
  font-weight: 500;
}
.login-footer a:hover { text-decoration: underline; }

/* ── PASSO 2: TOTP ── */
#step2 { display: none; }

.totp-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.qr-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.qr-frame {
  width: 160px; height: 160px;
  border: 2px solid var(--cinza-l);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  position: relative;
}
.qr-frame img { width: 152px; height: 152px; display: block; }
.qr-loader {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,42,43,.06);
  border-radius: 10px;
}
.qr-loader svg { animation: spin .8s linear infinite; color: var(--terra); }
.qr-label { font-size: 10px; color: #b0adb0; text-align: center; line-height: 1.5; }

.code-side {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.code-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--cinza); margin-bottom: 10px; display: block;
  text-align: center;
}

.totp-inputs { display: flex; gap: 6px; margin-bottom: 12px; justify-content: center; width: 100%; }
.totp-digit {
  width: calc((100% - 30px) / 6); height: 52px; max-width: 48px;
  background: #fafaf8;
  border: 1.5px solid var(--cinza-l);
  border-radius: 9px;
  font-size: 20px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--verde);
  text-align: center;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.totp-digit:focus {
  border-color: var(--terra);
  box-shadow: 0 0 0 3px rgba(178,81,43,.1);
  background: #fff;
}
.totp-digit.filled  { border-color: rgba(178,81,43,.4); background: #fff; }
.totp-digit.shake   { animation: shake .3s ease; }
@keyframes shake {
  0%,100%{transform:translateX(0)}
  20%{transform:translateX(-5px)}
  60%{transform:translateX(5px)}
}

.totp-timer {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; color: #b0adb0;
  justify-content: center;
}
.timer-ring { width: 20px; height: 20px; }
.timer-ring svg { transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke: var(--cinza-l); stroke-width: 2.5; }
.timer-ring .progress {
  stroke: var(--verde-m);
  stroke-dasharray: 50.3;
  transition: stroke-dashoffset 1s linear, stroke .4s;
}
.timer-ring .progress.warn { stroke: #d97706; }
.timer-ring .progress.crit { stroke: #b91c1c; }
#timer-count { font-family: var(--mono); font-size: 12px; min-width: 26px; }

.back-link {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 12px; color: #b0adb0; cursor: pointer;
  margin-top: 14px; transition: color .2s; text-decoration: none;
}
.back-link:hover { color: var(--cinza); }

/* ── Responsivo ── */
@media (max-width: 768px) {
  .brand-side { display: none; }
  .form-side  { background: var(--verde); }
  .card       { box-shadow: none; }
}
