/* ===== HAMBURGER MENU STYLES ===== */

:root {
  --primary-color: #335026;
  --light-gray: #f5f5f5;
}

/* Botón Hamburguesa - Oculto en desktop por defecto */
.menu-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  gap: 0.35rem;
  z-index: 1002;
  position: relative;
}

.menu-toggle:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.hamburger-line {
  width: 25px;
  height: 3px;
  background-color: var(--primary-color);
  border-radius: 2px;
  transition: all 0.3s ease;
  display: block;
}

/* ===== MOBILE STYLES (hasta 768px) ===== */
@media (max-width: 768px) {
  /* Mostrar botón hamburguesa en móvil */
  .menu-toggle {
    display: flex !important;
    order: 2;
    pointer-events: auto;
  }

  /* Animación del hamburguesa cuando está abierto */
  .menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(10px, 10px);
  }

  .menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
  }

  /* Menú desplegable - Oculto por defecto */
  #primary-menu-nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background-color: white;
    width: 100%;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    z-index: 1001;
    display: none !important;
    flex-direction: column;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    pointer-events: none;
  }

  /* Mostrar menú cuando tiene clase active */
  #primary-menu-nav.active {
    display: flex !important;
    pointer-events: auto;
  }

  /* Lista de menú */
  #primary-menu {
    display: flex;
    flex-direction: column;
    width: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  /* Items del menú */
  #primary-menu li {
    width: 100%;
    border-bottom: 1px solid #f0f0f0;
    list-style: none;
  }

  #primary-menu li:last-child {
    border-bottom: none;
  }

  /* Enlaces del menú */
  #primary-menu a {
    display: block;
    padding: 1rem;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  #primary-menu a:hover {
    background-color: var(--light-gray);
    color: var(--primary-color);
  }

  /* Indicador de subelementos */
  #primary-menu li.menu-item-has-children > a::after {
    content: ' ▼';
    font-size: 0.7rem;
    margin-left: 0.5rem;
  }

  /* Subelementos del menú */
  #primary-menu ul {
    display: none;
    flex-direction: column;
    background-color: #f9f9f9;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
  }

  /* Mostrar subelementos cuando el padre tiene clase active */
  #primary-menu li.menu-item-has-children.active > ul {
    display: flex;
  }

  #primary-menu ul li {
    border-bottom: 1px solid #e0e0e0;
    width: 100%;
  }

  #primary-menu ul a {
    padding: 0.75rem 1rem 0.75rem 2rem;
    font-size: 0.9rem;
    color: #666;
  }

  #primary-menu ul a:hover {
    background-color: #f0f0f0;
    color: var(--primary-color);
  }

  /* Header sticky en móvil */
  header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    gap: 1rem;
  }

  .logo {
    flex: 1;
    min-width: 0;
  }

  .logo a,
  .logo img {
    max-width: 100%;
    height: auto;
    display: block;
  }
}

/* ===== TABLET/DESKTOP STYLES (769px+) ===== */
@media (min-width: 769px) {
  /* Ocultar botón hamburguesa en desktop */
  .menu-toggle {
    display: none !important;
    pointer-events: none;
  }

  /* Mostrar menú normal en desktop */
  #primary-menu-nav {
    display: flex !important;
    position: static;
    background-color: transparent;
    box-shadow: none;
    max-height: none;
    overflow-y: visible;
    top: auto;
    left: auto;
    right: auto;
    width: auto;
  }

  #primary-menu {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-direction: row;
  }

  #primary-menu li {
    position: relative;
    border-bottom: none;
  }

  #primary-menu a {
    display: block;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.2s ease;
  }

  #primary-menu a:hover {
    color: var(--primary-color);
  }

  /* Subelementos en desktop */
  #primary-menu ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    flex-direction: column;
    background-color: white;
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: 200px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    z-index: 100;
  }

  /* Mostrar subelementos al pasar el cursor */
  #primary-menu li:hover > ul {
    display: flex;
  }

  #primary-menu ul li {
    width: 100%;
    border-bottom: 1px solid #f0f0f0;
  }

  #primary-menu ul li:last-child {
    border-bottom: none;
  }

  #primary-menu ul a {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  /* Remover indicador de subelementos en desktop */
  #primary-menu li.menu-item-has-children > a::after {
    content: '';
  }

  header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    gap: 2rem;
  }

  .logo {
    flex: 0 0 auto;
  }

  .logo a,
  .logo img {
    max-width: 100%;
    height: auto;
    display: block;
  }
}
