/* Estructura y estilos del panel lateral de categorías */
.categories-drawer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0.25s ease;
}

.categories-drawer.is-open {
  visibility: visible;
  pointer-events: auto;
}

/* Capa de fondo oscurecida */
.categories-drawer__overlay {
  position: absolute;
  inset: 0;
  background-color: var(--overlay-bg);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.categories-drawer.is-open .categories-drawer__overlay {
  opacity: 1;
}

/* Panel lateral deslizante */
.categories-drawer__panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 400px;
  background-color: var(--bg-light);
  border-right: 1px solid var(--border-light);
  box-shadow: 12px 0 32px rgba(0, 0, 0, 0.2);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.categories-drawer.is-open .categories-drawer__panel {
  transform: translateX(0);
}

/* Cabecera del panel */
.categories-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
  padding: 0 1.5rem;
  background-color: var(--primary);
  border-bottom: 1px solid var(--primary-hover);
  flex-shrink: 0;
}

.categories-drawer__header-title-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.categories-drawer__header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-lg);
  line-height: 1;
  color: var(--accent);
  flex-shrink: 0;
}

.categories-drawer__title {
  margin: 0;
  color: var(--text-inverse);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.categories-drawer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--text-inverse);
  font-size: var(--fs-lg);
  line-height: 1;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.categories-drawer__close:hover {
  color: var(--accent);
  background-color: var(--primary-hover);
}

.categories-drawer__close:focus-visible {
  outline: 2px solid var(--accent);
}

/* Lista y contenido desplazable */
.categories-drawer__content {
  flex: 1 1 auto;
  padding: 0.75rem 0;
  overflow-y: auto;
  background-color: var(--bg-light);
  -webkit-overflow-scrolling: touch;
}

.categories-drawer__content::-webkit-scrollbar {
  width: 5px;
}

.categories-drawer__content::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 4px;
}

.categories-drawer__section-subtitle {
  display: none;
  margin: 0;
  padding: 0.75rem 1.5rem 0.35rem;
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.categories-drawer__nav-mobile {
  display: none;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
}

.categories-drawer__nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.categories-drawer__nav-list > li > a {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 1.5rem;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.categories-drawer__nav-list > li > a:hover {
  background-color: var(--bg);
  color: var(--accent);
}

.categories-drawer__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.categories-drawer__item {
  display: block;
}

/* Enlaces y filas de categoría */
.categories-drawer__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
  padding: 0.75rem 1.5rem;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  border-bottom: 1px solid var(--border-light);
  box-sizing: border-box;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.categories-drawer__item:last-child .categories-drawer__link {
  border-bottom: none;
}

.categories-drawer__link:hover {
  background-color: var(--bg);
  color: var(--accent);
}

.categories-drawer__item-main {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-width: 0;
  flex: 1 1 auto;
}

.categories-drawer__category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  font-size: var(--fs-md);
  color: var(--accent);
  background-color: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.categories-drawer__category-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.categories-drawer__link:hover .categories-drawer__category-icon {
  border-color: var(--accent);
  background-color: var(--primary-subtle);
}

.categories-drawer__name {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.categories-drawer__meta {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.categories-drawer__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-md);
  line-height: 1;
  color: var(--text-muted);
  transition: transform 0.15s ease, color 0.15s ease;
}

.categories-drawer__link:hover .categories-drawer__arrow {
  color: var(--accent);
  transform: translateX(2px);
}

.categories-drawer__empty {
  margin: 0;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: center;
}

/* Adaptación móvil */
@media (max-width: 768px) {
  .categories-drawer__panel {
    max-width: 88vw;
  }

  .categories-drawer__header {
    height: 3.5rem;
    padding: 0 1.25rem;
  }

  .categories-drawer__section-subtitle,
  .categories-drawer__nav-mobile {
    display: block;
  }

  .categories-drawer__link {
    padding: 0.75rem 1.25rem;
  }
}