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

:root {
  --bg: #f0f4f8;
  --card: #ffffff;
  --border: #e2e8f0;
  --accent: #0ea5e9;
  --accent2: #6366f1;
  --text: #0f172a;
  --muted: #64748b;
  --error: #ef4444;
  --success: #10b981;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  position: relative;
}

/* Fondo animado */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.08;
  animation: drift 8s ease-in-out infinite alternate;
  pointer-events: none;
}
.bg-glow.one { width: 500px; height: 500px; background: var(--accent); top: -100px; left: -100px; }
.bg-glow.two { width: 400px; height: 400px; background: var(--accent2); bottom: -100px; right: -100px; animation-delay: 3s; }

@keyframes drift {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(40px,30px) scale(1.1); }
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(14,165,233,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14,165,233,0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

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

/* ==================== LOGIN ==================== */
.wrapper {
  display: flex;
  width: 900px;
  max-width: 95vw;
  min-height: 560px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,0.1);
  animation: fadeUp 0.6s ease both;
  position: relative;
  z-index: 1;
}

/* Panel izquierdo */
.panel-left {
  flex: 1;
  background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
  padding: 60px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.panel-left::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.15), transparent 70%);
  bottom: -80px; left: -80px;
}

.logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 26px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.25);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.panel-hero h2 {
  font-family: 'Syne', sans-serif;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  color: #ffffff;
}

.panel-hero h2 span {
  color: #bfdbfe;
  -webkit-text-fill-color: #bfdbfe;
  background: none;
}

.panel-hero p {
  color: rgba(255,255,255,0.75);
  font-size: 15px;
  line-height: 1.7;
  max-width: 280px;
}

.features { display: flex; flex-direction: column; gap: 12px; }

.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.8);
  font-size: 14px;
}

.feature-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  flex-shrink: 0;
}

/* Panel derecho login */
.panel-right {
  width: 420px;
  background: var(--card);
  padding: 60px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ==================== REGISTRO ==================== */
.wrapper.registro {
  display: block;
  width: 520px;
  min-height: unset;
  background: var(--card);
  padding: 56px 52px;
  margin: 40px 0;
}

.wrapper.registro .logo {
  font-size: 22px;
  margin-bottom: 32px;
  color: var(--text);
}

.wrapper.registro .logo-icon {
  width: 32px; height: 32px;
  font-size: 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

/* ==================== FORMULARIOS ==================== */
.form-title {
  font-family: 'Syne', sans-serif;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.form-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.form-subtitle a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.input-wrap { position: relative; }

.input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  pointer-events: none;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 13px 13px 38px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.1);
}

input.error { border-color: var(--error); }
input::placeholder { color: #94a3b8; }

.field-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 5px;
  display: none;
}
.field-error.show { display: block; }

/* Medidor contraseña */
.password-strength { margin-top: 8px; display: none; }
.password-strength.show { display: block; }
.strength-bars { display: flex; gap: 4px; margin-bottom: 4px; }
.strength-bar {
  height: 4px; flex: 1;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s;
}
.strength-label { font-size: 11px; color: var(--muted); }

/* Toggle password */
.toggle-pass {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  padding: 0;
  transition: color 0.2s;
}
.toggle-pass:hover { color: var(--accent); }

/* Form options (login) */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  font-size: 13px;
}

.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--muted);
}

.checkbox-wrap input[type="checkbox"],
.terms input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  padding: 0;
}

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

/* Términos */
.terms {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.terms input { flex-shrink: 0; margin-top: 2px; }
.terms a { color: var(--accent); text-decoration: none; }

/* Botón primario */
.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 10px;
  color: #ffffff;
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.02em;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(14,165,233,0.3); }
.btn-primary:active { transform: translateY(0); }

/* Mensajes */
.error-msg {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--error);
  margin-bottom: 20px;
  display: none;
}
.error-msg.show { display: block; animation: shake 0.4s ease; }

.success-msg {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--success);
  margin-bottom: 20px;
  display: none;
  text-align: center;
}
.success-msg.show { display: block; animation: fadeUp 0.4s ease; }

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

/* Divisor */
.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* Botón secundario */
.btn-secondary {
  width: 100%;
  padding: 13px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  letter-spacing: 0.02em;
  margin-top: 4px;
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(14,165,233,0.05);
  transform: translateY(-1px);
}
.btn-secondary:active { transform: translateY(0); }

/* Responsive */
@media (max-width: 700px) {
  .panel-left { display: none; }
  .wrapper { width: 100%; min-height: 100vh; border-radius: 0; }
  .panel-right { width: 100%; padding: 48px 28px; }
  .wrapper.registro { padding: 40px 24px; margin: 0; border-radius: 0; width: 100%; }
  .form-row { grid-template-columns: 1fr; }
}