/* ========================================= */
/* ===== AUTH SYSTEM - REDISEÑO ELEGANTE ===== */
/* ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  --font: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;

  /* PALETA FLOTA (ROJO) */
  --red-700: #8A0D21; /* Rojo oscuro para panel */
  --red-600: #A60F26; /* Hover de botón */
  --red-500: #C8102E; /* Principal para botón */
  --red-400: #E03142;
  --red-300: #F05965;

  /* NEUTROS */
  --ink-900: #111827; /* Texto principal */
  --ink-700: #374151;
  --ink-600: #4B5563;
  --muted: #6B7280;   /* Texto secundario */
  --bg: #F3F4F6;      /* Fondo de inputs */
  --border: #E5E7EB; /* Borde sutil */
  --white: #fff;

  /* SISTEMA */
  --success: #0E7A3E;
  --success-bg: #E9FBEE;
  --error: #9B1C1C;
  --error-bg: #FFE9EA;

  /* MÉTRICAS */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 24px rgba(0, 0, 0, .08);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, .12);
}

/* ===== Base ===== */
* {
  box-sizing: border-box;
}
html, body {
  height: 100%;
}
body {
  /* CAMBIO: Eliminado el padding y flex-box para centrar */
  margin: 0;
  padding: 0; 
  font-family: var(--font);
  color: var(--ink-900);
  background-color: #F9FAFB;
}

/* ===== Layout Principal ===== */
.auth-wrapper {
  width: 100%;
  /* CAMBIO: Altura 100% del viewport */
  height: 100vh; 
  background: var(--white);
  display: flex;
  overflow: hidden;
  transition: all 0.3s ease;
  /* CAMBIO: Eliminado max-width, radius y shadow */
}

/* ===== Panel de Marca (Izquierda) ===== */
.brand-panel {
  flex-basis: 42%;
  position: relative;
  color: var(--white);
  padding: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: var(--red-700);
}
.brand-logo {
  max-width: 120px;
  margin-bottom: 24px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .25));
}
.brand-panel h1 {
  margin: 0 0 12px 0;
  font-size: 28px;
  font-weight: 700;
}
.brand-panel .tagline {
  margin: 4px 0;
  opacity: .9;
  font-weight: 300;
  font-size: 16px;
  max-width: 300px;
}

/* Logo para móvil (oculto por defecto) */
/* Logo para móvil (oculto por defecto) */
.brand-logo-mobile {
  display: none; /* Oculto en desktop */
  max-width: 200px; /* <-- CAMBIO: Más grande */
  margin: 0 auto 32px; /* <-- CAMBIO: Más margen */
}

/* ===== Panel de Formulario (Derecha) ===== */
.form-panel {
  flex-basis: 58%;
  padding: 48px 64px; /* Más padding */
  background: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto;
}
.form-panel-header {
  text-align: center;
  margin-bottom: 32px;
}
.form-panel-header h2 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink-900);
}
.form-panel-header p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

/* ===== Alertas (Error/Success) ===== */
.alert {
  display: flex;
  align-items: flex-start;
  padding: 14px 16px;
  gap: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  margin-bottom: 20px;
  font-size: 15px;
}
.alert i {
  margin-top: 3px;
  font-size: 18px;
}
.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border-color: #F4C7CC;
}
.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: #C6F0D5;
}
.alert-success strong {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
}

/* ===== Formularios ===== */
.auth-form .form-group {
  margin-bottom: 20px;
}
.auth-form label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink-700);
}

/* --- Inputs Rediseñados --- */
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"],
.auth-form input[type="tel"] {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink-900);
  transition: border-color .2s, box-shadow .2s;
  font-size: 15px;
  font-family: var(--font);
}
.auth-form input:focus {
  outline: 0;
  border-color: var(--red-500);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, .15);
}

/* --- Inputs con Íconos --- */
.input-with-icon {
  position: relative;
}
.input-with-icon i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 15px;
  transition: color .2s ease;
}
.input-with-icon input {
  padding-left: 48px !important;
}
.input-with-icon.focused i {
  color: var(--red-500);
}

