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

/* ── Variables ──────────────────────────────────────────── */
:root {
  --blue          : #2563eb;
  --blue-hover    : #1d4ed8;
  --text-dark     : #111827;
  --text-muted    : #6b7280;
  --border        : #e5e7eb;
  --input-bg      : #f0f4ff;
  --radius        : 10px;
  --font          : 'Segoe UI', system-ui, sans-serif;
}

body {
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ── Layout split ───────────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  min-height: 100vh;
}

/* ── Panel izquierdo: formulario ────────────────────────── */
.panel-left {
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
}

/* ── Panel derecho: imagen ──────────────────────────────── */
.panel-right {
  position: relative;
  overflow: hidden;
}

.panel-right img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Logo ───────────────────────────────────────────────── */
.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.logo img {
  width: 240px;
  height: 240px;
  object-fit: contain;
}

.logo-name {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.02em;
}

/* ── Formulario ─────────────────────────────────────────── */
.form-box {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 32px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.06);
}

.form-box h2 {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.form-box .subtitle {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ── Campos ─────────────────────────────────────────────── */
.field {
  margin-bottom: 18px;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}

.field label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dark);
}

.field a {
  font-size: 0.82rem;
  color: var(--blue);
  text-decoration: none;
}

.field a:hover { text-decoration: underline; }

.input-wrap {
  position: relative;
}

.input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.input-wrap input {
  width: 100%;
  padding: 13px 14px 13px 42px;
  background: var(--input-bg);
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text-dark);
  outline: none;
  transition: border-color .2s;
}

.input-wrap input:focus {
  border-color: var(--blue);
  background: #fff;
}

.input-wrap input::placeholder { color: #9ca3af; }

/* ── Botones ─────────────────────────────────────────────── */
.btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  transition: background .2s, transform .1s;
}

.btn:active { transform: scale(0.99); }

.btn-primary {
  background: var(--blue);
  color: #fff;
  margin-top: 8px;
}

.btn-primary:hover { background: var(--blue-hover); }

.btn-secondary {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--blue);
  margin-top: 10px;
}

.btn-secondary:hover { background: #eff6ff; }

/* ── Divisor "¿Nuevo en CitaYa?" ────────────────────────── */
.divider {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 22px 0 0;
  text-transform: uppercase;
}

/* ── Footer del formulario ──────────────────────────────── */
.form-footer {
  margin-top: 28px;
  display: flex;
  justify-content: center;
  gap: 24px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.form-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.form-footer a:hover { color: var(--text-dark); }

/* ── Modal overlay ───────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 20px;
  padding: 36px 36px 32px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
  animation: modal-in .22s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--border);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background .15s;
}

.modal-close:hover { background: #e5e7eb; color: var(--text-dark); }
.modal-close svg   { width: 16px; height: 16px; }

.modal-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.modal-logo img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.modal h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 4px;
}

/* Grid 2 columnas dentro del modal */
.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

@media (max-width: 480px) {
  .modal-grid { grid-template-columns: 1fr; }
  .modal { padding: 28px 20px; }
}

/* ── Errores de campo ───────────────────────────────────── */
.field-error {
  display: block;
  font-size: 0.8rem;
  color: #dc2626;
  margin-top: 5px;
  min-height: 1em;
}

/* ── Alerta global ──────────────────────────────────────── */
.alerta {
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.alerta-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.alerta-ok {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

/* ── OTP timer ───────────────────────────────────────────── */
.otp-timer {
  text-align: center;
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: 10px 0 4px;
}

.otp-timer span {
  font-weight: 700;
  color: var(--blue);
}

/* ── Input OTP grande ────────────────────────────────────── */
#codigo {
  text-align: center;
  font-size: 1.6rem;
  letter-spacing: 0.3em;
  font-weight: 700;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .split { grid-template-columns: 1fr; }
  .panel-right { display: none; }
  .panel-left { padding: 32px 20px; }
}

/* ── index.html (splash screen) ─────────────────────── */
#splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  overflow: hidden;
  transition: transform .85s cubic-bezier(.77,0,.175,1);
  will-change: transform;
}
#splash.saliendo { transform: translateY(-100%); }
.splash-logo {
  width: 680px;
  height: 680px;
  object-fit: contain;
  margin-bottom: -110px;
  filter: drop-shadow(0 0 24px rgba(96,165,250,.45));
}
.splash-titulo {
  font-size: 2.6rem;
  font-weight: 900;
  color: #f8fafc;
  letter-spacing: -.03em;
  margin-bottom: 10px;
}
.splash-subtitulo {
  font-size: .95rem;
  color: #94a3b8;
  letter-spacing: .04em;
  margin-bottom: 56px;
}
#btn-splash-up {
  background: none;
  border: 2px solid rgba(148,163,184,.35);
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #94a3b8;
  transition: border-color .2s, color .2s, background .2s;
  animation: splash-bob 2s ease-in-out infinite;
}
#btn-splash-up:hover {
  border-color: #60a5fa;
  color: #60a5fa;
  background: rgba(96,165,250,.08);
}
#btn-splash-up svg { width: 26px; height: 26px; }
@keyframes splash-bob {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}
.splash-hint {
  font-size: .75rem;
  color: #475569;
  margin-top: 14px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE MÓVIL — main.css
   ══════════════════════════════════════════════════════════ */

/* Overlay sidebar (generado por JS) */
#sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 49; backdrop-filter: blur(2px);
  transition: opacity .25s;
}
#sidebar-overlay.active { display: block; }

