/* =========================================================
   ESTILOS GENERALES - BANORTE FINCORTEX VOICE
   ========================================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Arial", "Helvetica", sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  line-height: 1.5;
  letter-spacing: 0.3px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2.5rem;
}

/* =========================================================
   HEADER Y MENÚ RESPONSIVE CON ANIMACIÓN DESLIZABLE
   ========================================================= */

.header {
  background: #ec1c2e;
  color: #fff;
  padding: 0.9rem 0;
  border-bottom: 3px solid #b70b15;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-img {
  height: 42px;
  width: auto;
}

.logo-divider {
  font-size: 1.25rem;
  opacity: 0.5;
}

.logo-subtitle {
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 0.95rem;
}

/* INFO (desktop) */
.header-info {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.user-avatar {
  font-size: 2px;
  width: 38px;
  height: 38px;
  background: #000;
  border: 2px solid #fff;
  border-radius: 4px;
}

/* BOTÓN HAMBURGUESA */
.hamburger {
  display: none;
  position: relative;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.hamburger span {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 2px;
  background: #fff;
  transition: transform 0.3s ease, top 0.3s ease, opacity 0.2s;
}
.hamburger span:nth-child(1) {
  top: 12px;
}
.hamburger span:nth-child(2) {
  top: 20px;
}
.hamburger span:nth-child(3) {
  top: 28px;
}

.hamburger.is-active span:nth-child(1) {
  top: 20px;
  transform: rotate(45deg);
}
.hamburger.is-active span:nth-child(2) {
  opacity: 0;
}
.hamburger.is-active span:nth-child(3) {
  top: 20px;
  transform: rotate(-45deg);
}

/* PANEL LATERAL */
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: min(85vw, 360px);
  height: 100vh;
  background: #ec1c2e;
  color: #fff;
  transform: translateX(100%);
  transition: transform 0.35s ease;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  border-left: 3px solid #b70b15;
}
.mobile-menu.open {
  transform: translateX(0);
}

.mobile-menu__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}
.mobile-menu__title {
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.mobile-menu__content {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  gap: 1rem;
}
.mobile-menu__item {
  padding: 0.8rem 1rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 6px;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9998;
  backdrop-filter: blur(2px);
}

/* ============================= */
/* HEADER RESPONSIVO             */
/* ============================= */
@media (max-width: 768px) {
  .header-container {
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
  }
  .header-info {
    display: none;
  }
  .hamburger {
    display: inline-flex;
    justify-content: center;
    align-items: center;
  }
  .logo-section {
    gap: 0.4rem;
  }
  .logo-img {
    height: 38px;
  }
  .logo-subtitle {
    font-size: 0.85rem;
  }
}

/* =========================================================
   HERO CAROUSEL
   ========================================================= */
.hero {
  background: #2a2a2a;
  color: white;
  position: relative;
  overflow: hidden;
}

.hero-carousel {
  position: relative;
  height: 400px;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.6s ease;
}

.carousel-slide {
  min-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  border-bottom: 4px solid #e30613;
}

.hero-content {
  max-width: 1000px;
  text-align: center;
  padding: 0 2rem;
}

.hero-title {
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: 1.5rem;
  letter-spacing: 2px;
}

.hero-subtitle {
  font-size: 1.1rem;
  opacity: 0.85;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.carousel-indicators {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
}

.indicator {
  width: 50px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}
.indicator.active {
  background: #e30613;
}

/* =========================================================
   HERO CON IMÁGENES COMPLETAS Y TEXTO A LA IZQUIERDA
   ========================================================= */
.hero {
  position: relative;
  width: 100%;
  height: 100vh; /* ocupa todo el alto visible */
  min-height: 480px;
  overflow: hidden;
}

.hero-carousel {
  position: relative;
  width: 100%;
  height: 100%;
}

.hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center; /* centra vertical y horizontalmente */
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.hero-slide.active {
  opacity: 1;
  z-index: 2;
}

/* --- Texto cargado a la izquierda --- */
.hero-text {
  position: absolute;
  top: 50%;
  left: 7%;
  transform: translateY(-50%);
  color: #1a1a1a;
  max-width: 40%;
  z-index: 3;
  text-align: left;
  background: rgba(255, 255, 255, 0.8); /* mejora legibilidad sobre imagen */
  padding: 1.5rem 2rem;
  border-radius: 8px;
  backdrop-filter: blur(2px);
}

.hero-text h1 {
  font-size: 2.4rem;
  font-weight: 800;
  color: #ec1c2e;
  text-transform: uppercase;
  line-height: 1.2;
}

.hero-text p {
  margin-top: 1rem;
  font-size: 1.1rem;
  color: #333;
  line-height: 1.4;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .hero {
    height: 70vh;
  }

  .hero-text {
    max-width: 60%;
    padding: 1rem 1.5rem;
  }

  .hero-text h1 {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .hero {
    height: 65vh;
  }

  /* Centrado de la imagen hacia la derecha */
  .hero-slide {
    background-position: right center !important;
    background-size: cover;
  }

  /* Oculta el texto en móvil */
  .hero-text {
    display: none !important;
  }
}

/* =========================================================
   SECCIONES PRINCIPALES (KPIs, GRÁFICAS, SIMULADOR, CHAT)
   ========================================================= */
section {
  padding: 4rem 0;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 2.5rem;
  color: #1a1a1a;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-left: 4px solid #e30613;
  padding-left: 1rem;
}

/* KPIs */
.kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.kpi-card {
  background: white;
  padding: 2rem;
  border: 2px solid #e5e5e5;
  display: flex;
  gap: 1.5rem;
  transition: all 0.3s ease;
}
.kpi-card:hover {
  border-color: #e30613;
  box-shadow: 0 4px 0 #e30613;
}

/* =========================================================
   GRÁFICAS Y SIMULADOR WHAT-IF
   ========================================================= */

.predictions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 2rem;
}

.chart-container,
.simulator-container {
  background: white;
  padding: 2rem;
  border: 2px solid #e5e5e5;
  border-radius: 6px;
  transition: all 0.3s ease;
  position: relative;
}

.chart-container:hover,
.simulator-container:hover {
  border-color: #1a1a1a;
  box-shadow: 0 4px 0 #e30613;
}

/* Mantiene proporción y evita deformaciones */
.chart-container canvas {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 2 / 1; /* proporción 2:1 (ancho:alto) */
  display: block;
  max-height: 380px; /* evita que se alargue demasiado en pantallas grandes */
}

/* Ajustes específicos para móvil */
@media (max-width: 1024px) {
  .chart-container canvas {
    aspect-ratio: 1.8 / 1;
    max-height: 320px;
  }
}

@media (max-width: 768px) {
  .chart-container canvas {
    aspect-ratio: 1.5 / 1; /* más alto en pantallas pequeñas */
    max-height: 260px;
  }
}

/* Encabezado del simulador */
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap; /* permite que baje a segunda línea */
}

.chart-header h3 {
  font-size: 1rem;
  font-weight: 900;
  color: #1a1a1a;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.chart-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  background: #1a1a1a;
  color: #fff;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* En pantallas pequeñas, colocar en columna */
@media (max-width: 768px) {
  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .chart-badge {
    align-self: flex-start;
  }
}

.chart-footer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 2px solid #e5e5e5;
}
.data-source {
  font-size: 0.75rem;
  color: #6a6a6a;
  font-weight: 700;
  text-transform: uppercase;
}

/* SIMULADOR */
.simulator-controls {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.control-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1a1a1a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.control-group input[type="range"] {
  width: 100%;
  height: 5px;
  background: #e5e5e5;
  outline: none;
  border-radius: 5px;
  -webkit-appearance: none;
}
.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: #e30613;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}
.control-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}
.control-value {
  font-weight: 900;
  color: #e30613;
  font-size: 1rem;
}
.simulator-results {
  padding: 1rem;
  background: #f9f9f9;
  border-left: 4px solid #e30613;
  border-radius: 4px;
}
.result-text {
  font-size: 0.85rem;
  color: #1a1a1a;
  line-height: 1.6;
}

/* =========================================================
   CHAT CFO
   ========================================================= */

.chat-container {
  background: white;
  border: 2px solid #e5e5e5;
  overflow: hidden;
}
.chat-header {
  background: #1a1a1a;
  color: white;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #e30613;
}
.chat-messages {
  height: 450px;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: #fafafa;
}
.chat-input-container {
  padding: 1.5rem 2rem;
  border-top: 2px solid #e5e5e5;
  display: flex;
  gap: 1rem;
  background: white;
}

/* =========================================================
   ALERTAS
   ========================================================= */

.alert-card {
  background: white;
  padding: 2rem;
  border: 2px solid #e5e5e5;
  border-left: 4px solid;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border-radius: 6px;
  transition: all 0.3s ease;
}
.alert-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 0 #e30613;
}
.alert-warning {
  border-left-color: #f59e0b;
}
.alert-danger {
  border-left-color: #dc2626;
}
.alert-info {
  border-left-color: #3b82f6;
}