/* --- Toggle de Contraseña --- */
.toggle-password {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  font-size: 16px;
}
.toggle-password:hover {
  color: var(--ink-900);
}

/* --- Opciones de Formulario (Recordar/Olvido) --- */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 14px;
}
.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
}
.remember-me input {
  margin: 0;
  cursor: pointer;
  width: 16px;
  height: 16px;
}
.remember-me label {
  margin: 0;
  font-weight: 500;
  color: var(--ink-700);
  cursor: pointer;
}
.form-options .link {
  color: var(--red-500);
  text-decoration: none;
  font-weight: 600;
}
.form-options .link:hover {
  text-decoration: underline;
}

/* ===== Botones Rediseñados ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 22px;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  color: var(--white);
  background-color: var(--red-500);
}
.btn-primary:hover {
  background-color: var(--red-600);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(200, 16, 46, .2);
}

.btn-secondary {
  color: var(--ink-700);
  background-color: var(--bg);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background-color: var(--border);
}

/* --- Estado de Carga del Botón --- */
.btn .btn-text,
.btn .btn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.btn .btn-loading {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
}
.btn.loading {
  cursor: not-allowed;
  background-color: var(--red-700);
}
.btn.loading .btn-text {
  display: none;
}
.btn.loading .btn-loading {
  display: flex;
}

/* ===== Footer y otros ===== */
.form-footer {
  margin-top: 32px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.form-footer p {
  margin: 4px 0; /* Espacio entre líneas del footer */
}
.system-info p {
  margin: 4px 0;
  font-size: 12px;
}
.form-actions {
  margin-top: 24px;
  text-align: center;
}
.form-actions .link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}
.form-actions .link:hover {
  color: var(--red-500);
  text-decoration: underline;
}

/* --- Indicador de Fuerza de Contraseña --- */
.password-strength {
  margin-top: 10px;
}
.strength-bar {
  width: 100%;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  transition: width 0.3s ease, background-color 0.3s ease;
}
.strength-text {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.password-weak { color: #E53E3E; }
.strength-fill.password-weak { background: #E53E3E; }
.password-medium { color: #DD6B20; }
.strength-fill.password-medium { background: #DD6B20; }
.password-strong { color: #38A169; }
.strength-fill.password-strong { background: #38A169; }

/* Otros elementos de páginas (reset, forgot) */
.password-requirements {
  margin-top: 24px;
  text-align: left;
  background: rgba(0,0,0,0.1);
  padding: 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.password-requirements h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
}
.password-requirements ul {
  margin: 0;
  padding-left: 20px;
}
.password-requirements li {
  margin-bottom: 6px;
}
.logout-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

/* ===== Responsive (Móvil) ===== */
/* CAMBIO: Eliminada la media query de 960px */

/* CAMBIO: Media query ajustada a 768px (tablets) */
@media (max-width: 768px) {
  .auth-wrapper {
    flex-direction: column;
    height: auto; /* Altura automática en móvil */
    min-height: 100vh;
  }
  
  .brand-panel {
    display: none; /* Ocultar panel rojo */
  }
  
  .form-panel {
    flex-basis: 100%;
    min-height: 100vh;
    padding: 40px 24px;
    justify-content: center;
  }

  .brand-logo-mobile {
    display: block; /* Mostrar logo de móvil */
  }

  .form-panel-header h2 {
    font-size: 24px;
  }
}

/* ======================================= */
/* ===== AÑADIDO: Overlay de Carga ===== */
/* ======================================= */

.loading-overlay {
  position: fixed;
  inset: 0; /* 0 0 0 0 */
  z-index: 9999;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* Oculto por defecto */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Estado activo (controlado por JS) */
.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  text-align: center;
  color: var(--white);
  font-size: 16px;
  font-weight: 500;
}
.loading-spinner p {
  margin-top: 12px;
}

/* Animación del spinner */
.loading-spinner .spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}