/* =========================================
   BOTÓN "CATEGORÍAS" Y PANEL DESPLEGABLE
   ========================================= */

/* Contenedor general */
.arbol-categories-wrapper {
  position: relative;
  display: inline-block;
  overflow: visible !important; /* evita recortes por el header */
}

/* Botón principal "CATEGORÍAS" */
.arbol-categories-toggle {
  text-transform: uppercase;
  padding: 8px 12px !important;
  font-family: 'Open Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 20px;
  letter-spacing: -0.6px;
  border: 2px solid #3e997b;
  border-radius: 8px;
  color: #3e997b;
  background-color: transparent;
  transition: all 350ms ease-out;
  position: relative;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  align-items: center;   
  gap: 0.5rem;
  display: flex;
}

.arbol-categories-toggle:hover,
.arbol-categories-toggle.is-active {
  /*background-color: #3e997b;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(62, 153, 123, 0.15);*/
}

.arbol-categories-toggle .arbol-cat-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: block;
}

.arbol-categories-toggle span {
  line-height: 1;        /* Ajustar altura visual del texto */
  display: inline-block;
}

/* =========================================
   PANEL PRINCIPAL (NIVEL 4 + NIVEL 5)
   ========================================= */

.arbol-categories-panel,
.arbol-categories-left,
.arbol-categories-right,
.arbol-categories-lv4 a,
.arbol-categories-lv5 a {
  font-family: 'Open Sans', sans-serif;
}

/* Panel completo */
.arbol-categories-panel {
  position: absolute;
  top: 100%;
  left: 0;
  display: none;
  width: auto;
  min-width: 1040px; /* más ancho para permitir 4 columnas reales */
  background: #fff;
  border: 2px solid #3e997b;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  z-index: 9999;
  transition: all 0.3s ease;
  padding: 0;
  overflow: hidden; /* mantiene esquinas redondeadas */
}

/* Mostrar cuando está abierto */
.arbol-categories-panel.is-open {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
}

/* =========================================
   PANEL IZQUIERDO (CATEGORÍAS NIVEL 4)
   ========================================= */
.arbol-categories-left {
  width: 28%;
  background: #f9fbfa;
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  overflow: visible;
}

.arbol-categories-lv4 {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
}

.arbol-cat4-item a {
  display: block;
  padding: 0.4rem 1rem;
  color: #333;
  text-decoration: none;
  font-size: 15px;
  line-height: 1.4;
  transition: background 0.3s;
}

.arbol-cat4-item:hover,
.arbol-cat4-item.is-active {
  background: #eaf5ef;
  border-left: 4px solid #3e997b;
  font-weight: 600;
}

/* =========================================
   PANEL DERECHO (CATEGORÍAS NIVEL 5)
   ========================================= */

/* Panel derecho (nivel 5) */
.arbol-categories-right {
  width: 72%;
  background: #fff;
  padding: 0.75rem 1rem 1rem;
  overflow: visible;
}

/* Lista de nivel 5: 4 deseadas, pero adaptables */
.arbol-categories-lv5 {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  columns: 4;             
  column-gap: 1.4rem;     
}


/* Grupo nivel 5 */
.arbol-lv5-group {
  display: none;
  animation: fadeIn 0.3s ease;
}

.arbol-lv5-group.is-active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Título del grupo */
.arbol-lv5-title {
  font-family: 'Open Sans', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin-bottom: 0.4rem;
}

/* Listado nivel 5 en 4 columnas amplias */
.arbol-categories-lv5 {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  columns: 4;             /* 4 columnas reales */
  column-gap: 1.9rem;     /* separación entre columnas */
  column-width: 150px;    /* ancho mínimo por columna */
}

/* Items de nivel 5 */
.arbol-categories-lv5 li a {
  display: block;
  padding: 0.15rem 0;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.5;
  transition: color 0.25s;
  break-inside: avoid;
  white-space: normal;     /* permite salto */
  word-wrap: break-word;   /* fuerza salto si hay palabra larga */
  overflow-wrap: anywhere; /* y si aún así es larga, rómpela */
}

.arbol-categories-lv5 li a:hover {
  color: #3e997b;
}

/* =========================================
   BOTÓN CERRAR PANEL
   ========================================= */
.arbol-categories-close {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #3e997b;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.3s ease;
}

.arbol-categories-close:hover {
  color: #1b4638;
}
