/* ============================================================
   MARKETEGIA PLUS — style.css
   Responsive: iPhone SE, XR, 12 Pro, 14 Pro Max, Pixel 7,
   Galaxy S8+, S20 Ultra, iPad Mini, Air, Pro, Surface Pro 7,
   Surface Duo, Galaxy Z Fold 5, Asus Zenbook Fold,
   Samsung A51/71, Nest Hub, Nest Hub Max
   Cross-browser: Chrome, Firefox, Safari iOS, Edge
   ============================================================ */

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --azul: #003366;
  --azul-claro: #0055a5;
  --dorado: #f0b429;
  --blanco: #ffffff;
  --gris-claro: #f9f9f9;
  --azul-chat: #003366;
  --azul-claro-chat: #0055a5;
  --dorado-chat: #f0b429;
  --dorado-suave-chat: #ffd166;
  --blanco-chat: #ffffff;
  --gris-fondo-chat: #f4f6fb;
  --gris-borde-chat: #dde3ef;
  --texto-chat: #1a2640;
  --texto-suave-chat: #6b7a99;
  --sombra-chat: 0 8px 32px rgba(0,51,102,0.13);
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background-color: #ffffff;
  color: #333;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; }
ul { list-style: none; }

/* ===== CONTENEDOR ===== */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== TOPBAR ===== */
.topbar {
  background-color: var(--azul);
  color: #fff;
  font-size: 0.875rem;
  padding: 6px 0;
  position: relative;
  z-index: 1001;
}

.topbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

/* ===== HEADER ===== */
/* index.html usa <header class="header"> */
header.header {
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 1100;
  padding-top: env(safe-area-inset-top, 0px);
}

/* Subpáginas usan <header> (sin clase) que contiene <div class="topbar"> + <div class="header"> */
header:not(.header) {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 1100;
  background-color: #fff;
}

header:not(.header) .header {
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  position: relative;
  z-index: auto;
}

/* Contenedor del header — position:relative para que el dropdown se ubique bien */
.header .container,
header:not(.header) .header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  position: relative;
}

/* ===== LOGO ===== */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}

.logo-icon {
  width: 55px;
  height: auto;
  transition: transform 0.3s ease;
}

.logo-icon:hover { transform: scale(1.08); }

.logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--azul);
  white-space: nowrap;
}

.logo-text span { color: var(--dorado); }

/* ===== NAVBAR DESKTOP ===== */
.navbar {
  display: flex;
  align-items: center;
}

.navbar ul#menu {
  display: flex;
  align-items: center;
  gap: 18px;
  list-style: none;
}

.navbar ul#menu > li > a {
  color: var(--azul);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.3px;
  padding: 8px 2px;
  display: block;
  white-space: nowrap;
  transition: color 0.25s;
}

.navbar ul#menu > li > a:hover { color: var(--dorado); }

/* ===== DROPDOWN DESKTOP ===== */
.submenu { position: relative; }

.submenu > a {
  display: flex;
  align-items: center;
  gap: 5px;
}

.submenu > a::after {
  content: "";
  display: inline-block;
  transition: transform 0.3s ease;
}

.submenu:hover > a::after,
.submenu.active > a::after {
  transform: rotate(180deg);
}

