/* ============================================================
   Wuala Bottom Navigation Bar — Dark Glass
   Wuala eCommerce · v1.0.0
   ============================================================ */

/* ── Solo en mobile ── */
@media (min-width: 768px) {
  #wuala-bottomnav,
  #wbnav-drawer {
    display: none !important;
  }
}

/* ── Espacio inferior para que el contenido no quede tapado ── */
@media (max-width: 767px) {
  body {
    padding-bottom: calc(70px + env(safe-area-inset-bottom)) !important;
  }
}

/* ────────────────────────────────────────
   BARRA PRINCIPAL
──────────────────────────────────────── */

#wuala-bottomnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;

  display: flex;
  align-items: center;
  justify-content: space-around;

  height: 62px;
  padding: 0 4px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));

  /* Fallback sólido — las variables CSS del TPL lo sobreescriben si están definidas */
  background: rgba(15, 15, 20, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);

  border-top: 0.5px solid rgba(255, 255, 255, 0.07);

  /* Visible por defecto — JS agrega wbnav--hidden al scrollear */
  /* Usamos opacity+translate en lugar de solo translate
     para evitar repaint de fuentes icon en mobile */
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.22s ease, transform 0.22s ease;
  will-change: transform, opacity;
}

/* JS agrega esta clase para ocultar al scrollear hacia abajo */
#wuala-bottomnav.wbnav--hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

/* ────────────────────────────────────────
   ÍTEMS DE LA BARRA
──────────────────────────────────────── */

.wbnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;

  flex: 1;
  min-width: 0;
  padding: 4px 6px;

  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  outline: none;

  border-radius: 10px;
  transition: background 0.15s ease;

  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.wbnav-item:active {
  background: rgba(255, 255, 255, 0.06);
}

/* Pip indicador activo */
.wbnav-pip {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--wbnav-active, #D11C17);
  opacity: 0;
  margin-bottom: -2px;
  transition: opacity 0.2s ease;
}

.wbnav-item.wbnav--active .wbnav-pip {
  opacity: 1;
}

/* Ícono */
.wbnav-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wbnav-item .ti {
  font-size: 21px;
  line-height: 1;
  color: var(--wbnav-icon, rgba(255, 255, 255, 0.38));
  transition: color 0.18s ease, transform 0.18s ease;
  /* Forzar renderizado en GPU para evitar parpadeo al scrollear */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

.wbnav-item.wbnav--active .ti {
  color: var(--wbnav-active, #D11C17);
  transform: scale(1.08);
}

/* Label */
.wbnav-label {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  color: var(--wbnav-icon, rgba(255, 255, 255, 0.38));
  transition: color 0.18s ease;
}

.wbnav-item.wbnav--active .wbnav-label {
  color: var(--wbnav-active, #D11C17);
}

/* ────────────────────────────────────────
   BADGE DEL CARRITO
──────────────────────────────────────── */

.wbnav-badge {
  position: absolute;
  top: -5px;
  right: -7px;

  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 8px;

  background: var(--wbnav-badge, #D11C17);
  border: 1.5px solid rgba(15, 15, 20, 0.95);

  font-size: 8px;
  font-weight: 700;
  line-height: 13px;
  text-align: center;
  color: #fff;

  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.5, 0.64, 1);
}

.wbnav-badge.wbnav--has-items {
  opacity: 1;
  transform: scale(1);
}

/* ────────────────────────────────────────
   DRAWER "MÁS"
──────────────────────────────────────── */

#wbnav-drawer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}

#wbnav-drawer.wbnav--open {
  pointer-events: all;
}

#wbnav-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  transition: background 0.25s ease;
}

#wbnav-drawer.wbnav--open #wbnav-drawer-overlay {
  background: rgba(0, 0, 0, 0.55);
}

#wbnav-drawer-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;

  background: rgba(18, 18, 24, 0.99);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  border-top: 0.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px 20px 0 0;

  padding: 12px 16px calc(80px + env(safe-area-inset-bottom));

  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.34, 1.1, 0.64, 1);
}

#wbnav-drawer.wbnav--open #wbnav-drawer-panel {
  transform: translateY(0);
}

#wbnav-drawer-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0 auto 16px;
}

.wbnav-drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;

  width: 100%;
  padding: 14px 4px;

  background: transparent;
  border: none;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);

  font-size: 15px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  cursor: pointer;
  outline: none;
  text-align: left;

  transition: color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.wbnav-drawer-item:last-child {
  border-bottom: none;
}

.wbnav-drawer-item .ti {
  font-size: 22px;
  color: rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}

.wbnav-drawer-item:active {
  color: var(--wbnav-active, #D11C17);
}

.wbnav-drawer-item:active .ti {
  color: var(--wbnav-active, #D11C17);
}
