/* ===== VARIABLES Y RESET ===== */
:root {
  --primary: #0d3b66; /* Azul oscuro */
  --primary-light: #1a5f9e; /* Azul medio */
  --accent: #f77f00; /* Naranja dinámico */
  --light: #f8f9fa;
  --gray: #495057;
  --white: #ffffff;
  --shadow: 0 6px 20px rgba(13, 59, 102, 0.12);
  --transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Desplazamiento suave en toda la página */
html {
  scroll-behavior: smooth;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.7;
  color: #374151;
  overflow-x: hidden;
  background-color: #fcfdff;
  font-feature-settings: "liga", "kern";
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===== ANIMACIONES ===== */
.fade-in {
  opacity: 0;
  transform: translateY(25px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in.appear {
  opacity: 1;
  transform: translateY(0);
}

/* ===== HEADER ===== */
header {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  position: fixed;
  width: 100%;
  top: 0;
  z-index: 1000;
  padding: 1rem 2rem;
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo {
  display: flex;
  align-items: center;
  height: 48px;
}

.logo img {
  height: 100%;
  width: auto;
  object-fit: contain;
}

/* NUEVO: Contenedor para elementos de la derecha */
.header-right {
  display: flex;
  align-items: center;
  gap: 2rem; /* Espacio entre elementos */
}

/* Botón de hamburguesa */
.hamburger {
  display: none;
  position: relative;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

._layer {
  background: var(--primary);
  margin-bottom: 4px;
  border-radius: 2px;
  width: 28px;
  height: 4px;
  opacity: 1;
  transition: all 0.25s cubic-bezier(0.05, 1.04, 0.72, 0.98);
}

.hamburger:hover .-top {
  transform: translateY(-100%);
}

.hamburger:hover .-bottom {
  transform: translateY(100%);
}

.hamburger.is-active .-top {
  transform: translateY(200%) rotate(45deg) !important;
}

.hamburger.is-active .-mid {
  opacity: 0;
}

.hamburger.is-active .-bottom {
  transform: translateY(-200%) rotate(135deg) !important;
}

/* Menú de escritorio */
.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  font-weight: 600;
  color: var(--primary);
  position: relative;
  padding: 0.4rem 0;
  font-size: 1.05rem;
  transition: color 0.3s;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

/* ===== MENÚ MÓVIL - EFECTO DE VIDRIO HIELO ===== */
.mobile-menu {
  display: none;
  position: fixed;
  top: 70px;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  z-index: 999;
  padding: 1.5rem 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.mobile-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: center;
}

.mobile-menu li {
  margin: 1.2rem 0;
}

.mobile-menu a {
  font-weight: 600;
  color: var(--primary);
  font-size: 1.2rem;
  padding: 0.8rem 0;
  display: inline-block;
  position: relative;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.mobile-menu a:hover {
  color: var(--accent);
  transform: translateX(6px);
}

.mobile-menu a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: all 0.3s;
  transform: translateX(-50%);
}

.mobile-menu a:hover::after {
  width: 45px;
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 160px 2rem 120px;
  margin-top: 70px;
  color: white;
  position: relative;
  z-index: 2;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 59, 102, 0.55);
  z-index: -1;
}

.hero h1 {
  font-size: 3.1rem;
  font-weight: 800;
  margin-bottom: 1.2rem;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hero p {
  font-size: 1.35rem;
  max-width: 750px;
  margin: 0 auto 2.2rem;
  opacity: 0.95;
  font-weight: 400;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* ===== BOTÓN PRINCIPAL ===== */
.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--white);
  padding: 1.1rem 2.7rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1.12rem;
  transition: var(--transition);
  box-shadow: 0 6px 20px rgba(247, 127, 0, 0.3);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -60%;
  width: 20px;
  height: 200%;
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(25deg);
  transition: all 0.6s;
  opacity: 0;
}

.btn:hover {
  background: #e66a00;
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 10px 28px rgba(247, 127, 0, 0.45);
}

.btn:hover::after {
  opacity: 1;
  left: 120%;
}

/* ===== SECCIONES ===== */
section {
  padding: 7.5rem 2rem;
  margin: 0 auto;
  position: relative;
}

@media (min-width: 769px) {
  section {
    max-width: 1280px;
  }
}

.section-title {
  text-align: center;
  font-size: 2.45rem;
  color: var(--primary);
  margin-bottom: 4.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  position: relative;
}

.section-title::after {
  content: "";
  display: block;
  width: 72px;
  height: 4px;
  background: var(--accent);
  margin: 1.1rem auto 0;
  border-radius: 2px;
}

/* ===== QUIÉNES SOMOS ===== */
.about-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2.4rem;
  margin-top: 2rem;
}

.about-box {
  background: var(--white);
  padding: 2.3rem 1.8rem;
  border-radius: 18px;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.06);
  text-align: center;
  transition: transform 0.3s ease;
}

.about-box:hover {
  transform: translateY(-5px);
}

.section-subtitle {
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 1.2rem;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
}

.section-subtitle i {
  background: rgba(13, 59, 102, 0.08);
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.2rem;
}

/* ===== SERVICIOS ===== */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2.3rem;
}

.service-card {
  background: var(--white);
  padding: 2.2rem;
  border-radius: 18px;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.06);
  transition: var(--transition);
  border-left: 4px solid var(--primary-light);
}

.service-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  border-left-color: var(--accent);
}

