/* ============ Dchati — Plataforma (login) ============ */

:root {
  --accent-h: 195;
  --bg: oklch(0.15 0.03 250);
  --bg-raised: oklch(0.20 0.035 250);
  --ink: oklch(0.96 0.01 230);
  --ink-dim: oklch(0.72 0.02 240);
  --accent: oklch(0.80 0.14 var(--accent-h));
  --accent-strong: oklch(0.70 0.17 var(--accent-h));
  --accent-soft: oklch(0.80 0.14 var(--accent-h) / 0.12);
  --line: oklch(0.80 0.10 var(--accent-h) / 0.18);
  --line-quiet: oklch(0.60 0.02 250 / 0.25);
  --danger: oklch(0.70 0.17 25);
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --hue-shift: 0deg; /* used by JS during success transition */
}

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

html { height: 100%; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}

::selection { background: var(--accent-strong); color: var(--bg); }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; }

/* ---------- Shell / split layout ---------- */

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  min-height: 100vh;
}

/* ---------- Left: form side ---------- */

.pane-left {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  padding: 38px clamp(28px, 5vw, 72px) 40px;
  background:
    radial-gradient(120% 80% at -10% 0%, oklch(0.22 0.04 250 / 0.7), transparent 60%),
    var(--bg);
}

.brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: auto;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 23px;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.logo .dot { color: var(--accent); }

.back-link {
  font-size: 14px;
  color: var(--ink-dim);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 0.2s;
}

.back-link:hover { color: var(--ink); }

.form-region {
  width: 100%;
  max-width: 420px;
  margin: 40px 0;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 26px; height: 1px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: 12px;
}

.form-region h1 {
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 18px 0 14px;
}

.form-region .intro {
  color: var(--ink-dim);
  font-size: 17px;
  margin-bottom: 34px;
  max-width: 46ch;
}

/* ---------- Form ---------- */

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  margin-bottom: 8px;
}

.input-wrap { position: relative; }

.input-wrap input {
  width: 100%;
  background: oklch(0.18 0.03 250);
  border: 1px solid var(--line-quiet);
  border-radius: 12px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 14px 16px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.input-wrap input::placeholder { color: oklch(0.52 0.02 240); }

.input-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  background: oklch(0.19 0.03 250);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.input-wrap input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px oklch(0.70 0.17 25 / 0.12);
}

.input-wrap.has-toggle input { padding-right: 52px; }

.toggle-pw {
  position: absolute;
  top: 50%; right: 8px;
  transform: translateY(-50%);
  width: 38px; height: 38px;
  border: none;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  border-radius: 9px;
  display: grid;
  place-items: center;
  transition: color 0.2s, background 0.2s;
}

.toggle-pw:hover { color: var(--ink); background: var(--accent-soft); }

.field-error {
  display: block;
  min-height: 0;
  color: var(--danger);
  font-size: 13px;
  margin-top: 7px;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.2s, transform 0.2s;
}

.field-error.show { opacity: 1; transform: translateY(0); }

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 6px 0 26px;
  font-size: 14.5px;
}

.remember {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-dim);
  cursor: pointer;
  user-select: none;
}

.remember input { width: 17px; height: 17px; accent-color: var(--accent-strong); cursor: pointer; }

