#main-header {
  position: relative;
  z-index: 1000;
  overflow: hidden;
  min-height: 5rem;
  transition: min-height 0.3s ease, background-color 0.3s ease;
  transform: translateZ(0);
  backface-visibility: hidden;
  background-color: #ffffff !important;
}

.dark #main-header {
  background-color: #000000 !important;
}

#main-header.header-sticky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  background-color: #ffffff !important;
}

.dark #main-header.header-sticky {
  background-color: #000000 !important;
}

.dark a.text-blue-600 {
  color: #3b82f6 !important;
}

#logo-container {
  transition: transform 0.3s ease;
  transform-origin: left center;
}

#certificate-container,
#header-divider {
  transition: opacity 0.3s ease;
}

#main-header.header-compact {
  min-height: 3.5rem;
}

#main-header.header-compact #logo-container {
  transform: scale(0.8);
}

#main-header.header-compact #certificate-container,
#main-header.header-compact #header-divider {
  opacity: 0;
  pointer-events: none;
}

#top-right-buttons-container {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  z-index: 1001;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

#main-nav {
  position: absolute;
  right: 9rem;
  transform: translateX(0);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#main-header.header-compact #main-nav {
  transform: translateX(calc(-50vw + 10.5rem + 50%));
}

#main-nav > div {
  display: flex;
  gap: 0.2rem;
  padding: 0 0.5rem;
}

#main-nav a {
  padding: 0 0.5rem;
}

@media (max-width: 1100px) {
  body.site-header-mobile-offset {
    padding-top: calc(124px + env(safe-area-inset-top, 0px));
  }

  #top-right-buttons-container {
    display: none !important;
  }

  #main-header {
    display: none !important;
  }

  #mobile-header-custom {
    display: block !important;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 50;
    box-shadow: none;
    transition: background-color 220ms ease-out;
    transform: translateZ(0);
    backface-visibility: hidden;
  }

  .dark #mobile-header-custom,
  .dark #mobile-second-floor {
    background-color: #000000;
    border-color: #1a1a1a;
  }

  #mobile-controls-compact {
    display: none !important;
  }

  #mobile-first-floor {
    overflow: hidden;
    max-height: 72px;
    will-change: max-height, padding;
    transition: max-height 420ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease-out, padding 420ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  #mobile-header-custom.compact #mobile-first-floor {
    max-height: 0;
    opacity: 0;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }

  #mobile-second-floor {
    border-top-color: transparent !important;
    transition: border-color 220ms ease-out;
  }

  #mobile-header-custom.compact #mobile-second-floor {
    border-top: none;
  }

  #mobile-menu-custom {
    transition: all 0.3s ease;
    transform: translateZ(0);
    backface-visibility: hidden;
  }

  #mobile-menu-custom.hidden {
    opacity: 0;
    transform: translateY(-10px) translateZ(0);
    pointer-events: none;
  }

  #mobile-menu-custom:not(.hidden) {
    opacity: 1;
    transform: translateY(0) translateZ(0);
  }

  #mobile-menu-custom a {
    transition: all 0.2s ease;
    transform: translateZ(0);
  }

  #mobile-menu-custom:not(.hidden) a {
    animation: mobileMenuStagger 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  
  #mobile-menu-custom:not(.hidden) a:nth-child(1) { animation-delay: 0.04s; }
  #mobile-menu-custom:not(.hidden) a:nth-child(2) { animation-delay: 0.08s; }
  #mobile-menu-custom:not(.hidden) a:nth-child(3) { animation-delay: 0.12s; }
  #mobile-menu-custom:not(.hidden) a:nth-child(4) { animation-delay: 0.16s; }
  #mobile-menu-custom:not(.hidden) a:nth-child(5) { animation-delay: 0.20s; }
  #mobile-menu-custom:not(.hidden) a:nth-child(6) { animation-delay: 0.24s; }
  #mobile-menu-custom:not(.hidden) a:nth-child(7) { animation-delay: 0.28s; }
  #mobile-menu-custom:not(.hidden) a:nth-child(8) { animation-delay: 0.32s; }

  @keyframes mobileMenuStagger {
    0% {
      opacity: 0;
      transform: translateY(-10px) translateZ(0);
    }
    100% {
      opacity: 1;
      transform: translateY(0) translateZ(0);
    }
  }

  #mobile-menu-custom a:hover {
    transform: translateX(4px) translateZ(0);
  }



  #logo-mobile {
    transition: height 320ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  #iso-cert-mobile {
    transition: opacity 220ms ease-out, transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  #mobile-header-custom.compact #iso-cert-mobile {
    opacity: 0;
    transform: scale(0.8) translateZ(0);
    transition: opacity 220ms ease-out, transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
  }

  #mobile-header-custom.compact #logo-mobile {
    height: 2.5rem;
  }
}

@media (min-width: 1100px) {
  #mobile-header-custom {
    display: none !important;
  }
}

/* Animaciones del selector de idiomas globales */
#language-dropdown,
#language-dropdown-custom {
  transform-origin: top right;
}

#selected-language img,
#selected-language-mobile img,
#language-dropdown img,
#language-dropdown-custom img,
.lang-option img {
  display: block;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1rem;
  object-fit: contain;
  object-position: center;
}

#language-dropdown:not(.hidden),
#language-dropdown-custom:not(.hidden) {
  animation: langDropdownScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

#language-dropdown:not(.hidden) a,
#language-dropdown-custom:not(.hidden) a {
  animation: langOptionFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

#language-dropdown:not(.hidden) a:nth-child(1), #language-dropdown-custom:not(.hidden) a:nth-child(1) { animation-delay: 0.05s; }
#language-dropdown:not(.hidden) a:nth-child(2), #language-dropdown-custom:not(.hidden) a:nth-child(2) { animation-delay: 0.1s; }
#language-dropdown:not(.hidden) a:nth-child(3), #language-dropdown-custom:not(.hidden) a:nth-child(3) { animation-delay: 0.15s; }
#language-dropdown:not(.hidden) a:nth-child(4), #language-dropdown-custom:not(.hidden) a:nth-child(4) { animation-delay: 0.2s; }
#language-dropdown:not(.hidden) a:nth-child(5), #language-dropdown-custom:not(.hidden) a:nth-child(5) { animation-delay: 0.25s; }

@keyframes langDropdownScaleIn {
  0% {
    opacity: 0;
    transform: translateY(-5px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes langOptionFadeIn {
  0% {
    opacity: 0;
    transform: none;
  }
  100% {
    opacity: 1;
    transform: none;
  }
}