.submenu > .dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.13);
  min-width: 285px;
  border-radius: 0 0 10px 10px;
  border-top: 3px solid var(--dorado);
  z-index: 2000;
  display: none;
  flex-direction: column;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.submenu:hover > .dropdown {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

.submenu > .dropdown li { border-bottom: 1px solid #f2f2f2; }
.submenu > .dropdown li:last-child { border-bottom: none; }

.submenu > .dropdown li a {
  display: block;
  padding: 10px 16px;
  color: var(--azul);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: normal;
  transition: background 0.2s, color 0.2s;
}

.submenu > .dropdown li a:hover {
  background: #f5f8ff;
  color: var(--dorado);
}

/* ===== HAMBURGER (oculto desktop) ===== */
.hamburger {
  display: none;
  background: none;
  border: 2px solid var(--azul);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--azul);
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.hamburger:hover { background: var(--azul); color: #fff; }

/* ===== HERO / CARRUSEL ===== */
.hero-carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  /* Fallbacks progresivos para distintos navegadores/dispositivos */
  height: 100vh;
  min-height: 480px;
  max-height: 900px;
}

/* svh evita el bug de iOS con la barra del navegador */
@supports (height: 100svh) {
  .hero-carousel {
    height: 100svh;
  }
}

.carousel {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.8s ease-in-out;
  will-change: transform;
  /* Forzar aceleración GPU para suavidad en móviles */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.slide {
  min-width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.slide img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: brightness(55%);
  -webkit-filter: brightness(55%);
  transition: transform 0.8s ease;
  transform: scale(1);
  /* Evitar que la imagen cause overflow */
  pointer-events: none;
}

.slide.active img {
  transform: scale(1.04);
}

.hero-content {
  position: relative;
  z-index: 10;
  text-align: center;
  color: #fff;
  padding: 0 24px;
  max-width: 85%;
  width: 100%;
  /* Texto responsivo con clamp — funciona en todos los navegadores modernos */
}

.hero-content h1 {
  font-size: clamp(1.1rem, 4vw, 2.6rem);
  font-weight: 700;
  text-transform: uppercase;
  text-shadow: 2px 2px 10px rgba(0,0,0,0.7);
  line-height: 1.25;
  margin-bottom: 12px;
}

.hero-content p {
  font-size: clamp(0.82rem, 2.2vw, 1.15rem);
  text-shadow: 1px 1px 6px rgba(0,0,0,0.6);
  line-height: 1.55;
}

/* Botones carrusel — IMPORTANTE: no usar transform en :hover para no sobreescribir translateY(-50%) */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  -webkit-transform: translateY(-50%);
  background: rgba(0,0,0,0.45);
  color: #fff;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: background 0.25s;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
  -webkit-appearance: none;
}

.carousel-btn:hover,
.carousel-btn:focus {
  background: var(--dorado);
  outline: none;
}

.carousel-btn.prev { left: 14px; }
.carousel-btn.next { right: 14px; }

.carousel-dots {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  -webkit-transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 20;
}

.dot {
  width: 11px;
  height: 11px;
  background: rgba(255,255,255,0.55);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.3s, transform 0.3s;
  -webkit-tap-highlight-color: transparent;
}

.dot.active {
  background: var(--dorado);
  transform: scale(1.3);
}

/* ===== SECCIONES ===== */
section { padding: 70px 0; }
section.alt { background-color: var(--gris-claro); }

h2 {
  color: var(--azul);
  font-size: clamp(1.4rem, 3vw, 2rem);
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.3;
}

/* NOSOTROS */
.nosotros .container {
  background: #fff;
  border: 2px solid var(--azul);
  border-radius: 10px;
  padding: 28px;
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  line-height: 1.72;
}

/* OBJETIVO */
.objetivo.alt { background-color: var(--azul); color: #fff; text-align: center; }
.objetivo.alt h2 { color: #fff; }

/* MISIÓN Y VISIÓN */
.mision-vision .container {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
}

.mision, .vision {
  flex: 1 1 260px;
  background: #fff;
  border: 2px solid var(--azul);
  border-radius: 10px;
  padding: 25px;
  text-align: center;
  line-height: 1.65;
}

.mision h2, .vision h2 { color: var(--dorado); }

/* VALORES */
.valores.alt { background-color: var(--azul); color: #fff; text-align: center; }
.valores.alt h2 { color: #fff; }

.valores.alt ul {
  list-style: none;
  padding-left: 0;
  margin: 0 auto;
  display: inline-block;
  text-align: left;
  max-width: 700px;
  width: 100%;
}

.valores.alt li {
  position: relative;
  margin-bottom: 14px;
  padding-left: 28px;
  line-height: 1.65;
}

.valores.alt li::before {
  content: "✔";
  color: var(--dorado);
  position: absolute;
  left: 0;
  top: 2px;
}

/* ===== SOLUCIONES ===== */
.soluciones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.solucion-card {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
}

.solucion-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}

.solucion-card a { display: block; text-decoration: none; color: inherit; }

.solucion-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 0.35s, filter 0.35s;
  display: block;
}

.solucion-card:hover img {
  transform: scale(1.08);
  filter: brightness(65%);
  -webkit-filter: brightness(65%);
}

.solucion-text {
  position: absolute;
  bottom: 0;
  width: 100%;
  text-align: center;
  background: rgba(0,0,0,0.58);
  color: #fff;
  padding: 10px 8px;
  transition: background 0.3s, color 0.3s;
}

.solucion-text h3 { font-size: 0.8rem; font-weight: 600; line-height: 1.3; }

.solucion-card:hover .solucion-text {
  background: rgba(240,180,41,0.92);
  color: var(--azul);
}

/* ===== SERVICIOS ===== */
.servicios {
  background-color: var(--azul);
  color: #fff;
  padding: 70px 0;
  text-align: center;
}

.servicios h2 { color: var(--dorado); margin-bottom: 36px; }

.servicios ul {
  list-style: none;
  columns: 2;
  -webkit-columns: 2;
  max-width: 880px;
  margin: 0 auto;
  line-height: 2;
  text-align: left;
}

.servicios li::before { content: "✔ "; color: var(--dorado); font-weight: 700; }

/* ===== PROYECTOS ===== */
.proyectos {
  background-color: var(--gris-claro);
  padding: 70px 20px;
  text-align: center;
}

.proyectos h2 span { color: #0073e6; }

.proyectos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 28px;
}

.proyecto-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.09);
  transition: transform 0.3s, box-shadow 0.3s;
}

.proyecto-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.14);
}