/* Inputs: evitar zoom en iOS (≥16px) */
@media (max-width: 768px) {
  input, select, textarea { font-size: 16px !important; }
  .btn { min-height: 44px; }
}

/* 600px – tablet pequeña / móvil grande */
@media (max-width: 600px) {
  .panel-left  { padding: 24px 20px; }
  .form-box    { padding: 28px 20px; max-width: 100%; }
  .form-box h2 { font-size: 1.3rem; }

  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100% !important; width: 100%;
    border-radius: 20px 20px 0 0 !important;
    margin: 0 !important;
    padding: 24px 20px 32px !important;
    max-height: 92vh; overflow-y: auto;
  }
  .modal-header { margin-bottom: 12px; }
  .modal-footer { flex-direction: column; gap: 8px; }
  .modal-footer .btn { width: 100%; justify-content: center; }
  .modal-grid { grid-template-columns: 1fr !important; }
}

/* 480px – móvil estándar */
@media (max-width: 480px) {
  .split { grid-template-columns: 1fr !important; }
  .panel-right { display: none; }
  .panel-left  { min-height: 100dvh; justify-content: center; padding: 28px 16px; }
  .form-box    { padding: 24px 16px; box-shadow: none; border: none; }

  .alerta { font-size: .8rem; padding: 10px 12px; }
}

/* ── Splash: escalar para móvil ─────────────────────────── */
@media (max-width: 600px) {
  .splash-logo {
    width: clamp(220px, 72vw, 420px);
    height: clamp(220px, 72vw, 420px);
    margin-bottom: -60px;
  }
  .splash-subtitulo {
    font-size: .82rem;
    margin-bottom: 44px;
    text-align: center;
    padding: 0 24px;
  }
  #btn-splash-up { width: 50px; height: 50px; }
  #btn-splash-up svg { width: 22px; height: 22px; }
}

@media (max-width: 380px) {
  .splash-logo {
    width: clamp(180px, 78vw, 280px);
    height: clamp(180px, 78vw, 280px);
    margin-bottom: -40px;
  }
  .splash-subtitulo { font-size: .76rem; margin-bottom: 36px; }
}

/* ── Login form: mejoras móvil ──────────────────────────── */
@media (max-width: 600px) {
  .logo img { width: 160px; height: 160px; }
  .form-box h2 { font-size: 1.4rem; }
  .form-box .subtitle { font-size: .85rem; margin-bottom: 20px; }
  .input-wrap input { padding: 12px 14px 12px 42px; }
  .field { margin-bottom: 14px; }
  .form-footer { gap: 16px; font-size: .78rem; }
}

@media (max-width: 380px) {
  .panel-left { padding: 20px 14px; }
  .form-box { padding: 20px 14px; }
  .logo img { width: 130px; height: 130px; }
  .form-box h2 { font-size: 1.2rem; }
}