.link-quiet {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.link-quiet:hover { text-decoration: underline; }

/* ---------- Submit button ---------- */

.btn-submit {
  width: 100%;
  position: relative;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16.5px;
  color: oklch(0.14 0.03 250);
  background: var(--accent-strong);
  border: none;
  border-radius: 12px;
  padding: 15px 24px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 34px oklch(0.70 0.17 var(--accent-h) / 0.4);
}

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

.btn-submit:disabled { cursor: default; opacity: 0.9; }

.btn-submit .label-default { transition: opacity 0.2s; }

.btn-submit.loading .label-default { opacity: 0; }

.spinner {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px; height: 22px;
  border: 2.5px solid oklch(0.14 0.03 250 / 0.35);
  border-top-color: oklch(0.14 0.03 250);
  border-radius: 50%;
  opacity: 0;
  animation: spin 0.7s linear infinite;
}

.btn-submit.loading .spinner { opacity: 1; }

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

/* form-level error */
.form-alert {
  display: none;
  align-items: center;
  gap: 10px;
  background: oklch(0.70 0.17 25 / 0.10);
  border: 1px solid oklch(0.70 0.17 25 / 0.4);
  color: oklch(0.86 0.08 25);
  font-size: 14px;
  border-radius: 11px;
  padding: 12px 15px;
  margin-bottom: 20px;
}

.form-alert.show { display: flex; animation: riseIn 0.3s ease both; }

.pane-foot {
  margin-top: auto;
  font-size: 13px;
  color: var(--ink-dim);
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.pane-foot a { color: var(--ink-dim); text-decoration: none; }
.pane-foot a:hover { color: var(--ink); }

/* ---------- Right: visual side ---------- */

.pane-right {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(90% 90% at 70% 30%, oklch(0.22 0.05 calc(250 + var(--hue-shift)) / 0.55), transparent 70%),
    radial-gradient(80% 80% at 30% 90%, oklch(0.20 0.05 calc(290 + var(--hue-shift)) / 0.4), transparent 70%),
    oklch(0.13 0.03 250);
  border-left: 1px solid var(--line-quiet);
  transition: background 0.8s ease;
}

#core-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.visual-copy {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  padding: 0 clamp(32px, 5vw, 64px) clamp(40px, 6vh, 64px);
  pointer-events: none;
}

.visual-copy .vc-eyebrow {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.visual-copy h2 {
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 18ch;
  margin-bottom: 10px;
}

.visual-copy p { color: var(--ink-dim); font-size: 16px; max-width: 40ch; }

.vc-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.vc-chip {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid var(--line);
  background: oklch(0.80 0.14 var(--accent-h) / 0.08);
  border-radius: 999px;
  padding: 6px 14px;
  backdrop-filter: blur(4px);
}

/* ---------- Success overlay ---------- */

.success {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  background: oklch(0.12 0.025 250 / 0.78);
  backdrop-filter: blur(14px);
}

.success.show { display: grid; animation: fadeIn 0.4s ease both; }

.success-card {
  text-align: center;
  width: min(440px, 90vw);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 46px 40px 40px;
  box-shadow: 0 40px 100px oklch(0.05 0.02 250 / 0.7);
  animation: riseIn 0.5s 0.05s ease both;
}

.success-badge {
  width: 78px; height: 78px;
  border-radius: 20px;
  margin: 0 auto 24px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  color: oklch(0.14 0.03 250);
  position: relative;
  animation: badgePop 0.5s 0.15s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

.success-badge::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 26px;
  border: 1.5px solid currentColor;
  opacity: 0.3;
  color: var(--accent);
  animation: ring 1.6s ease-out infinite;
}

@keyframes ring {
  0% { transform: scale(0.9); opacity: 0.4; }
  100% { transform: scale(1.35); opacity: 0; }
}

@keyframes badgePop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.success-card .status-line {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.success-card h2 { font-size: 26px; margin-bottom: 8px; }
.success-card p { color: var(--ink-dim); font-size: 15.5px; margin-bottom: 8px; }

.dest {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13.5px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 14px;
  display: inline-block;
  margin: 14px 0 26px;
}

.success-progress {
  height: 4px;
  background: oklch(0.28 0.03 250);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 26px;
}

.success-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent-strong);
  border-radius: 999px;
  transition: width 0.1s linear;
}

.btn-enter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: oklch(0.14 0.03 250);
  background: var(--accent-strong);
  border: none;
  border-radius: 11px;
  padding: 13px 26px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
}

.btn-enter:hover { transform: translateY(-2px); box-shadow: 0 10px 30px oklch(0.70 0.17 var(--accent-h) / 0.4); }

/* ---------- Animations ---------- */

@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.enter-stagger > * { animation: riseIn 0.6s ease both; }
.enter-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.enter-stagger > *:nth-child(2) { animation-delay: 0.12s; }
.enter-stagger > *:nth-child(3) { animation-delay: 0.19s; }
.enter-stagger > *:nth-child(4) { animation-delay: 0.26s; }
.enter-stagger > *:nth-child(5) { animation-delay: 0.33s; }
.enter-stagger > *:nth-child(6) { animation-delay: 0.40s; }
.enter-stagger > *:nth-child(7) { animation-delay: 0.47s; }

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .pane-right {
    order: -1;
    min-height: 340px;
    border-left: none;
    border-bottom: 1px solid var(--line-quiet);
  }
  .visual-copy { display: none; }
  .pane-left { padding-top: 30px; }
  .form-region { margin: 26px auto; }
  .brandbar { margin-bottom: 24px; }
  .pane-foot { margin-top: 34px; }
}

@media (max-width: 520px) {
  .pane-right { min-height: 280px; }
  body { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.05s !important; }
}
