/* TINTIN mobile tabbar — source of truth for 0–767px. */
@media (min-width: 768px) {
  #tt-tabbar { display:none !important; visibility:hidden !important; pointer-events:none !important; }
}

@media (max-width: 767px) {
  #tt-header-desktop-tablet,
  #tt-header-tablet { display:none !important; visibility:hidden !important; pointer-events:none !important; }

  #tt-tabbar {
    --tt-mobile-step: 0px;
    display:grid !important;
    grid-template-columns:repeat(5,minmax(0,1fr));
    align-items:center;
    left:50%;
    bottom:max(12px,env(safe-area-inset-bottom));
    width:min(420px,calc(100vw - 20px));
    max-width:none;
    min-height:70px;
    padding:8px 10px;
    gap:0;
    border:1px solid rgba(158,64,98,.2);
    border-radius:999px;
    background:#fff !important;
    box-shadow:0 14px 38px rgba(56,21,34,.18),0 0 0 1px rgba(255,255,255,.72) inset;
    overflow:visible;
    isolation:isolate;
    transition:width .34s cubic-bezier(.2,.85,.2,1),min-height .34s cubic-bezier(.2,.85,.2,1),padding .34s cubic-bezier(.2,.85,.2,1),border-radius .34s cubic-bezier(.2,.85,.2,1),box-shadow .34s ease;
    will-change:width,min-height,padding;
  }

  #tt-tabbar .tt-tabbar-btn {
    z-index:2;
    width:100%;
    min-width:0;
    min-height:54px;
    padding:7px 2px;
    gap:3px;
    color:#40363a !important;
    background:transparent !important;
    border:0 !important;
    box-shadow:none !important;
    transform:none;
  }

  #tt-tabbar .tt-tabbar-btn::after { display:none; }
  #tt-tabbar .tt-tabbar-btn svg,
  #tt-tabbar .tt-tabbar-avatar {
    width:23px !important;
    height:23px !important;
    transition:transform .34s cubic-bezier(.2,.85,.2,1),color .2s ease;
  }

  #tt-tabbar .tt-tabbar-avatar {
    border-radius:7px !important;
    object-fit:cover !important;
  }

  #tt-tabbar .tt-tabbar-btn span:last-child {
    display:block !important;
    max-height:16px;
    opacity:1;
    font-size:clamp(.54rem,2.25vw,.64rem);
    letter-spacing:.025em;
    line-height:1.1;
    white-space:nowrap;
    transform:translateY(0);
    transition:max-height .28s cubic-bezier(.2,.85,.2,1),opacity .18s ease,transform .28s cubic-bezier(.2,.85,.2,1);
  }

  #tt-tabbar.tt-tabbar-compact {
    width:min(316px,calc(100vw - 54px));
    min-height:58px;
    padding:5px 8px;
    border-radius:25px;
    box-shadow:0 10px 28px rgba(56,21,34,.16),0 0 0 1px rgba(255,255,255,.8) inset;
  }

  #tt-tabbar.tt-tabbar-compact .tt-tabbar-btn {
    min-height:48px;
    padding:5px 2px;
    gap:0;
  }

  #tt-tabbar.tt-tabbar-compact .tt-tabbar-btn span:last-child {
    max-height:0;
    opacity:0;
    transform:translateY(5px);
  }

  #tt-tabbar.tt-tabbar-compact .tt-tabbar-btn svg,
  #tt-tabbar.tt-tabbar-compact .tt-tabbar-avatar {
    width:24px !important;
    height:24px !important;
  }

  #tt-tabbar.tt-tabbar-compact .tt-tabbar-btn.active svg,
  #tt-tabbar.tt-tabbar-compact .tt-tabbar-btn.active .tt-tabbar-avatar,
  #tt-tabbar.tt-tabbar-compact .tt-tabbar-btn[aria-expanded="true"] svg,
  #tt-tabbar.tt-tabbar-compact .tt-tabbar-btn[aria-expanded="true"] .tt-tabbar-avatar {
    transform:translateY(-4px) scale(1.08);
  }

  #tt-tabbar .tt-tabbar-btn.active,
  #tt-tabbar .tt-tabbar-btn[aria-expanded="true"] { color:#a3154b !important; }
  #tt-tabbar .tt-tabbar-btn.active svg,
  #tt-tabbar .tt-tabbar-btn.active .tt-tabbar-avatar,
  #tt-tabbar .tt-tabbar-btn[aria-expanded="true"] svg,
  #tt-tabbar .tt-tabbar-btn[aria-expanded="true"] .tt-tabbar-avatar { transform:translateY(-8px) scale(1.12); }

  /* Configuración combinada: si el editor oculta Inicio solo quedan cuatro
     tabs para invitado y cinco cuando Auth habilita Alertas. La regla de
     notificaciones por sí sola reserva seis; aquí se recompone la geometría
     para respetar ambas configuraciones sin dejar una columna fantasma. */
  html[data-tt-mobile-home="hidden"] body #tt-tabbar:has(#tabbar-notifications:not([hidden])) {
    grid-template-columns:repeat(5,minmax(0,1fr)) !important;
    width:min(420px,calc(100vw - 20px)) !important;
    padding-inline:10px !important;
  }

  html[data-tt-mobile-home="hidden"] body #tt-tabbar.tt-tabbar-compact:has(#tabbar-notifications:not([hidden])) {
    width:min(316px,calc(100vw - 54px)) !important;
    padding-inline:8px !important;
  }

  .tt-mobile-nav-halo,
  .tt-mobile-nav-indicator {
    position:absolute;
    left:0;
    pointer-events:none;
    transform:translateX(var(--tt-mobile-x,0));
    transition:transform 380ms cubic-bezier(.2,.85,.2,1),width 300ms cubic-bezier(.2,.85,.2,1),opacity .15s ease;
    opacity:0;
  }

  .tt-mobile-nav-halo {
    z-index:0;
    top:-11px;
    width:var(--tt-mobile-w,54px);
    height:54px;
    border-radius:50%;
    background:#fde6ef;
    border:1px solid #f4c6d7;
    box-shadow:0 8px 18px rgba(139,38,66,.13);
  }

  .tt-mobile-nav-indicator {
    z-index:1;
    bottom:5px;
    width:var(--tt-mobile-w,54px);
    height:3px;
    border-radius:999px;
    background:#a3154b;
  }

  #tt-tabbar.tt-tabbar-compact .tt-mobile-nav-halo { top:-8px; height:48px; }
  #tt-tabbar.tt-tabbar-compact .tt-mobile-nav-indicator { bottom:3px; }

  #tt-tabbar.tt-mobile-nav-ready .tt-mobile-nav-halo,
  #tt-tabbar.tt-mobile-nav-ready .tt-mobile-nav-indicator { opacity:1; }
  #tt-store-gate-network-notice {
    bottom:max(92px,calc(82px + env(safe-area-inset-bottom))) !important;
  }
  body { padding-bottom:max(96px,calc(84px + env(safe-area-inset-bottom))) !important; }

  /* Superficies móviles: la hoja ocupa siempre todo el viewport. La barra
     debe quedar SIEMPRE por debajo del backdrop compartido (1450) y de las
     superficies modales (1460), para que un panel abierto (Tienda,
     notificaciones, carrito, cuenta) la cubra visualmente por completo y
     bloquee sus clics de forma real (además de `inert`, no solo por z-index).
     Con la barra en 1480 (por encima de 1450/1460) quedaba visible y activa
     encima de la hoja abierta: root cause del "clic detrás del panel". */
  #tt-tabbar { bottom:max(16px,env(safe-area-inset-bottom)); z-index:1400 !important; }
  #tt-tabbar .tt-tabbar-btn { position:relative; z-index:3; }
  #tt-tabbar .tt-tabbar-btn.active svg,
  #tt-tabbar .tt-tabbar-btn.active .tt-tabbar-avatar,
  #tt-tabbar .tt-tabbar-btn[aria-expanded="true"] svg,
  #tt-tabbar .tt-tabbar-btn[aria-expanded="true"] .tt-tabbar-avatar { transform:translateY(-3px) scale(1.06); }
  .tt-mobile-nav-halo { z-index:1; top:1px; width:52px; height:52px; }
  .tt-mobile-nav-indicator { z-index:2; bottom:4px; width:52px; }
  #tt-tabbar .tt-tabbar-btn.active,
  #tt-tabbar .tt-tabbar-btn[aria-expanded="true"] { z-index:4; }
  #tt-tabbar.tt-tabbar-compact .tt-mobile-nav-halo { top:0; width:46px; height:46px; }
  #tt-tabbar.tt-tabbar-compact .tt-mobile-nav-indicator { bottom:3px; width:46px; }

  /* Menú legado y menú hamburguesa comparten la misma superficie limpia. */
  .tt-mobile-menu { padding:max(16px,env(safe-area-inset-top)) 16px max(24px,env(safe-area-inset-bottom)); }
  .tt-mobile-menu-header { min-height:52px; margin-bottom:24px; }
  .tt-mobile-close { width:44px; height:44px; display:inline-flex; align-items:center; justify-content:center; border:1px solid #efcbd8; border-radius:50%; background:#fff; }
  .tt-mobile-nav { width:min(100%,560px); margin:0 auto; }
  .tt-mobile-nav a, .tt-mobile-nav button { min-height:58px; padding:16px 18px; border-radius:14px; }
  .tt-mobile-nav a.active, .tt-mobile-nav button.active { margin:4px 0; padding-inline:18px; background:#fde9f0; box-shadow:none; }
}

@media (max-width: 350px) {
  #tt-tabbar:not(.tt-tabbar-compact) { width:calc(100vw - 12px); padding-inline:5px; }
  #tt-tabbar.tt-tabbar-compact { width:calc(100vw - 42px); padding-inline:6px; }
  html[data-tt-mobile-home="hidden"] body #tt-tabbar:not(.tt-tabbar-compact):has(#tabbar-notifications:not([hidden])) {
    width:calc(100vw - 12px) !important;
    padding-inline:5px !important;
  }
  html[data-tt-mobile-home="hidden"] body #tt-tabbar.tt-tabbar-compact:has(#tabbar-notifications:not([hidden])) {
    width:calc(100vw - 42px) !important;
    padding-inline:6px !important;
  }
  #tt-tabbar .tt-tabbar-btn span:last-child { font-size:.52rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tt-mobile-nav-halo,
  .tt-mobile-nav-indicator,
  #tt-tabbar .tt-tabbar-btn svg,
  #tt-tabbar .tt-tabbar-avatar,
  #tt-tabbar .tt-tabbar-btn span:last-child,
  #tt-tabbar { transition:none !important; }
}