.proyecto-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.4s;
}

.proyecto-card:hover img { transform: scale(1.04); }

.proyecto-text { padding: 18px; }

.proyecto-text h3 {
  font-size: 1.05rem;
  color: #0073e6;
  margin-bottom: 8px;
  font-weight: 600;
}

.proyecto-text p { color: #555; font-size: 0.92rem; line-height: 1.55; }

/* ===== FORMULARIO CONTACTO ===== */
.contacto form {
  display: flex;
  flex-direction: column;
  max-width: 420px;
  width: 90%;
  margin: 0 auto;
  gap: 14px;
}

.contacto form input,
.contacto form textarea {
  padding: 12px 16px;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.contacto form input:focus,
.contacto form textarea:focus { border-color: var(--azul); }

.contacto .btn {
  background-color: var(--azul);
  color: #fff;
  border: none;
  padding: 13px 26px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, transform 0.3s;
  font-family: inherit;
}

.contacto .btn:hover {
  background-color: var(--dorado);
  color: var(--azul);
  transform: translateY(-2px);
}

/* ===== FOOTER ===== */
.footer { background-color: var(--azul); color: #fff; padding: 55px 0 20px; }

.footer-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 26px;
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-col { flex: 1 1 180px; }
.footer-col h4 { margin-bottom: 14px; color: var(--dorado); font-size: 1rem; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 6px; }

.footer-col ul li a {
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.25s;
}

.footer-col ul li a:hover { color: var(--dorado); }
.footer-col p { font-size: 0.88rem; line-height: 1.6; margin-bottom: 6px; }
.footer-col.contacto a { color: #fff; }
.footer-col.contacto a:hover { color: var(--dorado); }

.redes { margin-top: 6px; }
.redes a { color: #fff; margin-right: 14px; font-size: 1.25rem; transition: color 0.25s; }
.redes a:hover { color: var(--dorado); }

.footer-bottom {
  text-align: center;
  margin-top: 28px;
  font-size: 0.85rem;
  border-top: 1px solid rgba(255,255,255,0.18);
  padding-top: 16px;
  color: #fff;
  width: 90%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== WHATSAPP ===== */
.btn-whatsapp {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  z-index: 999;
  -webkit-tap-highlight-color: transparent;
}

.btn-whatsapp img {
  width: 48px;
  height: 48px;
  transition: transform 0.3s;
  border-radius: 50%;
}

.btn-whatsapp:hover img { transform: scale(1.12); }

/* ===== DETALLE DE SERVICIO ===== */
main.container { padding-left: 16px; padding-right: 16px; }

.service-detail {
  background: #fff;
  border: 2px solid var(--azul);
  border-radius: 14px;
  padding: 38px 40px;
  margin: 46px auto;
  max-width: 900px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.12);
  text-align: left;
}

.service-detail h1 {
  color: var(--azul);
  font-size: clamp(1.25rem, 3.5vw, 2rem);
  margin-bottom: 20px;
  text-align: center;
  line-height: 1.3;
}

.service-detail .intro {
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 22px;
  color: #444;
}

.service-list { list-style: none; padding-left: 0; margin-bottom: 20px; }

.service-list li {
  margin-bottom: 14px;
  padding-left: 22px;
  position: relative;
  line-height: 1.65;
  font-size: 0.97rem;
}

.service-list li::before {
  content: "✔";
  color: var(--dorado);
  position: absolute;
  left: 0;
  top: 2px;
}

/* ===== ACORDEÓN ===== */
.accordion {
  border: 2px solid var(--azul);
  border-radius: 10px;
  overflow: hidden;
  max-width: 900px;
  margin: 22px auto;
  background: var(--gris-claro);
}

.accordion-item + .accordion-item { border-top: 1px solid var(--azul); }

.accordion-header {
  background-color: var(--azul);
  color: #fff;
  cursor: pointer;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  border: none;
  width: 100%;
  font-family: inherit;
  transition: background 0.25s;
  -webkit-tap-highlight-color: transparent;
}

.accordion-header:hover { background-color: var(--dorado); color: var(--azul); }

.accordion-body {
  padding: 16px 20px;
  display: none;
  background: #fff;
  color: #333;
  font-size: 0.97rem;
  line-height: 1.65;
}

/* ===== DEMO ARROW — CHATEA CON NOSOTROS (cuadro azul, letras blancas) ===== */
.demo-arrow {
  position: fixed;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  right: 78px;
  background: var(--azul);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  animation: arrowPulse-chat 1.5s ease-in-out infinite;
  -webkit-animation: arrowPulse-chat 1.5s ease-in-out infinite;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(0,51,102,0.32);
  font-family: inherit;
}

/* Flecha apuntando hacia el botón de chat */
.demo-arrow::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 8px solid var(--azul);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

@keyframes arrowPulse-chat {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-5px); }
}

/* ===== CHATBOT — BOTÓN ===== */
#chat-toggle {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--azul-chat), var(--azul-claro-chat));
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(0,51,102,0.35);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1), box-shadow 0.3s;
  -webkit-tap-highlight-color: transparent;
}

#chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 28px rgba(0,51,102,0.45);
}

