:root {
  --bg-color: #f3f4f6;
  --card-bg: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text-main: #111827;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --input-bg: #f9fafb;
  --brand-gradient: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

/* Tema Oscuro */
body[data-theme="dark"] {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --border-color: #374151;
  --input-bg: #0f172a;
  --brand-gradient: linear-gradient(135deg, #0f172a 0%, #312e81 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

.login-wrapper {
  display: flex;
  height: 100%;
  width: 100%;
}

/* --- LADO IZQUIERDO (BRAND) --- */
.brand-panel {
  display: none; /* Oculto en móvil */
  flex: 1.2;
  background: var(--brand-gradient);
  position: relative;
  color: white;
  padding: 4rem;
  flex-direction: column;
  justify-content: space-between; /* fallback */
}

/* Patrón de fondo sutil */
.brand-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: radial-gradient(rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.3;
}

.brand-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  /* IMPORTANT: ahora el footer se ancla abajo con margin-top:auto */
}

/* =========================================================
   NUEVO: BLOQUE SUPERIOR CENTRADO (logo + badge + textos)
   Mantiene brand-info + copyright abajo (sin moverse)
   ========================================================= */
.brand-header,
.brand-text {
  /* Por compatibilidad con tu HTML actual (sin wrapper extra) */
  align-self: center;
  text-align: center;
}

.brand-header {
  display: flex;
  flex-direction: column;       /* logo arriba, badge debajo */
  align-items: center;
  gap: 0.9rem;
  margin-top: auto;             /* empuja este bloque hacia el centro */
}

.brand-text {
  margin-top: 1.2rem;
  margin-bottom: auto;          /* balancea para centrar verticalmente */
}

/* SOLUCIÓN AL LOGO */
.brand-logo {
  max-height: 110px;            /* un poco más grande para protagonismo */
  width: auto;
  object-fit: contain;
  /* filter: brightness(0) invert(1); */
}

.badge-system {
  background: rgba(255,255,255,0.15);
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255,255,255,0.1);
}

.brand-text h1 {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(to right, #fff, #bfdbfe);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text .lead {
  font-size: 1.25rem;
  color: rgba(255,255,255,0.85);
  font-weight: 300;
  max-width: 520px;            /* más controlado que 80% */
  margin: 0 auto;              /* centrado */
}

/* --- BLOQUE INFERIOR (SE QUEDA ABAJO) --- */
.brand-info {
  margin-top: auto;             /* asegura que siga abajo */
  padding-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
}

.info-item i { color: #60a5fa; }

.copyright {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
}

/* --- LADO DERECHO (FORM) --- */
.form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  padding: 2rem;
}

.form-card {
  width: 100%;
  max-width: 450px;
  background: var(--card-bg);
  padding: 3rem;
  border-radius: 24px;
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.05);
}

.mobile-brand {
  display: none;
  text-align: center;
  margin-bottom: 1.5rem;
}
.mobile-brand img { height: 50px; }

.form-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2.5rem;
}

.form-group { margin-bottom: 1.5rem; }
.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.input-group { position: relative; }

.form-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.8rem;
  border: 2px solid var(--border-color);
  background: var(--input-bg);
  border-radius: 12px;
  font-size: 1rem;
  color: var(--text-main);
  transition: all 0.2s;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  background: var(--card-bg);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
  transition: color 0.2s;
}

/* Nota: tu HTML tiene el icon ANTES del input, así que este selector no aplica.
   Lo dejo por si cambias el orden en el futuro.
*/
.form-input:focus + .input-icon { color: var(--primary); }

.toggle-pass {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.form-extras {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.forgot-link {
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.btn-primary {
  width: 100%;
  padding: 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* RESPONSIVE */
@media (min-width: 1024px) {
  .brand-panel { display: flex; }
}

@media (max-width: 1023px) {
  .form-card {
    box-shadow: none;
    background: transparent;
    padding: 1rem;
  }
  .mobile-brand { display: block; }
  .login-wrapper { overflow-y: auto; }
}