.alert-content h4 {
  font-size: 0.95rem;
  font-weight: 900;
  text-transform: uppercase;
  color: #1a1a1a;
}
.alert-content p {
  font-size: 0.85rem;
  color: #4a4a4a;
  line-height: 1.6;
}
.alert-actions {
  display: flex;
  gap: 1rem;
}

/* =========================================================
   BOTONES
   ========================================================= */

.btn {
  padding: 0.9rem 1.75rem;
  border: none;
  font-size: 0.85rem;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 6px;
}
.btn-primary {
  background: #e30613;
  color: white;
}
.btn-primary:hover {
  background: #1a1a1a;
  transform: translateY(-2px);
  box-shadow: 0 3px 0 #e30613;
}
.btn-secondary {
  background: #f5f5f5;
  color: #1a1a1a;
  border: 2px solid #e5e5e5;
}
.btn-secondary:hover {
  background: #e5e5e5;
  border-color: #1a1a1a;
}
.btn-small {
  padding: 0.55rem 1rem;
  font-size: 0.75rem;
}

/* =========================================================
   EXPLICABILIDAD Y FOOTER
   ========================================================= */

.explainability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.footer {
  background: #1a1a1a;
  color: white;
  padding: 3rem 0;
  text-align: center;
  border-top: 3px solid #e30613;
}