#chat-toggle svg { width: 22px; height: 22px; }

.badge-chat {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--dorado-chat);
  color: var(--azul-chat);
  font-size: 9px;
  font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  animation: pulse-chat 2s infinite;
}

@keyframes pulse-chat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

/* ===== VENTANA CHAT ===== */
#chat-window {
  position: fixed;
  bottom: calc(145px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  width: 360px;
  max-height: calc(100vh - 220px);
  background: var(--blanco-chat);
  border-radius: 18px;
  box-shadow: var(--sombra-chat);
  display: flex;
  flex-direction: column;
  z-index: 1200;
  overflow: hidden;
  transform: scale(0.85) translateY(28px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(.34,1.56,.64,1);
  border: 1px solid var(--gris-borde-chat);
}

#chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  background: linear-gradient(135deg, var(--azul-chat), var(--azul-claro-chat));
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--dorado-chat);
  flex-shrink: 0;
}

.chat-avatar svg { width: 20px; height: 20px; }
.chat-header-info { flex: 1; }

.chat-header-info h3 {
  color: white;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}

.chat-header-info p {
  color: var(--dorado-suave-chat);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.online-dot {
  width: 7px; height: 7px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  animation: blink-chat 1.8s infinite;
}

@keyframes blink-chat {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.close-chat {
  background: none; border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer; padding: 4px;
  border-radius: 6px; line-height: 0;
  transition: color 0.2s, background 0.2s;
}

.close-chat:hover { color: white; background: rgba(255,255,255,0.1); }
.close-chat svg { width: 18px; height: 18px; }

.quick-opts {
  padding: 10px 14px;
  background: linear-gradient(to bottom, #eef2fc, var(--blanco-chat));
  border-bottom: 1px solid var(--gris-borde-chat);
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.quick-opt {
  background: white;
  border: 1.5px solid var(--azul-chat);
  color: var(--azul-chat);
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.quick-opt:hover { background: var(--azul-chat); color: white; }

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

#messages::-webkit-scrollbar { width: 4px; }
#messages::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-thumb { background: var(--gris-borde-chat); border-radius: 2px; }

.msg { display: flex; gap: 8px; align-items: flex-end; animation: slideIn-chat 0.28s ease; }

@keyframes slideIn-chat {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--azul-chat), var(--azul-claro-chat));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.msg-avatar svg { width: 15px; height: 15px; }
.msg.user .msg-avatar { background: linear-gradient(135deg, var(--dorado-chat), #e6a020); }

.bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 15px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--texto-chat);
  word-break: break-word;
}

.msg.bot .bubble {
  background: var(--gris-fondo-chat);
  border-bottom-left-radius: 3px;
  border: 1px solid var(--gris-borde-chat);
}

.msg.user .bubble {
  background: linear-gradient(135deg, var(--azul-chat), var(--azul-claro-chat));
  color: white;
  border-bottom-right-radius: 3px;
}

.bubble strong { color: var(--azul-chat); }
.msg.user .bubble strong { color: var(--dorado-suave-chat); }
.bubble ul { padding-left: 16px; margin-top: 4px; }
.bubble li { margin-bottom: 2px; list-style: disc; }
.bubble a { color: var(--dorado-chat); font-weight: 600; }
.bubble a:hover { text-decoration: underline; }

.typing-indicator {
  display: flex; gap: 5px;
  padding: 12px 13px;
  background: var(--gris-fondo-chat);
  border-radius: 15px;
  border-bottom-left-radius: 3px;
  border: 1px solid var(--gris-borde-chat);
  width: fit-content;
}

.typing-dot {
  width: 7px; height: 7px;
  background: var(--azul-claro-chat);
  border-radius: 50%;
  animation: typing-chat 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-chat {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chat-input-area {
  padding: 10px 14px;
  border-top: 1px solid var(--gris-borde-chat);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: white;
}

#user-input {
  flex: 1;
  border: 1.5px solid var(--gris-borde-chat);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--texto-chat);
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  max-height: 90px;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
}

#user-input:focus { border-color: var(--azul-chat); }
#user-input::placeholder { color: var(--texto-suave-chat); }

#send-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--azul-chat), var(--azul-claro-chat));
  border: none; cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

#send-btn:hover { transform: scale(1.08); }
#send-btn:active { transform: scale(0.95); }
#send-btn svg { width: 17px; height: 17px; }

.chat-footer {
  text-align: center;
  padding: 5px 0 8px;
  font-size: 10px;
  color: var(--texto-suave-chat);
  font-family: inherit;
}

/* ==============================================
   RESPONSIVE — TODOS LOS DISPOSITIVOS
   ============================================== */

/* ── NEST HUB MAX / Large desktop (≤1280px) ── */
@media screen and (max-width: 1280px) {
  .navbar ul#menu { gap: 14px; }
  .navbar ul#menu > li > a { font-size: 0.78rem; }
}

/* ── NEST HUB / iPad Pro landscape (≤1024px) ── */
@media screen and (max-width: 1024px) {
  .navbar ul#menu { gap: 10px; }
  .navbar ul#menu > li > a { font-size: 0.74rem; }

  .hero-carousel {
    min-height: 400px;
    max-height: 720px;
  }
}

/* ── Surface Pro 7 / iPad Pro portrait (≤912px) ── */
@media screen and (max-width: 912px) {
  .proyectos-grid { grid-template-columns: repeat(2, 1fr); }

  .hero-carousel {
    min-height: 380px;
    max-height: 680px;
  }
}

/* ── iPad Air (≤820px) — Punto de quiebre hamburger ── */
@media screen and (max-width: 820px) {
  /* ACTIVAR HAMBURGER */
  .hamburger { display: flex; }

  /* OCULTAR MENÚ DESKTOP */
  .navbar ul#menu {
    display: none;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 300px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 2000;
    max-height: 75vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e5eaf5;
  }

  .navbar ul#menu.active { display: flex; }

  .navbar ul#menu > li { border-bottom: 1px solid #eef0f7; width: 100%; }
  .navbar ul#menu > li:last-child { border-bottom: none; }

  .navbar ul#menu > li > a {
    padding: 13px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--azul);
    display: block;
    width: 100%;
  }

  /* Dropdown en MÓVIL */
  .submenu > .dropdown {
    position: relative;
    top: auto; left: auto;
    box-shadow: none;
    min-width: auto;
    width: 100%;
    border-radius: 0;
    border-top: none;
    border-left: 3px solid var(--dorado);
    background: #f5f8ff;
    opacity: 1;
    transform: none;
    display: none; /* JS lo activa con .active */
  }

  /* Deshabilitar hover en móvil */
  .submenu:hover > .dropdown { display: none; }
  .submenu.active > .dropdown { display: flex !important; }

  .submenu > .dropdown li { border-bottom: 1px solid #e8edf8; }
  .submenu > .dropdown li:last-child { border-bottom: none; }

  .submenu > .dropdown li a {
    padding: 10px 18px 10px 26px;
    font-size: 0.82rem;
    color: var(--azul);
    font-weight: 400;
  }

  /* Hero */
  .hero-carousel { height: 58vh; min-height: 340px; max-height: 600px; }

  /* Secciones */
  section { padding: 55px 0; }

  .mision-vision .container { gap: 18px; }

  .servicios ul { columns: 1; -webkit-columns: 1; }

  .service-detail { padding: 26px 22px; margin: 26px auto; }

  .footer-container { gap: 18px; }

  /* Chat */
  #chat-window { width: 320px; }
}

/* ── Samsung Galaxy S20 Ultra / iPhone 14 Pro Max (≤430px) ── */
@media screen and (max-width: 430px) {
  .topbar { display: none; }

  .logo-text { font-size: 1.1rem; }
  .logo-icon { width: 44px; }

  .hero-carousel { height: 52vh; min-height: 270px; max-height: 460px; }

  .hero-content { max-width: 92%; padding: 0 10px; }
  .hero-content h1 { font-size: clamp(1rem, 5.5vw, 1.4rem); margin-bottom: 8px; }
  .hero-content p { font-size: clamp(0.78rem, 3.5vw, 0.92rem); }

  .carousel-btn { width: 38px; height: 38px; font-size: 1.2rem; }
  .carousel-btn.prev { left: 8px; }
  .carousel-btn.next { right: 8px; }

  section { padding: 40px 0; }
  h2 { font-size: 1.35rem; margin-bottom: 20px; }

  .nosotros .container { padding: 18px; font-size: 0.92rem; }
  .mision, .vision { padding: 18px; }

  .valores.alt ul { width: 95%; padding: 0 12px; }

  .soluciones-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .solucion-card img { height: 145px; }
  .solucion-text h3 { font-size: 0.7rem; }

  .servicios { padding: 40px 0; }

  .proyectos-grid { grid-template-columns: 1fr; gap: 16px; }
  .proyecto-card img { height: 180px; }

  .service-detail { padding: 18px 14px; margin: 14px auto; border-radius: 10px; }
  .service-detail h1 { font-size: 1.15rem; }
  .accordion-header { font-size: 0.9rem; padding: 12px 14px; }
  .accordion-body { font-size: 0.88rem; padding: 12px 14px; }

  .contacto form { width: 95%; }

  /* Chat pantalla completa en móvil */
  #chat-window {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100vh - 58px);
    max-height: calc(100vh - 58px);
    border-radius: 20px 20px 0 0;
    z-index: 2000;
  }

  #chat-toggle {
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    right: 14px;
    width: 48px; height: 48px;
  }

  .demo-arrow { display: none; }

  .btn-whatsapp { right: 14px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .btn-whatsapp img { width: 44px; height: 44px; }
}

/* ── iPhone SE / Galaxy S8+ / Pixel 7 (≤390px) ── */
@media screen and (max-width: 390px) {
  .logo-text { font-size: 1rem; }
  .logo-icon { width: 40px; }

  .hero-carousel { height: 50vh; min-height: 255px; }
  .hero-content h1 { font-size: clamp(0.95rem, 6vw, 1.2rem); }
  .hero-content p { font-size: 0.78rem; }

  .navbar ul#menu { width: 270px; }

  .soluciones-grid { gap: 9px; }
  .solucion-card img { height: 130px; }
  .solucion-text h3 { font-size: 0.66rem; }

  h2 { font-size: 1.2rem; }
}

/* ── iPhone SE / Galaxy S8 mínimo (≤375px) ── */
@media screen and (max-width: 375px) {
  .hero-content h1 { font-size: 0.92rem; line-height: 1.3; }

  .service-detail { padding: 16px 12px; }
  .accordion-header { font-size: 0.85rem; }
}

/* ── Galaxy Z Fold 5 cerrado / muy pequeño (≤344px) ── */
@media screen and (max-width: 344px) {
  .logo-text { font-size: 0.88rem; }
  .logo-icon { width: 32px; }
  .navbar ul#menu { width: 240px; }

  .hero-carousel { height: 48vh; min-height: 230px; }
  .hero-content h1 { font-size: 0.88rem; }
  .hero-content p { display: none; } /* demasiado pequeño */

  .soluciones-grid { grid-template-columns: 1fr; }
  .solucion-card img { height: 200px; }
}

/* ── LANDSCAPE móvil (altura ≤ 500px) ── */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .hero-carousel { height: 90vw; min-height: 200px; max-height: 380px; }
  .hero-content p { display: none; }
  .hero-content h1 { font-size: 1rem; margin-bottom: 0; }

  #chat-window {
    bottom: 0 !important; height: calc(100vh - 48px);
    max-height: calc(100vh - 48px);
  }

  .topbar { display: none; }
}

