/* ========== VARIABLES CSS ========== */
:root {
  --primary-color: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #4285f4;
  --secondary-color: #ff6600;
  --accent-color: #ff8c00;
  --accent-hover: #e65c00;
  --dark-bg: #121212;
  --dark-card: #1e1e1e;
  --dark-element: #252525;
  --dark-border: #333333;
  --light-text: #e0e0e0;
  --lighter-text: #f5f5f5;
  --muted-text: #9e9e9e;
  --header-height: 80px;
  --transition-default: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modo oscuro (por defecto) */
[data-theme="dark"] {
  --bg-primary: var(--dark-bg);
  --bg-secondary: var(--dark-card);
  --bg-element: var(--dark-element);
  --border-color: var(--dark-border);
  --text-primary: var(--lighter-text);
  --text-secondary: var(--light-text);
  --text-muted: var(--muted-text);
  --shadow-color: rgba(0, 0, 0, 0.3);
}

/* Modo claro */
[data-theme="light"] {
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-element: #eef2f5;
  --border-color: #e0e4e8;
  --text-primary: #1a1a2e;
  --text-secondary: #2d2d44;
  --text-muted: #6c757d;
  --shadow-color: rgba(0, 0, 0, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========== SCROLLBAR PERSONALIZADA ========== */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-element);
}
::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* ========== BARRA DE PROGRESO DE SCROLL ========== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  z-index: 10000;
  transition: width 0.1s ease;
}

/* ========== BOTÓN VOLVER ARRIBA ========== */
.back-to-top {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 45px;
  height: 45px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-default);
  z-index: 900;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  border: none;
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}
.back-to-top:hover {
  background-color: var(--secondary-color);
  transform: translateY(-3px);
}

/* ========== HEADER ========== */
.main-header {
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 12px var(--shadow-color);
  padding: 12px 30px;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: background-color 0.3s ease;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.header-brand {
  display: flex;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
}

.header-logo-img {
  height: 55px;
  width: auto;
  margin-right: 18px;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}
.header-brand:hover .header-logo-img {
  transform: scale(1.08);
}

.site-title {
  font-size: 1.8rem;
  letter-spacing: 1.5px;
  color: white;
  font-weight: 700;
}
.site-title span {
  font-weight: 300;
  opacity: 0.95;
}

/* ========== NAVEGACIÓN PRINCIPAL ========== */
.main-nav ul {
  list-style: none;
  display: flex;
  gap: 25px;
}
.main-nav-link {
  text-decoration: none;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  transition: var(--transition-default);
  position: relative;
  padding: 8px 0;
}
.main-nav-link::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: white;
  transition: width 0.3s;
}
.main-nav-link:hover::after {
  width: 100%;
}

/* Dropdowns */
.main-nav-item {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--bg-secondary);
  border-radius: 10px;
  box-shadow: 0 10px 25px var(--shadow-color);
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: var(--transition-default);
  z-index: 100;
  border: 1px solid var(--border-color);
}
.main-nav-item:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-item {
  display: block;
  padding: 12px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition-default);
  border-left: 3px solid transparent;
}
.dropdown-item:hover {
  background-color: var(--bg-element);
  border-left-color: var(--secondary-color);
  color: var(--primary-color);
}

/* ========== MENÚ MÓVIL - OCULTO POR DEFECTO ========== */
.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
}

.theme-toggle {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: var(--transition-default);
  margin-left: 15px;
}
.theme-toggle:hover {
  background: rgba(255,255,255,0.3);
  transform: rotate(15deg);
}

/* MENÚ MÓVIL - FUERA DE PANTALLA POR DEFECTO */
.nav-menu {
  position: fixed;
  top: var(--header-height);
  right: -300px;
  width: 280px;
  height: calc(100vh - var(--header-height));
  background-color: var(--bg-secondary);
  transition: right 0.3s ease;
  z-index: 950;
  padding: 20px;
  overflow-y: auto;
  box-shadow: -5px 0 20px var(--shadow-color);
}

.nav-menu.active {
  right: 0;
}

.mobile-nav-item {
  margin-bottom: 10px;
}

.mobile-nav-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: var(--bg-element);
  border-radius: 10px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
}

.toggle-dropdown {
  background: transparent;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.9rem;
}

.mobile-dropdown {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding-left: 15px;
}

.mobile-dropdown.active {
  max-height: 300px;
}

.mobile-dropdown a {
  display: block;
  padding: 10px 15px;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 2px solid var(--secondary-color);
  margin: 5px 0;
  transition: var(--transition-default);
}

.mobile-dropdown a:hover {
  background: var(--bg-element);
  padding-left: 20px;
}

/* ========== RESPONSIVE - SOLO EN MÓVIL SE MUESTRA EL BOTÓN Y EL MENÚ ========== */
@media (max-width: 992px) {
  .main-nav {
    display: none;
  }
  .mobile-menu-toggle {
    display: block;
  }
  .whatsapp-button {
    bottom: 80px;
  }
  .back-to-top {
    bottom: 90px;
  }
}

/* Asegurar que el menú móvil esté correctamente posicionado */
@media (min-width: 993px) {
  .nav-menu {
    right: -300px !important;
  }
  .nav-menu.active {
    right: -300px !important;
  }
}