/* =========================================================
   ANIMACIONES Y RESPONSIVE
   ========================================================= */

.fade-in {
  opacity: 0;
  transform: translateY(25px);
  animation: fadeInUp 0.8s forwards ease-out;
}
@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .predictions-grid {
    grid-template-columns: 1fr;
  }
  .hero-title {
    font-size: 2.5rem;
  }
}

@media (max-width: 768px) {
  .hero-carousel {
    height: 320px;
  }
  .hero-title {
    font-size: 2rem;
  }
  .hero-subtitle {
    font-size: 0.9rem;
  }

  .kpis-grid,
  .predictions-grid,
  .alerts-grid,
  .explainability-grid {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 0 1.5rem;
  }
  .section-title {
    font-size: 1.25rem;
  }
  .message {
    max-width: 90%;
  }
  .chat-messages {
    height: 380px;
  }
}

/* =========================================================
   CHATBOT FLOTANTE - BANORTE FINCORTEX VOICE
   ========================================================= */

.chatbot-wrapper {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 2000;
}

/* Botón flotante circular */
.chatbot-btn {
  background: #ec1c2e;
  color: #fff;
  font-size: 1.6rem;
  border: none;
  border-radius: 50%;
  width: 65px;
  height: 65px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.3s ease;
}
.chatbot-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

/* Ventana del chat */
.chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 340px;
  max-height: 500px;
  background: #fff;
  border: 2px solid #e5e5e5;
  border-radius: 12px;
  overflow: hidden;
  display: none;
  flex-direction: column;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  animation: fadeInUp 0.3s ease forwards;
}

/* Header del chat */
.chatbot-header {
  background: #ec1c2e;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.25rem;
}
.chatbot-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.chatbot-avatar {
  background: #fff;
  color: #ec1c2e;
  border-radius: 50%;
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
}
.chatbot-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.chatbot-close {
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  border: none;
  cursor: pointer;
}

/* Área de mensajes */
.chatbot-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #fafafa;
}
.message {
  max-width: 85%;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  line-height: 1.4;
  font-size: 0.85rem;
}
.message.bot {
  background: #ec1c2e;
  color: white;
  align-self: flex-start;
}
.message.user {
  background: #f5f5f5;
  border: 1px solid #ddd;
  align-self: flex-end;
}

/* Input */
.chatbot-input-area {
  display: flex;
  border-top: 2px solid #e5e5e5;
  background: white;
}
.chatbot-input-area input {
  flex: 1;
  border: none;
  padding: 0.9rem 1rem;
  font-size: 0.85rem;
  outline: none;
}
.chatbot-input-area button {
  background: #ec1c2e;
  color: white;
  border: none;
  padding: 0 1.25rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.3s;
}
.chatbot-input-area button:hover {
  background: #1a1a1a;
}

/* Responsive móvil */
@media (max-width: 768px) {
  .chatbot-window {
    width: 90vw;
    max-height: 70vh;
    right: 5vw;
    bottom: 90px;
  }
  .chatbot-btn {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }
}

/* =========================================================
   CHATBOT FLOTANTE - BANORTE FINCORTEX VOICE
   ========================================================= */

.chatbot-wrapper {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 2000;
}