/* ── Surface Duo (doble pantalla ~540px) ── */
@media screen and (min-width: 541px) and (max-width: 720px) {
  .soluciones-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-carousel { height: 62vh; min-height: 340px; }
}

/* ── Print ── */
@media print {
  .topbar, .hamburger, #chat-toggle, #chat-window,
  .demo-arrow, .btn-whatsapp, .carousel-btn, .carousel-dots,
  .footer { display: none !important; }
  .hero-carousel { height: 300px; }
}

/* ==============================================
   DISEÑO DE LA PÁGINA DE BLOG
   ============================================== */
.blog-header {
  background: linear-gradient(rgba(0, 51, 102, 0.8), rgba(0, 51, 102, 0.8)), url("../img/jose.png");
  background-size: cover;
  background-position: center;
  color: white;
  padding: 100px 0 60px;
  text-align: center;
}

/* ======== POPUP DE VIDEO ======== */
.video-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.video-popup.active {
  visibility: visible;
  opacity: 1;
}

.video-content {
  position: relative;
  width: 90%;
  max-width: 300px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
  padding: 10px;
}

.popup-video-wrapper {
  position: relative;
  width: 100%;
}

.popup-video {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
  cursor: pointer;
}

/* Icono de pausa */
.pause-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  color: white;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  text-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.pause-icon.visible {
  opacity: 1;
}

