/* ============================================
   NAVBAR - VERSIÓN MOBILE FIXED
   ============================================ */

* {
  box-sizing: border-box;
}

.navbar {
  background: #fff;
  box-shadow: 0px 2px 15px rgba(0, 0, 0, 0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0;
  transition: all 0.3s ease;
}

.navbar.scrolled {
  box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
}

body {
  margin-top: 0; /* Se ajusta con padding-top según la navbar */
}

.navbar-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: auto;
  min-height: 70px;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ============================================
   BRAND / LOGO
   ============================================ */

.navbar-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  order: 1;
}

.navbar-brand a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #222222;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.navbar-brand a:hover {
  color: #106eea;
}

.navbar-brand .logo {
  height: 45px;
  width: auto;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.navbar-brand a:hover .logo {
  transform: scale(1.05);
}

/* ============================================
   MOBILE MENU BUTTON
   ============================================ */

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: #222222;
  padding: 8px;
  transition: color 0.3s ease;
  order: 3;
  flex-shrink: 0;
}

.mobile-menu-btn:hover {
  color: #106eea;
}

.mobile-menu-btn.bi-x {
  color: #106eea;
}

/* ============================================
   MENU PRINCIPAL (DESKTOP)
   ============================================ */

.navbar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  justify-content: center;
  order: 2;
}

.navbar-menu li {
  position: relative;
  white-space: nowrap;
}

.navbar-menu li a {
  display: block;
  padding: 8px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #222222;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  border-radius: 6px;
}

.navbar-menu li a::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(to right, #106eea, #3b8af2);
  transition: width 0.3s ease;
  border-radius: 2px;
}

.navbar-menu li a:hover {
  color: #106eea;
  background: rgba(16, 110, 234, 0.05);
}

.navbar-menu li a:hover::before {
  width: 100%;
}

.navbar-menu li a.active,
.navbar-menu li a.active:hover {
  color: #106eea;
  background: #e7f1fd;
  font-weight: 600;
}

/* ============================================
   CTA BUTTON (DESKTOP)
   ============================================ */

.navbar-cta {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  order: 4;
}

.navbar-cta a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 10px 20px;
  background: #106eea;
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.navbar-cta a:hover {
  background: #0d5bb5;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 110, 234, 0.3);
}

/* ============================================
   RESPONSIVE - TABLET (1024px)
   ============================================ */

@media (max-width: 1024px) {
  .navbar-container {
    min-height: 65px;
    gap: 0.75rem;
  }

  .navbar-menu {
    gap: 0.25rem;
  }

  .navbar-menu li a {
    padding: 6px 12px;
    font-size: 0.9rem;
  }

  .navbar-cta a {
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  .navbar-brand .logo {
    height: 40px;
  }

  .navbar-brand a {
    font-size: 1.1rem;
  }
}

/* ============================================
   RESPONSIVE - MOBILE (768px) - IMPORTANTE
   ============================================ */

@media (max-width: 768px) {
  body {
    padding-top: 60px;
  }

  .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
  }

  .navbar-container {
    min-height: 60px;
    padding: 0 12px;
    gap: 0.5rem;
  }

  .navbar-brand {
    order: 1;
  }

  .navbar-brand a {
    gap: 0.5rem;
    font-size: 1rem;
  }

  .navbar-brand .logo {
    height: 35px;
  }

  /* MOBILE MENU BUTTON - MOSTRAR */
  .mobile-menu-btn {
    display: block;
    order: 2;
    z-index: 1001;
  }

  /* MOBILE MENU - OCULTO POR DEFECTO */
  .navbar-menu {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    z-index: 999;
  }

  /* MOBILE MENU - ABIERTO */
  .navbar-menu.active {
    transform: translateX(0);
  }

  .navbar-menu li {
    white-space: normal;
    width: 100%;
  }

  .navbar-menu li a {
    padding: 12px 16px;
    display: block;
    border-radius: 0;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
  }

  .navbar-menu li a::before {
    display: none;
  }

  .navbar-menu li a:hover {
    background: #e7f1fd;
    border-left: 4px solid #106eea;
    padding-left: 12px;
  }

  .navbar-menu li a.active {
    background: #e7f1fd;
    border-left: 4px solid #106eea;
    padding-left: 12px;
  }

  /* OCULTAR CTA EN MÓVIL */
  .navbar-cta {
    display: none;
  }

  /* ORDEN EN MÓVIL */
  .navbar-brand {
    flex: 1;
  }
}

/* ============================================
   RESPONSIVE - MÓVIL PEQUEÑO (480px)
   ============================================ */

@media (max-width: 480px) {
  body {
    padding-top: 55px;
  }

  .navbar-container {
    min-height: 55px;
    padding: 0 10px;
  }

  .navbar-brand a {
    gap: 0.4rem;
    font-size: 0.95rem;
  }

  .navbar-brand .logo {
    height: 30px;
  }

  .mobile-menu-btn {
    font-size: 1.3rem;
  }

  .navbar-menu li a {
    padding: 10px 14px;
    font-size: 0.95rem;
  }

  .navbar-menu {
    top: 55px;
    max-height: calc(100vh - 55px);
  }

  /* Scroll en el menú si es muy largo */
  .navbar-menu li:last-child {
    padding-bottom: 20px;
  }
}

/* ============================================
   ANIMACIONES
   ============================================ */

@media (max-width: 768px) {
  .navbar-menu {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .navbar-menu.active {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  }
}

/* ============================================
   SCROLLBAR PERSONALIZADO
   ============================================ */

.navbar-menu::-webkit-scrollbar {
  width: 6px;
}

.navbar-menu::-webkit-scrollbar-track {
  background: transparent;
}

.navbar-menu::-webkit-scrollbar-thumb {
  background: #106eea;
  border-radius: 3px;
}

.navbar-menu::-webkit-scrollbar-thumb:hover {
  background: #0d5bb5;
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */

.navbar-menu li a:focus,
.navbar-cta a:focus,
.mobile-menu-btn:focus {
  outline: 2px solid #106eea;
  outline-offset: 2px;
}