.service-card h3 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.service-card h3 i {
  color: var(--accent);
  font-size: 1.4rem;
}

/* ===== CONTACTO ===== */
.contact-section {
  background: var(--white);
  border-radius: 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  padding: 4.5rem !important;
  position: relative;
}

.contact-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: var(--accent);
}

.contact-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 4rem;
}

.contact-info h3 {
  color: var(--primary);
  margin: 1.4rem 0 1rem;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.contact-info a,
.contact-info p {
  color: #4b5563;
  font-weight: 500;
  transition: color 0.2s;
}

.contact-info a:hover {
  color: var(--accent);
}

.form-group {
  margin-bottom: 1.4rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.65rem;
  font-weight: 600;
  color: var(--primary);
  font-size: 1.02rem;
  letter-spacing: -0.2px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 1.02rem;
  box-sizing: border-box;
  background: #fcfdfe;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(247, 127, 0, 0.15);
}

#contactForm .btn {
  background: var(--primary);
  width: 100%;
  font-size: 1.1rem;
  box-shadow: 0 5px 16px rgba(13, 59, 102, 0.22);
}

#contactForm .btn:hover {
  background: #0b2d4f;
  box-shadow: 0 8px 22px rgba(13, 59, 102, 0.32);
  transform: translateY(-3px);
}

/* ===== ALERTAS DINÁMICAS ===== */
#alert-container {
  margin-bottom: 1.8rem;
}

.alert {
  padding: 1.2rem;
  border-radius: 14px;
  text-align: center;
  font-weight: 600;
  font-size: 1.08rem;
  opacity: 0;
  transform: scale(0.95);
  animation: popIn 0.4s forwards;
}

.alert.fade-out {
  animation: fadeOut 0.6s forwards;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@keyframes popIn {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.alert-success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.alert-error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

/* ===== DIVISOR ENTRE SECCIONES DE CONTACTO ===== */
.contact-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 1.5rem 0;
}

/* ===== ICONOS DE REDES SOCIALES ===== */
.social-links {
  display: flex;
  gap: 1.2rem;
  font-size: 1.4rem;
  color: var(--primary);
}

.social-links a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(13, 59, 102, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  transition: all 0.3s;
}

.social-links a:hover {
  background: var(--accent);
  color: white;
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 3.5rem 2rem 2rem;
  color: var(--gray);
  font-size: 1.05rem;
  margin-top: 4rem;
  background: #f8fafc;
}

/* ===== BOTÓN "VOLVER AL INICIO" ===== */
#back-to-top {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%) scale(0.5);
  width: 42px;
  height: 42px;
  background: rgba(13, 59, 102, 0.1);
  color: rgba(13, 59, 102, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.35s ease;
  z-index: 9999; /* Aumentar z-index para asegurar interacción */
  cursor: pointer;
  font-size: 16px;
  border: 1px solid rgba(13, 59, 102, 0.2);
  /* Asegurar que el botón responda a toques incluso durante scroll */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) scale(1);
}

/* Estado personalizado para el hover activo (desde JavaScript) */
#back-to-top.hover {
  background: #f77f00;
  color: white;
  transform: translateX(-50%) scale(1.05);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(247, 127, 0, 0.3);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.2rem;
    line-height: 1.2;
  }

  .hero p {
    font-size: 1.15rem;
    line-height: 1.5;
  }

  section {
    padding: 5rem 1.2rem;
  }

  .contact-section {
    padding: 2.5rem 1.2rem !important;
  }

  .contact-container {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .contact-form > p {
    font-size: 1.1rem;
    line-height: 1.6;
    padding: 0 4px;
    margin-bottom: 1.5rem;
  }

  .form-group input,
  .form-group textarea {
    padding: 0.9rem 1rem;
    font-size: 1.05rem;
  }

  .section-title {
    font-size: 2.1rem;
    margin-bottom: 3rem;
  }

  .nav-container {
    padding: 0 0;
  }

  /* Menú hamburguesa en móviles - ALINEADO A LA DERECHA */
  .header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: auto;
    margin-left: auto;
  }

  .hamburger {
    display: block;
    margin-right: 5px; /* Margen derecho para no tocar el borde */
  }

  /* Menú de escritorio - OCULTAR */
  .nav-links {
    display: none;
  }

  /* Menú móvil */
  .mobile-menu {
    top: 70px;
    padding: 1.5rem 0;
  }

  .mobile-menu.is_active {
    display: block;
  }
}
/* ===== CORRECCIÓN ESTADO HOVER EN MÓVILES ===== */
@media (hover: none) {
  /* Para dispositivos táctiles donde no hay hover real */
  #back-to-top:hover {
    background: rgba(13, 59, 102, 0.1) !important;
    color: rgba(13, 59, 102, 0.5) !important;
    transform: translateX(-50%) scale(1) !important;
    border-color: rgba(13, 59, 102, 0.2) !important;
    box-shadow: none !important;
  }

  #back-to-top:active {
    background: #f77f00 !important;
    color: white !important;
    transform: translateX(-50%) scale(1.05) !important;
    border-color: transparent !important;
    box-shadow: 0 4px 12px rgba(247, 127, 0, 0.3) !important;
  }
}

/* ===== ANIMACIÓN SUAVE AL RESTABLECER ===== */
#back-to-top {
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}