/* Botón flotante circular */
.chatbot-btn {
  background: #ec1c2e;
  color: #fff;
  font-size: 1.6rem;
  border: none;
  border-radius: 50%;
  width: 65px;
  height: 65px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.3s ease;
}
.chatbot-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 360px; /* un poco más ancho */
  max-height: 650px; /* MÁS ALTO */
  height: 70vh; /* ocupa 70% de la pantalla vertical */
  background: #fff;
  border: 2px solid #e5e5e5;
  border-radius: 12px;
  overflow: hidden;
  display: none;
  flex-direction: column;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
  animation: fadeInUp 0.3s ease forwards;
}

/* Header del chat */
.chatbot-header {
  background: #ec1c2e;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.25rem;
}
.chatbot-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.chatbot-avatar {
  background: #fff;
  color: #ec1c2e;
  border-radius: 50%;
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
}
.chatbot-title {
  font-size: 0.9rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.chatbot-close {
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  border: none;
  cursor: pointer;
}

/* Área de mensajes */
.chatbot-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #fafafa;
}
.message {
  max-width: 85%;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  line-height: 1.4;
  font-size: 0.85rem;
}
.message.bot {
  background: #ec1c2e;
  color: white;
  align-self: flex-start;
}
.message.user {
  background: #f5f5f5;
  border: 1px solid #ddd;
  align-self: flex-end;
}

/* Input */
.chatbot-input-area {
  display: flex;
  border-top: 2px solid #e5e5e5;
  background: white;
}
.chatbot-input-area input {
  flex: 1;
  border: none;
  padding: 0.9rem 1rem;
  font-size: 0.85rem;
  outline: none;
}
.chatbot-input-area button {
  background: #ec1c2e;
  color: white;
  border: none;
  padding: 0 1.25rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.3s;
}
.chatbot-input-area button:hover {
  background: #1a1a1a;
}

/* Responsive móvil */
@media (max-width: 768px) {
  .chatbot-window {
    width: 90vw;
    max-height: 70vh;
    right: 5vw;
    bottom: 90px;
  }
  .chatbot-btn {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }
}

/* ===== HEADER MOBILE FIX ===== */
@media (max-width: 768px) {
  .logo-subtitle {
    display: none; /* oculta FINCORTEX VOICE */
  }

  .logo-img {
    height: 34px; /* más pequeño en móvil */
  }

  .hamburger {
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
    width: 38px;
    height: 38px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
  }

  .header-container {
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
  }
}

/* --- ALERTAS: botones mejor alineados en móvil --- */
@media (max-width: 768px) {
  .alert-actions {
    flex-direction: column;
    align-items: stretch;
    margin-top: 0.75rem; /* pequeño espacio arriba del grupo */
    gap: 0.5rem; /* espacio balanceado entre botones */
  }

  .alert-actions .btn {
    width: 100%;
    padding: 0.8rem 1rem; /* más cómodo para tocar */
    font-size: 0.8rem;
  }

  .alert-content p {
    margin-bottom: 0.75rem; /* evita que se pegue al primer botón */
    line-height: 1.6;
  }
}

/* ================= CHAT FLOTANTE ================= */
.chat-float-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 2000;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #ec1c2e;
  border: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chat-float-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
}
.chat-float-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

/* Backdrop + ventana */
.chat-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1999;
  backdrop-filter: blur(3px);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hidden {
  display: none !important;
}

.chat-window {
  width: min(420px, 92vw);
  height: min(620px, 88vh);
  background: #fff;
  border: 2px solid #e5e5e5;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  transform: translateY(10px);
  animation: chatPop 0.25s ease forwards;
}
@keyframes chatPop {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Header (arrastrable en desktop) */
.chat-header {
  background: #ec1c2e;
  color: #fff;
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
}
.chat-header:active {
  cursor: grabbing;
}
.chat-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.chat-header-logo {
  width: 28px;
  height: 28px;
}
.chat-header-title {
  display: flex;
  flex-direction: column;
  line-height: 1;
  font-size: 0.9rem;
}
.chat-status {
  font-size: 0.75rem;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.chat-status .dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
}

/* Acciones */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.08);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn:hover {
  background: rgba(0, 0, 0, 0.16);
}

