/* =========================================
   1. VARIABLES Y TEMA (Paleta REAL Banco Sabadell - AZUL)
   ========================================= */
:root {
  /* Azul Brillante Sabadell (Color principal de marca y botones) */
  --color-primary: #006DFF; 
  --color-primary-dark: #0056CC; /* Azul más oscuro para hover */
  
  /* Azul Oscuro Corporativo Sabadell (Textos principales, header, footer) */
  --color-secondary: #003366; 
  
  /* Fondos y Superficies */
  --color-bg: #FFFFFF;
  --color-bg-alt: #F0F4F8; /* Azul muy pálido, casi blanco, típico de Sabadell */
  
  /* Textos */
  --color-text: #1A1A1A; /* Gris muy oscuro, casi negro, para máximo contraste */
  --color-text-muted: #5A6B7C; /* Gris azulado para textos secundarios */
  
  /* Bordes y Estados */
  --color-border: #D1D9E0;
  --color-success: #00A35E; /* Verde para aprobaciones/éxito en Sabadell */
  --color-error: #D32F2F;
  
  /* Sombras y Efectos */
  --shadow: 0 4px 12px rgba(0, 51, 102, 0.08); /* Sombra con tinte azul oscuro */
  --radius: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --max-width: 1200px;
}

/* Modo Oscuro (Ajustado para mantener la identidad azul Sabadell) */
[data-theme="dark"] {
  --color-bg: #0A1E3F; /* Azul marino muy oscuro de fondo */
  --color-bg-alt: #132D54; /* Azul un poco más claro para tarjetas */
  --color-text: #FFFFFF;
  --color-text-muted: #B0C4DE;
  --color-border: #2A4A7F;
  --color-secondary: #FFFFFF; /* Texto blanco sobre fondos oscuros */
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* =========================================
   2. RESET Y ACCESIBILIDAD (WCAG AA)
   ========================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
}

/* Foco visible de ALTO CONTRASTE (Azul Sabadell sobre fondo) */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* =========================================
   3. COMPONENTES GLOBALES
   ========================================= */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.5rem; border-radius: var(--radius);
  background: var(--color-primary); color: #FFFFFF; border: none;
  font-weight: 700; cursor: pointer; transition: var(--transition);
  text-decoration: none; font-size: 1rem;
}
.btn:hover { 
  background: var(--color-primary-dark); 
  transform: translateY(-2px); 
  box-shadow: 0 4px 8px rgba(0, 109, 255, 0.3);
}

.btn-secondary { 
  background: var(--color-secondary); 
  color: #FFFFFF; 
}

/* Header & Navegación */
.site-header {
  background: var(--color-bg); 
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 100; 
  box-shadow: var(--shadow);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 70px;
}
.logo {
  display: flex; align-items: center; gap: 0.5rem; text-decoration: none;
  color: var(--color-secondary); font-weight: 800; font-size: 1.5rem;
}
/* El logo SVG ahora usará el azul Sabadell */
.logo svg { width: 32px; height: 32px; fill: var(--color-primary); }

.main-nav ul { display: flex; list-style: none; gap: 1rem; }
.nav-link {
  text-decoration: none; color: var(--color-text); font-weight: 600;
  padding: 0.5rem 0.75rem; border-radius: 4px; transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
  color: var(--color-primary); 
  background: rgba(0, 109, 255, 0.08); /* Fondo azul muy sutil al hover */
}

.theme-toggle, .mobile-menu-toggle {
  background: none; border: 1px solid var(--color-border); border-radius: 50%;
  cursor: pointer; padding: 0.5rem; color: var(--color-text); display: flex; align-items: center;
}
.mobile-menu-toggle { display: none; }

/* Banner Honesto (Ahora con tono azul informativo, no naranja) */
.honest-banner {
  background: #E6F0FF; border-left: 5px solid var(--color-primary);
  padding: 1.25rem; margin: 2rem 0; border-radius: var(--radius);
  display: flex; gap: 1rem; align-items: flex-start;
  color: #003366; font-size: 0.95rem;
}
[data-theme="dark"] .honest-banner { 
  background: #132D54; 
  color: #FFFFFF; 
  border-left-color: #4D94FF;
}
.honest-banner svg { flex-shrink: 0; width: 24px; height: 24px; fill: var(--color-primary); }

/* Grid y Tarjetas */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 2rem; margin: 2rem 0; }
.card {
  background: var(--color-bg-alt); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 1.5rem; transition: var(--transition);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card h3 { color: var(--color-primary); margin-bottom: 0.75rem; }

/* Footer */
.site-footer { 
  background: var(--color-secondary); 
  color: #FFFFFF; 
  padding: 3rem 0; margin-top: 4rem; 
}
[data-theme="dark"] .site-footer { background: #051021; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; }
.footer-link { color: #B0C4DE; text-decoration: none; display: block; margin-bottom: 0.5rem; transition: var(--transition); }
.footer-link:hover { color: #FFFFFF; }

/* Simulador y Chatbot */
.simulator-box { 
  background: var(--color-bg-alt); 
  padding: 2rem; 
  border-radius: var(--radius); 
  border: 1px solid var(--color-border); 
}
.range-slider { 
  width: 100%; 
  margin: 1rem 0; 
  accent-color: var(--color-primary); /* El slider será azul Sabadell */
}
.result-display { 
  font-size: 1.5rem; 
  font-weight: 800; 
  color: var(--color-primary); 
  margin: 1rem 0; 
}

.chatbot-container { position: fixed; bottom: 20px; right: 20px; z-index: 90; }
.chatbot-toggle { 
  width: 60px; height: 60px; border-radius: 50%; 
  background: var(--color-primary); color: white; border: none; 
  cursor: pointer; box-shadow: var(--shadow); 
  display: flex; align-items: center; justify-content: center; 
}
.chatbot-window {
  position: absolute; bottom: 80px; right: 0; width: 320px; height: 400px;
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow); display: none; flex-direction: column;
}
.chatbot-window.open { display: flex; }
.chat-header { 
  background: var(--color-secondary); color: white; padding: 1rem; 
  border-radius: var(--radius) var(--radius) 0 0; font-weight: 700; 
}
.chat-body { flex: 1; padding: 1rem; overflow-y: auto; font-size: 0.9rem; }
.chat-input-area { padding: 1rem; border-top: 1px solid var(--color-border); display: flex; gap: 0.5rem; }
.chat-input { 
  flex: 1; padding: 0.5rem; border: 1px solid var(--color-border); 
  border-radius: 4px; background: var(--color-bg); color: var(--color-text); 
}

/* Responsive */
@media (max-width: 768px) {
  .mobile-menu-toggle { display: flex; }
  .main-nav {
    position: fixed; top: 70px; left: 0; right: 0; bottom: 0;
    background: var(--color-bg); padding: 2rem; transform: translateX(100%);
    transition: transform 0.3s ease-in-out; z-index: 99;
  }
  .main-nav.open { transform: translateX(0); }
  .main-nav ul { flex-direction: column; gap: 1.5rem; }
  .nav-link { font-size: 1.25rem; display: block; padding: 1rem; }
}