/* ========================================
   HEADER / NAVIGATION STYLES
   ======================================== */

/* Reset para evitar overflow */
nav * {
  box-sizing: border-box;
}

/* Navegación principal */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: #0f172a;
  color: white;
  padding: 1rem 0;
  z-index: 1000;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Container principal del nav */
nav .container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

/* Logo con ícono */
nav .flex.items-center.space-x-3 {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
  font-size: 1.125rem;
  font-weight: 700;
  max-width: 70%;
}

nav .flex.items-center.space-x-3 svg {
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
  min-width: 3rem;
}

/* Texto del logo - responsive */
nav .flex.items-center.space-x-3 span {
  line-height: 1.3;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  flex: 1;
  min-width: 0;
}

/* Ocultar texto largo en móvil, mostrar en desktop */
nav .flex.items-center.space-x-3 .hidden.lg\\:inline {
  display: none;
}

nav .flex.items-center.space-x-3 .lg\\:hidden {
  display: inline;
  font-size: 0.875rem;
}

/* Menú desktop */
nav .hidden.md\\:flex {
  display: none;
  align-items: center;
  gap: 1rem;
  position: relative;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

nav .hidden.md\\:flex a,
nav .hidden.md\\:flex button {
  color: white;
  text-decoration: none;
  transition: color 0.3s ease;
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 0.95rem;
  font-family: inherit;
  padding: 0;
  flex-shrink: 0;
}

nav .hidden.md\\:flex a:hover,
nav .hidden.md\\:flex button:hover {
  color: #60a5fa;
}

/* Dropdown escritorio */
#docsMenu {
  position: relative;
}

#docsBtn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

#docsDropdown {
  position: absolute;
  left: 0;
  top: 100%;
  background-color: #1f2937;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  margin-top: 0.5rem;
  width: 13rem;
  padding: 0.5rem 0;
  z-index: 1001;
  display: none;
}

#docsDropdown.show {
  display: block;
}

#docsDropdown a {
  display: block;
  padding: 0.5rem 1rem;
  color: white;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

#docsDropdown a:hover {
  background-color: #374151;
}

#docsIcon {
  width: 1rem;
  height: 1rem;
  transition: transform 0.3s ease;
}

#docsIcon.rotate {
  transform: rotate(180deg);
}

/* Botón menú móvil */
#mobileMenuBtn {
  display: none;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.25rem;
  flex-shrink: 0;
}

#mobileMenuBtn:focus {
  outline: none;
}

#mobileMenuBtn svg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Menú móvil */
#mobileMenu {
  display: none;
  flex-direction: column;
  background-color: #1e293b;
  padding: 1rem;
  width: 100%;
  gap: 0.5rem;
}

#mobileMenu.show {
  display: flex;
}

#mobileMenu a,
#mobileMenu button {
  display: block;
  color: white;
  text-decoration: none;
  padding: 0.5rem 0;
  transition: color 0.3s ease;
  text-align: left;
  background: none;
  border: none;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}

#mobileMenu a:hover,
#mobileMenu button:hover {
  color: #60a5fa;
}

/* Submenú móvil */
#docMenuBtn {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#docArrow {
  width: 1rem;
  height: 1rem;
  transition: transform 0.3s ease;
}

#docArrow.rotate {
  transform: rotate(180deg);
}

#docSubmenu {
  display: none;
  flex-direction: column;
  padding-left: 1rem;
  margin-top: 0.5rem;
  gap: 0.25rem;
}

#docSubmenu.show {
  display: flex;
}

#docSubmenu a {
  padding: 0.375rem 0;
  font-size: 0.9375rem;
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Tablets y Desktop (768px+) */
@media (min-width: 768px) {
  nav .container {
    padding: 0 1.5rem;
    gap: 1rem;
  }

  nav .flex.items-center.space-x-3 svg {
    width: 3.5rem;
    height: 3.5rem;
  }

  nav .flex.items-center.space-x-3 {
    font-size: 1.125rem;
    max-width: 60%;
  }

  nav .hidden.md\\:flex {
    display: flex;
    gap: 1.25rem;
  }

  nav .hidden.md\\:flex a,
  nav .hidden.md\\:flex button {
    font-size: 0.95rem;
  }

  #mobileMenuBtn {
    display: none;
  }

  #mobileMenu {
    display: none !important;
  }
}

/* Desktop mediano (900px+) */
@media (min-width: 900px) {
  nav .container {
    padding: 0 2rem;
  }

  nav .flex.items-center.space-x-3 {
    max-width: 65%;
    font-size: 1.15rem;
  }

  nav .hidden.md\\:flex {
    gap: 1.5rem;
  }

  nav .hidden.md\\:flex a,
  nav .hidden.md\\:flex button {
    font-size: 1rem;
  }
}

/* Desktop grande (1024px+) */
@media (min-width: 1024px) {
  nav .flex.items-center.space-x-3 svg {
    width: 4rem;
    height: 4rem;
  }

  nav .flex.items-center.space-x-3 {
    font-size: 1.25rem;
    max-width: none;
  }

  nav .flex.items-center.space-x-3 .hidden.lg\\:inline {
    display: inline;
  }

  nav .flex.items-center.space-x-3 .lg\\:hidden {
    display: none;
  }
}

/* Móviles (< 768px) */
@media (max-width: 767px) {
  nav {
    padding: 0.75rem 0;
  }

  nav .container {
    padding: 0 1rem;
    gap: 0.5rem;
  }

  nav .flex.items-center.space-x-3 {
    gap: 0.5rem;
    font-size: 0.875rem;
    max-width: calc(100% - 3rem);
    min-width: 0;
  }

  nav .flex.items-center.space-x-3 svg {
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
  }

  nav .flex.items-center.space-x-3 span {
    font-size: 0.75rem;
  }

  #mobileMenuBtn {
    display: block;
  }

  nav .hidden.md\\:flex {
    display: none;
  }
}

/* Móviles pequeños (< 480px) */
@media (max-width: 479px) {
  nav .flex.items-center.space-x-3 {
    font-size: 0.75rem;
    gap: 0.375rem;
  }

  nav .flex.items-center.space-x-3 svg {
    width: 2rem;
    height: 2rem;
  }

  #mobileMenu {
    padding: 0.75rem 1rem;
  }
}

/* ========================================
   ESPACIADO PARA CONTENIDO
   ======================================== */

/* Agregar padding-top al body o al primer elemento después del nav */
body {
  padding-top: 80px; /* Altura aproximada del nav */
}

@media (max-width: 767px) {
  body {
    padding-top: 65px;
  }
}

@media (max-width: 479px) {
  body {
    padding-top: 60px;
  }
}

/* ========================================
   ANIMACIONES SUAVES
   ======================================== */

#mobileMenu,
#docSubmenu,
#docsDropdown {
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   ACCESIBILIDAD
   ======================================== */

nav a:focus,
nav button:focus {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* Evitar problemas de tap en móviles */
@media (max-width: 767px) {
  nav a,
  nav button {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}