/* ── LOGIN PAGE ─────────────────────────────────────── */

body.login-page {
  margin: 0;
  min-height: 100vh;
  /* dvh sigue a la barra de Safari cuando aparece y desaparece; 100vh sola
     mide de más en iOS y deja el contenido más abajo de lo que se ve. */
  min-height: 100dvh;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  color: var(--text);
  position: relative;
  /* Solo horizontal, para contener el blob decorativo que se sale por la
     derecha. En vertical NO se recorta: con overflow:hidden, apenas el
     contenido pasaba el alto de pantalla (celular chico, teclado abierto,
     desafío de Turnstile desplegado), el centrado mandaba el sobrante mitad
     arriba y mitad abajo, y lo de arriba —el logo— quedaba cortado y sin
     forma de scrollear hasta él. */
  overflow-x: hidden;
  /* En la app instalada no hay barra del navegador que reserve el notch. */
  padding: max(24px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

/* Decorative blob */
body.login-page::before {
  content: "";
  position: fixed;
  bottom: -80px;
  right: -80px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.22) 0%, rgba(139, 47, 201, 0.06) 60%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* Dark toggle */
.dark-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s, color 0.15s;
}
.dark-toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.dark-toggle i {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 15px;
  line-height: 1;
  pointer-events: none;
}

/* Wrapper */
.login-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Logo section */
.login-logo {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.login-logo img {
  height: 70px;
  width: auto;
  max-width: 400px;
  object-fit: contain;
}
.login-logo h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
}
.login-logo p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-2);
}

/* Card */
.login-card {
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: 16px;
  padding: 28px 28px 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Card header */
.card-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.security-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-hi);
}
.security-chip i {
  font-size: 12px;
}
.card-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h2 i {
  font-size: 1rem;
  color: var(--accent-hi);
}
.card-header > p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-2);
}

/* Error message */
.error-msg {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.20);
  border-radius: 10px;
  font-size: 13px;
  color: var(--danger);
  font-weight: 500;
}
.error-msg.show {
  display: flex;
  animation: errorIn 0.2s ease;
}
@keyframes errorIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Form */
#loginForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-2);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}
.input-icon-sm {
  font-size: 12px;
}
.input-wrapper input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  background: var(--field-bg) !important;
  border: 1px solid var(--field-border) !important;
  border-radius: 10px;
  color: var(--text) !important;
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  box-shadow: none !important;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.input-wrapper input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-soft) !important;
}
.input-wrapper input::placeholder {
  color: var(--text-muted);
}

.toggle-password {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  padding: 4px;
  transition: color 0.15s;
}
.toggle-password:hover {
  color: var(--text-2);
}

/* Helper row */
.login-helper-row {
  display: flex;
  justify-content: flex-end;
}
.login-helper-link {
  background: none;
  border: none;
  color: var(--accent-hi);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  font-family: var(--font);
  transition: color 0.15s;
}
.login-helper-link:hover {
  color: var(--accent);
}

/* Submit button */
.btn-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 20px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: 0 4px 16px var(--accent-glow);
  margin-top: 4px;
}
.btn-login:hover:not(:disabled) {
  background: var(--accent-hi);
  box-shadow: 0 6px 22px var(--accent-glow);
}
.btn-login:active:not(:disabled) {
  transform: scale(0.99);
}
.btn-login:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.btn-login.is-success {
  background: var(--success);
  box-shadow: none;
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Turnstile */
.turnstile-wrapper {
  display: none; /* se activa por JS solo si hay sitekey */
  justify-content: center;
  min-height: 65px;
}

/* Footer */
.login-footer {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.copy-line {
  font-size: 12px;
  color: var(--text-muted);
}
.links-line {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.links-line a {
  font-size: 12px;
  color: var(--accent-hi);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.15s;
}
.links-line a:hover {
  color: var(--accent);
}

/* ── nueva_password ────────────────────────────────────────────────
   Venía de un <style> embebido en views/nueva_password.html.
   ────────────────────────────────────────────────────────── */
.state-box {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    padding: 12px 0;
}
.state-box i { font-size: 2.2rem; }
.state-box p { margin: 0; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.state-box.show { display: flex; }
.state-error i { color: var(--danger, #ef4444); }
.state-success i { color: var(--success, #22c55e); }
.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: var(--accent-hi);
    text-decoration: none;
    transition: color .15s;
}
.back-link:hover { color: var(--accent); }
.password-strength {
    height: 3px;
    border-radius: 2px;
    background: var(--border-mid);
    margin-top: 4px;
    overflow: hidden;
}
.password-strength-bar {
    height: 100%;
    border-radius: 2px;
    width: 0;
    transition: width .3s, background .3s;
}
    

/* ── recuperar_password ────────────────────────────────────────────────
   Venía de un <style> embebido en views/recuperar_password.html.
   ────────────────────────────────────────────────────────── */
.turnstile-wrap {
    display: flex;
    justify-content: center;
    min-height: 65px;
}
.turnstile-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 13px;
}
.success-box {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    padding: 8px 0;
}
.success-box i { font-size: 2.5rem; color: var(--success, #22c55e); }
.success-box p { margin: 0; font-size: 14px; color: var(--text-2); line-height: 1.5; }
.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: var(--accent-hi);
    text-decoration: none;
    transition: color .15s;
}
.back-link:hover { color: var(--accent); }
    