/* ========== BOTONES ========== */
.cta-button {
  background-color: var(--secondary-color);
  color: white;
  padding: 14px 35px;
  font-size: 1.1rem;
  border-radius: 50px;
  text-decoration: none;
  display: inline-block;
  font-weight: bold;
  transition: var(--transition-default);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 102, 0, 0.3);
}
.cta-button:hover {
  background-color: var(--accent-hover);
  transform: translateY(-3px);
}

/* ========== SECCIONES ========== */
.section-title {
  text-align: center;
  font-size: 2.2rem;
  margin-bottom: 50px;
  position: relative;
  display: inline-block;
  width: 100%;
  color: var(--text-primary);
}
.section-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--secondary-color);
  border-radius: 3px;
}

/* ========== FOOTER ========== */
.main-footer {
  background-color: var(--bg-element);
  padding: 50px 20px 20px;
  margin-top: auto;
}
.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
}
.footer-section h3 {
  margin-bottom: 20px;
  color: var(--text-primary);
}
.footer-section p {
  color: var(--text-muted);
}
.social-icons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.social-icon {
  width: 40px;
  height: 40px;
  background: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition-default);
}
.social-icon:hover {
  background: var(--secondary-color);
  color: white;
  transform: translateY(-3px);
}
.footer-links {
  list-style: none;
}
.footer-links li {
  margin-bottom: 10px;
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition-default);
}
.footer-links a:hover {
  color: var(--secondary-color);
  padding-left: 5px;
}
.copyright {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
}

/* ========== WHATSAPP ========== */
.whatsapp-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background-color: #25d366;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  text-decoration: none;
  z-index: 900;
  transition: var(--transition-default);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.whatsapp-button:hover {
  transform: scale(1.1);
  background-color: #128c7e;
}

/* ========== QUICK MENU ========== */
.quick-menu {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-secondary);
  border-radius: 0 15px 15px 0;
  z-index: 800;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 2px 2px 10px var(--shadow-color);
}
.quick-menu-item {
  padding: 12px 14px;
  text-align: center;
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition-default);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
}
.quick-menu-item i {
  font-size: 1.3rem;
  margin-bottom: 4px;
}
.quick-menu-item:hover {
  background: var(--secondary-color);
  color: white;
}

/* ========== RESPONSIVE QUICK MENU ========== */
@media (max-width: 992px) {
  .quick-menu {
    flex-direction: row;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    border-radius: 15px 15px 0 0;
    justify-content: space-around;
  }
  .whatsapp-button {
    bottom: 80px;
  }
  .back-to-top {
    bottom: 90px;
  }
}

/* ========== RESPONSIVE GENERAL ========== */
@media (max-width: 768px) {
  .site-title {
    font-size: 1.4rem;
  }
  .header-logo-img {
    height: 40px;
  }
  .main-header {
    padding: 10px 15px;
  }
  section {
    padding: 50px 15px;
  }
  .hero h1 {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .site-title {
    font-size: 1.1rem;
  }
  .header-logo-img {
    height: 32px;
  }
  .hero {
    padding: 60px 15px;
  }
  .hero h1 {
    font-size: 1.6rem;
  }
  .cta-button {
    padding: 10px 25px;
    font-size: 1rem;
  }
  .section-title {
    font-size: 1.8rem;
  }
}

/* ========== ANIMACIONES ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== CLASES DE UTILIDAD ========== */
.bg-primary {
  background-color: var(--bg-primary);
}
.bg-secondary {
  background-color: var(--bg-secondary);
}
.bg-element {
  background-color: var(--bg-element);
}
.text-primary {
  color: var(--text-primary);
}
.text-secondary {
  color: var(--text-secondary);
}
.text-muted {
  color: var(--text-muted);
}
.border-border-color {
  border-color: var(--border-color);
}

/* FORZAR QUE EL MENÚ MÓVIL ESTÉ OCULTO EN DESKTOP */
.nav-menu-mobile {
    right: -300px !important;
}

.nav-menu-mobile.active {
    right: 0 !important;
}

/* SOLO EN MÓVIL se puede activar */
@media (max-width: 768px) {
    .nav-menu-mobile.active {
        right: 0 !important;
    }
}
/* ========== MENÚ MÓVIL - OCULTO EN DESKTOP ========== */
.mobile-menu-wrapper {
  display: block;
}

.nav-menu-mobile {
  position: fixed;
  top: var(--header-height);
  right: -300px;
  width: 280px;
  height: calc(100vh - var(--header-height));
  background-color: var(--bg-secondary);
  transition: right 0.3s ease;
  z-index: 950;
  padding: 20px;
  overflow-y: auto;
  box-shadow: -5px 0 20px var(--shadow-color);
}

.nav-menu-mobile.active {
  right: 0;
}

/* En desktop, el wrapper se oculta y el menú móvil no existe */
@media (min-width: 993px) {
  .mobile-menu-wrapper {
    display: none !important;
  }
}

/* En móvil, el wrapper se muestra y el menú funciona normalmente */
@media (max-width: 992px) {
  .mobile-menu-wrapper {
    display: block;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .main-nav {
    display: none;
  }
}