* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: #111111;
  color: #f5f5f5;
  font-family: Arial, sans-serif;
}

header {
  align-items: center;
  background: #171717;
  border-bottom: 1px solid #333333;
  display: flex;
  justify-content: space-between;
  padding: 20px 8%;
  position: sticky;
  top: 0;
  z-index: 10;
}

h1,
h2,
h3 {
  font-family: Impact, "Arial Black", sans-serif;
  text-transform: uppercase;
}

header h1 {
  font-size: 1.5rem;
}

header h1 span,
.portada h2 span {
  color: #d61f26;
}

nav {
  display: flex;
  gap: 20px;
}

nav a {
  color: white;
  font-size: 0.9rem;
  text-decoration: none;
}

nav a:hover {
  color: #d61f26;
}

/* ESTILOS PARA EL SELECTOR DE IDIOMAS (BANDERAS) */
.language-selector {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lang-btn {
  background: #222222;
  border: 1px solid #444444;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-btn:hover {
  background: #333333;
  transform: scale(1.1);
}

.lang-btn.active {
  border-color: #d61f26;
  background: #2a2a2a;
  box-shadow: 0 0 5px rgba(214, 31, 38, 0.5);
}

.portada {
  align-items: flex-start;
  background: #111111;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 650px;
  overflow: hidden;
  padding: 170px 8% 100px;
  position: relative;
}

.fondo-3d {
  inset: 0;
  perspective: 1400px;
  position: absolute;
  z-index: 0;
}

.tableta {
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.9s ease-in-out;
  width: 100%;
}

.tableta.volteada {
  transform: rotateY(180deg);
}

.lado {
  backface-visibility: hidden;
  background-position: center;
  background-size: cover;
  inset: 0;
  position: absolute;
}

.lado-atras {
  transform: rotateY(180deg);
}

.capa-oscura {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.12));
  inset: 0;
  position: absolute;
  z-index: 1;
}

.portada > :not(.fondo-3d):not(.capa-oscura) {
  position: relative;
  z-index: 2;
}

.lema {
  color: #d61f26;
  font-size: 0.8rem;
  font-weight: bold;
  letter-spacing: 3px;
  margin-bottom: 15px;
}

.portada h2 {
  font-size: clamp(3rem, 7vw, 6rem);
  line-height: 0.95;
}

.texto-portada {
  color: #ffffff;
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 25px 0 30px;
  max-width: 520px;
}

.boton {
  background: #d61f26;
  color: white;
  display: inline-block;
  font-weight: bold;
  padding: 16px 25px;
  text-decoration: none;
  text-transform: uppercase;
}

.boton:hover {
  background: #f12b34;
}

.instruccion {
  color: #ffffff;
  font-size: 0.85rem;
  margin-top: 28px;
}

.seccion,
.nosotros,
.contacto {
  padding: 90px 8%;
}

.seccion {
  background: #202020;
}

.seccion h2,
.nosotros h2,
.contacto h2 {
  font-size: clamp(2.3rem, 5vw, 4rem);
  line-height: 1;
}

.servicios {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 40px;
}

.tarjeta {
  background: #2a2a2a;
  border-top: 3px solid #d61f26;
  padding: 30px;
}

.numero {
  color: #d61f26;
  font-weight: bold;
  margin-bottom: 20px;
}

.tarjeta h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
}

.tarjeta p:last-child,
.nosotros > p:last-child {
  color: #c0c0c0;
  line-height: 1.7;
}

.nosotros > p:last-child {
  font-size: 1.1rem;
  margin-top: 25px;
  max-width: 650px;
}

.seccion-marcas {
  background: #171717;
  padding: 90px 8%;
}

.marcas-container h2 {
  font-size: clamp(2.3rem, 5vw, 4rem);
  line-height: 1;
  margin-bottom: 15px;
}

.marcas-descripcion {
  color: #c0c0c0;
  font-size: 1.1rem;
  margin-bottom: 40px;
}

.brand-category {
  margin-bottom: 35px;
}

.brand-category h3 {
  font-size: 1.2rem;
  color: #ffffff;
  margin-bottom: 15px;
  border-left: 3px solid #d61f26;
  padding-left: 10px;
}

.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

/* Estilos para los logotipos de marcas */
.brand-card-img {
  background: #222222;
  border: 1px solid #333333;
  border-radius: 6px;
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 95px;
  transition: all 0.3s ease;
}

.brand-card-img:hover {
  background: #d61f26;
  border-color: #d61f26;
  transform: translateY(-2px);
}

.brand-card-img img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.brand-card-img span {
  font-size: 0.75rem;
  color: #e0e0e0;
  font-weight: bold;
}

.contacto {
  background: #d61f26;
  text-align: center;
}

.contacto .lema {
  color: #171717;
}

.contacto h2 {
  margin-bottom: 30px;
}

.boton-oscuro {
  background: #111111;
}

.datos-contacto {
  line-height: 1.8;
  margin: 35px auto 0;
  max-width: 700px;
}

.datos-contacto p {
  margin-top: 12px;
}

.datos-contacto a {
  color: white;
  font-weight: bold;
}

footer {
  color: #999999;
  font-size: 0.85rem;
  padding: 25px;
  text-align: center;
}

/* WIDGET DE CHAT FLOTANTE */
.chat-widget {
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 1000;
  font-family: Arial, sans-serif;
}

.chat-toggle-btn {
  background-color: #d61f26;
  color: white;
  border: none;
  border-radius: 50px;
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(214, 31, 38, 0.4);
  transition: all 0.3s ease;
  position: relative;
}

.chat-toggle-btn:hover {
  background-color: #f12b34;
  transform: scale(1.05);
}

.chat-pulse {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  background-color: #2ecc71;
  border-radius: 50%;
  border: 2px solid #111;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(46, 204, 113, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

.chat-window {
  position: absolute;
  bottom: 75px;
  right: 0;
  width: 320px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.chat-window.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  pointer-events: none;
}

.chat-header {
  background: #222;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #333;
}

.chat-expert-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.expert-avatar-container {
  position: relative;
  width: 40px;
  height: 40px;
}

.expert-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.status-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  background-color: #2ecc71;
  border-radius: 50%;
  border: 2px solid #222;
}

.chat-expert-info h4 {
  font-size: 0.9rem;
  color: #fff;
  margin: 0;
}

.chat-expert-info p {
  font-size: 0.75rem;
  color: #aaa;
  margin: 0;
}

.online-text {
  color: #2ecc71;
  font-weight: bold;
}

.chat-close-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.1rem;
  cursor: pointer;
}

.chat-close-btn:hover {
  color: #fff;
}

.chat-body {
  padding: 15px;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-message {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.4;
  max-width: 85%;
}

.bot-msg {
  background: #2a2a2a;
  color: #ddd;
  align-self: flex-start;
}

.user-msg {
  background: #d61f26;
  color: white;
  align-self: flex-end;
}

.chat-options {
  padding: 10px 15px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #1a1a1a;
  border-top: 1px solid #282828;
}

.chat-options button {
  background: #262626;
  border: 1px solid #444;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-options button:hover {
  background: #d61f26;
  border-color: #d61f26;
}

@media (max-width: 700px) {
  header {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
  }

  nav {
    gap: 12px;
  }

  nav a {
    font-size: 0.75rem;
  }

  .servicios {
    grid-template-columns: 1fr;
  }
}