/* ── VARIABLES ───────────────────────────── */
:root {
  --primary: #021d33;
  --primary-mid: #0a2d4d;
  --accent: #0f6e9e;
  --bg: #f0f4f8;
  --card: #ffffff;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --danger: #dc2626;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-lg: 0 12px 40px rgba(2,29,51,.13), 0 4px 12px rgba(2,29,51,.07);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── TOP BAR ─────────────────────────────── */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 24px;
  z-index: 50;
  pointer-events: none;
}

.volver-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  pointer-events: auto;
}

.volver-btn svg { width: 15px; height: 15px; }

.volver-btn:hover {
  background: #fff;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

/* ── SPLIT LAYOUT ────────────────────────── */
.login-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* ── BRAND PANEL ─────────────────────────── */
.brand-panel {
  background: linear-gradient(145deg, var(--primary) 0%, #0a3a5c 60%, #0f5c8a 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px 56px;
  position: relative;
  overflow: hidden;
}

.brand-content { position: relative; z-index: 2; }

.brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.2);
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

.brand-title {
  margin: 0 0 12px;
  font-size: 36px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -.02em;
  line-height: 1.1;
}

.brand-sub {
  margin: 0 0 36px;
  font-size: 15px;
  color: rgba(255,255,255,.6);
  line-height: 1.6;
  max-width: 320px;
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: rgba(255,255,255,.8);
  font-weight: 500;
}

.feature-item svg {
  width: 16px;
  height: 16px;
  stroke: #38bdf8;
  flex-shrink: 0;
}

/* círculos decorativos */
.brand-circles { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

.circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}

.c1 { width: 360px; height: 360px; right: -120px; top: -100px; }
.c2 { width: 220px; height: 220px; right: 40px; bottom: -60px; background: rgba(255,255,255,.03); }
.c3 { width: 100px; height: 100px; left: 40px; bottom: 120px; background: rgba(255,255,255,.05); }

/* ── FORM PANEL ──────────────────────────── */
.form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 40px;
  background: var(--bg);
}

/* ── LOGIN CARD ──────────────────────────── */
.login-card {
  background: var(--card);
  width: 100%;
  max-width: 400px;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fadeUp .4s ease;
}

.login-card-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
}

.login-card-header h2 {
  margin: 0 0 5px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}

.login-card-header p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

form {
  padding: 24px 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── FIELDS ──────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 5px;
  display: block;
}

input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

input::placeholder { color: #b0bac7; }

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,110,158,.12);
}

/* password */
.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 44px; }

.toggle-pass {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  transition: color .2s;
}

.toggle-pass svg { width: 16px; height: 16px; display: block; }
.toggle-pass:hover { color: var(--primary); }

/* forgot */
.forgot-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -6px;
  margin-bottom: 8px;
}

.forgot-link {
  font-size: 12.5px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color .2s;
}

.forgot-link:hover { color: var(--primary); text-decoration: underline; }

/* ── SUBMIT BUTTON ───────────────────────── */
.btn-submit {
  position: relative;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .2s;
  margin-top: 4px;
  overflow: hidden;
}

.btn-submit:hover {
  background: #0a2d4d;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(2,29,51,.3);
}

.btn-submit:active { transform: translateY(0); }

.btn-submit.loading {
  pointer-events: none;
  opacity: .85;
}

.btn-submit.loading span { visibility: hidden; }

/* spinner */
.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.btn-submit.loading .spinner { display: block; }

/* ── ERROR ───────────────────────────────── */
.error {
  color: var(--danger);
  font-size: 12.5px;
  text-align: center;
  min-height: 18px;
  margin: 4px 0 0;
  font-weight: 500;
}

/* ── DIVIDER ─────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── REGISTER BUTTON ─────────────────────── */
.btn-register {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 11px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all .2s;
  margin-top: 10px;
}

.btn-register:hover {
  background: var(--bg);
  border-color: #94a3b8;
}

/* ── ANIMATIONS ──────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ── RESPONSIVE ──────────────────────────── */
@media (max-width: 768px) {
  .login-layout { grid-template-columns: 1fr; }

  .brand-panel {
    display: none; /* en mobile solo el form */
  }

  .form-panel {
    padding: 80px 20px 40px;
    align-items: flex-start;
    padding-top: 72px;
  }

  .login-card { max-width: 100%; }
}