/* ── Variables ─────────────────────────────── */
:root {
  --bg:       #080c12;
  --surface:  #0e1520;
  --surface2: #131d2b;
  --border:   rgba(82, 160, 255, 0.12);
  --border2:  rgba(82, 160, 255, 0.22);
  --accent:   #4fa3ff;
  --accent2:  #7dbfff;
  --danger:   #ff4d5a;
  --text:     #c8ddf4;
  --text2:    #6e8faf;
  --text3:    #344d66;
  --mono:     'JetBrains Mono', monospace;
  --display:  'Syne', sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--display);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Canvas de fondo ────────────────────────── */
#grid-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
}

/* ── Scene wrapper ──────────────────────────── */
.scene {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  gap: 0;
}

/* ── Header / Logo ──────────────────────────── */
.header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
  animation: fadeUp 0.6s ease both;
}

.logo-mark {
  filter: drop-shadow(0 0 12px rgba(79,163,255,0.4));
}

.logo-name {
  display: block;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .18em;
  color: #fff;
  line-height: 1;
}

.logo-sub {
  display: block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .3em;
  color: var(--accent);
  margin-top: 3px;
  font-family: var(--mono);
}

/* ── Card principal ─────────────────────────── */
.card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 40px 36px 32px;
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.7s 0.1s ease both;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 40px 80px rgba(0,0,0,0.6),
    0 0 100px rgba(79,163,255,0.06);
}

/* Línea de acento superior */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
  opacity: 0.6;
}

/* Resplandor de fondo sutil */
.card::after {
  content: '';
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 300px; height: 200px;
  background: radial-gradient(ellipse, rgba(79,163,255,0.07) 0%, transparent 70%);
  pointer-events: none;
}

/* ── Card top ───────────────────────────────── */
.card-top {
  margin-bottom: 32px;
}

.card-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .25em;
  color: var(--accent);
  font-family: var(--mono);
  margin-bottom: 10px;
  opacity: 0.8;
}

.card-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
  letter-spacing: -.02em;
  margin-bottom: 10px;
}

.card-title em {
  font-style: normal;
  color: var(--accent2);
  text-shadow: 0 0 30px rgba(79,163,255,0.35);
}

.card-desc {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.65;
  font-family: var(--mono);
  font-weight: 400;
}

/* ── Form ───────────────────────────────────── */
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Campo ──────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s;
}

.field.shake {
  animation: shake 0.45s cubic-bezier(.36,.07,.19,.97);
}

.field-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .2em;
  color: var(--text3);
  font-family: var(--mono);
}

.field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 14px;
  color: var(--text3);
  width: 17px;
  height: 17px;
  pointer-events: none;
  transition: color 0.2s;
}

.field-input {
  width: 100%;
  padding: 13px 44px 13px 44px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: .04em;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  -webkit-text-fill-color: var(--text);
}

.field-input::placeholder {
  color: var(--text3);
  letter-spacing: .04em;
}

.field-input:focus {
  border-color: var(--accent);
  background: rgba(79,163,255,0.05);
  box-shadow: 0 0 0 3px rgba(79,163,255,0.12);
}

.field-input:focus ~ .field-icon,
.field-wrap:focus-within .field-icon {
  color: var(--accent);
}

/* Autofill override */
.field-input:-webkit-autofill,
.field-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 100px var(--surface2) inset;
  -webkit-text-fill-color: var(--text);
}

/* ── Ojo de contraseña ──────────────────────── */
.eye-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.eye-btn:hover { color: var(--accent2); }

/* ── Error box ──────────────────────────────── */
.error-box {
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(255,77,90,0.08);
  border: 1px solid rgba(255,77,90,0.25);
  border-radius: 8px;
  padding: 10px 14px;
  color: #ff7d87;
  font-size: 12px;
  font-family: var(--mono);
  animation: fadeIn 0.25s ease;
}

.error-box.show { display: flex; }

/* ── Botón conectar ─────────────────────────── */
.btn-connect {
  position: relative;
  width: 100%;
  padding: 15px 24px;
  margin-top: 4px;
  background: linear-gradient(135deg, #1a5fc8 0%, #2f7fff 50%, #4fa3ff 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--display);
  letter-spacing: .04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 8px 28px rgba(47,127,255,0.4);
}

.btn-connect:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(47,127,255,0.5);
}

.btn-connect:active { transform: translateY(0); }

.btn-connect:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-arrow {
  font-size: 18px;
  transition: transform 0.2s;
}

.btn-connect:hover .btn-arrow {
  transform: translateX(4px);
}

/* Sweep de carga */
.btn-connect.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  animation: sweep 1s ease infinite;
}

.btn-glow {
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.08));
  pointer-events: none;
}

/* ── Card footer ────────────────────────────── */
.card-footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text3);
  font-family: var(--mono);
  letter-spacing: .06em;
}

.footer-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text3);
  opacity: 0.5;
}

/* ── Pantalla de éxito ──────────────────────── */
.success-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 50px 36px 42px;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
  animation: fadeUp 0.5s ease both;
}

.success-screen.active { display: flex; }

.success-icon {
  filter: drop-shadow(0 0 20px rgba(79,163,255,0.5));
  margin-bottom: 22px;
  animation: pop 0.5s cubic-bezier(.34,1.56,.64,1);
}

.success-title {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.02em;
  margin-bottom: 10px;
}

.success-sub {
  font-size: 14px;
  color: var(--text2);
  font-family: var(--mono);
  line-height: 1.7;
  margin-bottom: 24px;
}

.success-sub strong { color: var(--accent2); }

.progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.07);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(to right, var(--accent), var(--accent2));
  border-radius: 2px;
  transition: width 3s linear;
}

/* ── Animaciones ────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  15%      { transform: translateX(-7px); }
  30%      { transform: translateX(7px); }
  45%      { transform: translateX(-5px); }
  60%      { transform: translateX(5px); }
  75%      { transform: translateX(-3px); }
  90%      { transform: translateX(3px); }
}

@keyframes sweep {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

@keyframes pop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 480px) {
  .card, .success-screen { padding: 32px 22px 28px; border-radius: 16px; }
  .card-title { font-size: 24px; }
}