.close-btn {
  position: absolute;
  top: 8px;
  right: 12px;
  color: white;
  font-size: 26px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  transition: 0.2s;
}
.close-btn:hover {
  color: #ff4444;
  transform: scale(1.2);
}

/* ===== BOTÓN DE SONIDO ===== */
.sound-btn {
  display: inline-block;
  margin-top: 10px;
  background: linear-gradient(135deg, #ff4444, #ff8800);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  z-index: 5;
  transition: all 0.25s ease;
  width: 100%;
  font-weight: 600;
  letter-spacing: 0.3px;
  box-shadow: 0 0 10px rgba(255, 136, 0, 0.4);
}
.sound-btn:hover {
  background: linear-gradient(135deg, #ff6666, #ffaa33);
  transform: scale(1.05);
}

/* ===== BOTÓN SONIDO ACTIVADO ===== */
.sound-btn.active {
  background: linear-gradient(135deg, #28a745, #5cd65c);
  box-shadow: 0 0 10px rgba(72, 255, 104, 0.5);
}
.sound-btn.active:hover {
  background: linear-gradient(135deg, #34c759, #79e27c);
  transform: scale(1.05);
}

@media (max-width: 480px) {
  .video-content {
    max-width: 75%;
  }
}
.blog-container {
  padding: 60px 0;
  min-height: 600px;
}
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 30px;
  margin-top: 40px;
}
.video-card {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
}
.video-card:hover {
  transform: translateY(-10px);
}
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  background: #000;
}
.video-wrapper iframe, .video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.video-info {
  padding: 20px;
}
.video-info h3 {
  color: var(--azul);
  margin-bottom: 10px;
  font-size: 1.2rem;
}
.video-info p {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Admin Section */
.admin-access {
  text-align: center;
  margin-top: 40px;
}
.admin-btn {
  background: none;
  border: 1px solid #ccc;
  color: #999;
  padding: 5px 15px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.3s;
}
.admin-btn:hover {
  color: var(--azul);
  border-color: var(--azul);
}
.admin-panel {
  display: none;
  background: #f4f7ff;
  padding: 30px;
  border-radius: 15px;
  margin-bottom: 40px;
  border: 2px dashed var(--azul);
}
.admin-panel.visible {
  display: block;
}
.form-group {
  margin-bottom: 15px;
}
.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: var(--azul);
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
  outline: none;
}
.admin-panel textarea {
  min-height: 100px;
  resize: vertical;
  overflow-y: auto !important;
  word-wrap: break-word;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--azul);
}
.upload-btn {
  background: var(--azul);
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.3s;
}
.upload-btn:hover {
  background: var(--azul-claro);
}

/* Modal de Admin Login */
.admin-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 51, 102, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  backdrop-filter: blur(5px);
}
.admin-modal.active {
  display: flex;
}
.modal-content {
  background: white;
  padding: 30px;
  border-radius: 15px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 15px 40px rgba(0,0,0,0.2);
  animation: modalScale 0.3s ease;
}
@keyframes modalScale {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-content h2 {
  color: var(--azul);
  margin-bottom: 20px;
}
.modal-content input {
  width: 100%;
  padding: 12px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  outline: none;
  font-size: 16px;
}
.pass-container {
  position: relative;
  width: 100%;
  margin-bottom: 5px;
}
.pass-container input {
  padding-right: 45px;
}
.toggle-pass {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
}
.toggle-pass:hover {
  color: var(--azul);
}
.error-msg {
  display: block;
  color: #ff4444;
  font-size: 0.85rem;
  margin-bottom: 15px;
  height: 1.2rem;
  text-align: left;
}
.modal-content .modal-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.modal-btn {
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  border: none;
  transition: all 0.3s;
}
.btn-confirm { background: var(--azul); color: white; }
.btn-cancel { background: #eee; color: #666; }
.btn-confirm:hover { background: var(--azul-claro); }
.btn-cancel:hover { background: #ddd; }

/* ===== BOTÓN ELIMINAR IMAGEN (X) ===== */
.image-preview {
  position: relative;
  display: inline-block;
}

.image-preview .remove-image {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(255, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  font-family: Arial, sans-serif;
}

.image-preview:hover .remove-image {
  display: flex;
  background: rgba(255, 68, 68, 1);
}

.image-preview .remove-image:hover {
  background: rgba(220, 53, 69, 1);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.image-preview img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
}

/* ===== ESTADO SIN IMAGEN ===== */
.no-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 200px;
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 8px;
  color: #6c757d;
  font-size: 14px;
  font-style: italic;
  margin-top: 10px;
}

.no-image-placeholder i {
  margin-right: 8px;
  font-size: 16px;
}

@media (max-width: 768px) {
  .video-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== ESTILOS PARA IMÁGENES DE PROVEEDORES ===== */
.provider-logo img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid #f0f0f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.provider-logo img:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* Para proveedores sin imagen */
.provider-logo {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  font-weight: bold;
  border: 3px solid #f0f0f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.provider-logo.no-image::before {
  content: attr(data-initial);
  text-transform: uppercase;
}

/* Responsive para imágenes de proveedores */
@media (max-width: 768px) {
  .provider-logo img {
    width: 60px;
    height: 60px;
  }
  
  .provider-logo {
    width: 60px;
    height: 60px;
    font-size: 18px;
  }
}
