
/* ==========================================================
   SPRINT 11 — HEADER DEFINITIVO
   ========================================================== */

:root {
  --header-green: #063b28;
  --header-green-2: #0a7a44;
  --header-green-3: #0b8a4b;
  --header-text: #26362f;
  --header-line: #e7eee9;
  --header-white: #ffffff;
  --header-shadow: 0 18px 45px rgba(3, 48, 31, .10);
}

.site-header {
  position: relative;
  z-index: 1000;
  width: 100%;
  background: var(--header-white);
  border-bottom: 1px solid var(--header-line);
}

.site-header .topbar {
  background: var(--header-green);
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
}

.site-header .topbar-inner {
  min-height: 34px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
  align-items: center;
}

.site-header .topbar-inner > :last-child {
  justify-self: end;
}

.site-header .topbar a {
  color: inherit;
  text-decoration: none;
}

.site-header .nav-shell {
  min-height: 90px;
  display: grid;
  grid-template-columns: minmax(250px, 360px) 1fr auto;
  align-items: center;
  gap: 28px;
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  max-width: 360px;
  text-decoration: none;
}

.site-header .brand img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 78px;
  object-fit: contain;
  object-position: left center;
}

.site-header .main-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(18px, 2vw, 30px);
}

.site-header .main-nav a {
  position: relative;
  color: var(--header-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  padding: 12px 0;
}

.site-header .main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 7px;
  height: 2px;
  background: var(--header-green-3);
  transition: right .22s ease;
}

.site-header .main-nav a:hover::after,
.site-header .main-nav a:focus-visible::after {
  right: 0;
}

.site-header .nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-header .btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.site-header .btn:hover {
  transform: translateY(-1px);
}

.site-header .access-btn {
  color: var(--header-green-2);
  border: 1.5px solid var(--header-green-2);
  background: #fff;
}

.site-header .access-btn:hover {
  box-shadow: 0 10px 24px rgba(8, 120, 67, .13);
}

.site-header .access-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  flex: 0 0 auto;
}

.site-header .nav-cta {
  color: #fff;
  background: var(--header-green-3);
  box-shadow: var(--header-shadow);
}

.site-header .menu-btn {
  display: none;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 10px;
  cursor: pointer;
}

.site-header .menu-btn span {
  display: block;
  height: 3px;
  margin: 5px 0;
  border-radius: 20px;
  background: var(--header-green);
  transition: transform .2s ease, opacity .2s ease;
}

.site-header.menu-open .menu-btn span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.site-header.menu-open .menu-btn span:nth-child(2) {
  opacity: 0;
}

.site-header.menu-open .menu-btn span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

@media (max-width: 1120px) {
  .site-header .nav-shell {
    grid-template-columns: minmax(230px, 320px) 1fr auto;
    gap: 18px;
  }

  .site-header .main-nav {
    gap: 16px;
  }

  .site-header .main-nav a {
    font-size: 14px;
  }

  .site-header .btn {
    padding: 0 17px;
  }
}

@media (max-width: 900px) {
  .site-header .topbar {
    display: none;
  }

  .site-header .nav-shell {
    min-height: 90px;
    grid-template-columns: minmax(210px, 1fr) auto;
    gap: 14px;
    position: relative;
  }

  .site-header .brand {
    max-width: 330px;
  }

  .site-header .brand img {
    max-height: 72px;
  }

  .site-header .menu-btn {
    display: inline-block;
    order: 3;
  }

  .site-header .nav-actions {
    gap: 9px;
  }

  .site-header .nav-cta {
    display: none;
  }

  .site-header .main-nav {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 14px 20px 22px;
    background: #fff;
    border-top: 1px solid var(--header-line);
    border-bottom: 1px solid var(--header-line);
    box-shadow: 0 20px 30px rgba(0,0,0,.08);
  }

  .site-header.menu-open .main-nav {
    display: flex;
  }

  .site-header .main-nav a {
    padding: 14px 4px;
    border-bottom: 1px solid #edf1ee;
  }

  .site-header .main-nav a:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 560px) {
  .site-header .nav-shell {
    min-height: 86px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding-left: 16px;
    padding-right: 12px;
  }

  .site-header .brand {
    max-width: 285px;
  }

  .site-header .brand img {
    max-height: 66px;
  }

  .site-header .nav-actions {
    gap: 4px;
  }

  .site-header .access-btn {
    min-width: 46px;
    width: 46px;
    height: 46px;
    min-height: 46px;
    padding: 0;
  }

  .site-header .access-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .site-header .menu-btn {
    width: 44px;
    height: 44px;
    padding: 9px;
  }
}

@media (max-width: 420px) {
  .site-header .brand {
    max-width: 245px;
  }

  .site-header .brand img {
    max-height: 62px;
  }

  .site-header .nav-shell {
    padding-left: 10px;
    padding-right: 8px;
  }
}

/* Protección contra iconos antiguos o duplicados */
.site-header .legacy-access,
.site-header .mobile-access-old,
.site-header .floating-login,
.site-header .access-shortcut,
.site-header > a[href*="alfanet360"]:not(.access-btn) {
  display: none !important;
}

/* =========================================================
   CORRECCIÓN MENÚ HAMBURGUESA MÓVIL
   ========================================================= */

.menu-btn {
  display: none;
  width: 48px;
  height: 48px;
  padding: 10px;
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  position: relative;
  z-index: 1005;
  appearance: none;
  -webkit-appearance: none;
}

.menu-btn span {
  display: block !important;
  width: 28px !important;
  height: 3px !important;
  min-height: 3px !important;
  border-radius: 20px;
  background-color: #071c12 !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform-origin: center;
  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}

/* Animación cuando el menú está abierto */
.menu-btn.is-open span:nth-child(1),
.menu-btn[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.menu-btn.is-open span:nth-child(2),
.menu-btn[aria-expanded="true"] span:nth-child(2) {
  opacity: 0 !important;
}

.menu-btn.is-open span:nth-child(3),
.menu-btn[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

@media (max-width: 768px) {
  .nav-shell {
    position: relative;
  }

  .menu-btn {
    display: inline-flex !important;
    flex: 0 0 48px;
  }

  .menu-btn span {
    background: #071c12 !important;
  }

  .nav-actions {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
  }
}