/* Cuerpo */
.chat-body {
  flex: 1;
  padding: 1rem;
  background: #f7f7f7;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.msg {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}
.msg.bot {
  background: #ec1c2e;
  color: #fff;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg.user {
  background: #fff;
  border: 1px solid #e5e5e5;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Input row */
.chat-input-row {
  display: flex;
  gap: 0.6rem;
  padding: 0.75rem;
  background: #fff;
  border-top: 1px solid #eee;
}
.chat-input-row input {
  flex: 1;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  outline: none;
}
.chat-input-row input:focus {
  border-color: #ec1c2e;
}
.send-btn {
  background: #ec1c2e;
  color: #fff;
  border: none;
  border-radius: 10px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.send-btn:hover {
  background: #c40e1d;
}

/* Desktop: ventana movible (no fullscreen) */
@media (min-width: 992px) {
  .chat-backdrop {
    background: transparent;
    backdrop-filter: none;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 24px;
  }
  .chat-window {
    width: 380px;
    height: 560px;
  }
}

/* Móvil: centrado tipo app */
@media (max-width: 991px) {
  .chat-window {
    width: 92vw;
    height: 75vh;
  }
}

/* ======= VOICE OVERLAY ======= */
.voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 2100;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.voice-panel {
  position: relative;
  width: min(520px, 92vw);
  background: #fff;
  border-radius: 16px;
  padding: 2rem 1.25rem 1.75rem;
  border: 2px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.voice-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #ec1c2e;
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.voice-circle {
  width: 240px;
  max-width: 80vw;
  aspect-ratio: 1/1;
  border-radius: 50%;
  background: #ec1c2e;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 12px 30px rgba(236, 28, 46, 0.35);
}
.voice-circle img {
  width: 92px;
}
.voice-circle canvas {
  position: absolute;
  bottom: -28px;
  width: 88%;
  height: 56px;
  left: 6%;
}
.voice-text {
  margin-top: 0.75rem;
  font-weight: 700;
  color: #1a1a1a;
}

.chart-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
}
.chart-modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  max-width: 420px;
  text-align: center;
  border-left: 5px solid #ec1c2e;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.chart-modal-content h3 {
  color: #ec1c2e;
  font-weight: 900;
  margin-bottom: 1rem;
}
.chart-modal-content p {
  color: #333;
  font-size: 0.95rem;
  line-height: 1.5;
}
.chart-modal-content button {
  margin-top: 1rem;
  padding: 0.7rem 1.5rem;
  background: #ec1c2e;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}
.chart-modal-content button:hover {
  background: #1a1a1a;
}

/* =========================================================
   KPI SECUNDARIOS INTERACTIVOS - REFINADO VISUAL BANORTE
   ========================================================= */
.kpi-secondary-container {
  background: #f8f8f8;
  padding: 2.5rem 2rem 3rem;
  border-radius: 10px;
  margin-top: 2rem;
}

/* Estilo del título igual al resto de secciones */
.kpi-secondary-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  border-left: 4px solid #e30613;
  padding-left: 1rem;
  margin-bottom: 1.8rem;
}

.kpi-secondary-title h2 {
  font-size: 1.35rem;
  color: #1a1a1a;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.3rem;
}

.kpi-secondary-title p {
  font-size: 0.95rem;
  color: #555;
  line-height: 1.4;
}

/* Tarjetas KPI - más pequeñas y centradas */
.kpi-secondary {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.kpi-mini {
  background: #fff;
  border: 1.5px solid #e2e2e2;
  border-radius: 8px;
  padding: 0.8rem 1rem;
  text-align: center;
  transition: all 0.25s ease;
  cursor: pointer;
  width: 280px;
  height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.kpi-mini:hover {
  border-color: #ec1c2e;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
  transform: translateY(-3px);
}

.kpi-mini h4 {
  color: #1a1a1a;
  font-weight: 800;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

.kpi-mini p {
  color: #ec1c2e;
  font-weight: 900;
  font-size: 1.05rem;
}

/* MODAL KPI */
.kpi-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
.kpi-modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: 10px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.3s ease;
  border-left: 5px solid #e30613;
}
.kpi-modal-content h3 {
  color: #1a1a1a;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
}
.kpi-modal-content p {
  color: #1a1a1a;
  font-size: 0.95rem;
  line-height: 1.6;
}
.kpi-modal-content button {
  margin-top: 1.5rem;
  background: #ec1c2e;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  transition: 0.3s ease;
}
.kpi-modal-content button:hover {
  background: #b70b15;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .kpi-secondary {
    gap: 0.8rem;
  }
  .kpi-mini {
    width: 45%;
    height: 70px;
    padding: 0.6rem;
  }
  .kpi-mini h4 {
    font-size: 0.85rem;
  }
  .kpi-mini p {
    font-size: 1rem;
  }
}

/* =========================================================
   MODAL DE ALERTAS
   ========================================================= */
.alert-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  animation: fadeIn 0.3s ease;
}

.alert-modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

.alert-modal-content h3 {
  color: #ec1c2e;
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.alert-modal-content p {
  font-size: 0.9rem;
  color: #333;
  line-height: 1.6;
}

.alert-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.fade-out {
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
