/*
 * Cabecera de una fila + barra inferior fija en celular/tablet (2026-10-01).
 * Se carga en la tienda y en el panel admin; todo va bajo body.tl-mobile.
 */
body.tl-mobile {
  --tl-card: var(--theme-surface);
  --tl-blue: var(--theme-primary);
}

/* =====================================================================
 * Celular y tablet (< 992px): cabecera en una sola fila + barra inferior
 * ===================================================================== */
.tl-bottomnav { display: none; }

@media (max-width: 991.98px) {
  /* Cabecera: menú · logo y nombre pegados a la izquierda. */
  body.tl-mobile.site-topbar-enabled .site-header-topbar {
    flex-wrap: nowrap !important;
    gap: 0.75rem !important;
    padding: 0.6rem 0.9rem !important;
    justify-content: flex-start !important;
  }
  body.tl-mobile.site-topbar-enabled .site-header-topbar .site-brand {
    order: 1;
    flex: 1 1 auto !important;
    justify-content: flex-start !important;
    min-width: 0;
    margin: 0;
  }
  body.tl-mobile.site-topbar-enabled .site-header-topbar .site-brand-copy {
    text-align: left !important;
    min-width: 0;
    max-width: none;
  }
  body.tl-mobile.site-topbar-enabled .site-header-topbar .site-brand-copy h1 {
    font-size: 1.25rem !important;
  }
  body.tl-mobile.site-topbar-enabled .site-header-topbar .site-brand-logo {
    width: 38px !important;
    height: 38px !important;
  }
  body.tl-mobile.site-topbar-enabled #menu-toggle { flex: 0 0 auto; }
  body.tl-mobile.tl-guest #menu-toggle { display: inline-flex !important; }

  /* El buscador sale de la cabecera: se abre con «Buscar» de la barra inferior. */
  body.tl-mobile.site-topbar-enabled .site-header-topbar .site-topbar-search {
    display: none;
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    top: calc(var(--site-topbar-height, 64px) + 0.5rem);
    max-width: none !important;
    z-index: 1046;
  }
  body.tl-mobile.tl-search-open .site-header-topbar .site-topbar-search { display: block; }
  body.tl-mobile.tl-search-open .site-topbar-search-input {
    background: var(--tl-card) !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55) !important;
  }

  /* Barra inferior fija. */
  body.tl-mobile { padding-bottom: calc(66px + env(safe-area-inset-bottom)) !important; }
  body.tl-mobile .tl-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1044;
    display: flex;
    align-items: stretch;
    height: calc(62px + env(safe-area-inset-bottom));
    padding: 0 0.25rem env(safe-area-inset-bottom);
    background: var(--tl-card);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
  }
  body.tl-mobile .tl-bn-item,
  body.tl-mobile .tl-bn-account {
    flex: 1 1 0;
    min-width: 0;
  }
  body.tl-mobile .tl-bn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--theme-highlight);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
  }
  body.tl-mobile .tl-bn-item svg { width: 22px; height: 22px; }
  body.tl-mobile .tl-bn-item.is-active,
  body.tl-mobile.tl-search-open #tl-bn-search { color: #fff; }

  /* Cuenta dentro de la barra. */
  body.tl-mobile .tl-bn-account { position: relative; display: flex; }
  body.tl-mobile .tl-bottomnav #auth-container {
    display: flex;
    flex: 1 1 auto;
    position: static !important;
  }
  body.tl-mobile .tl-bottomnav #auth-container .site-auth-trigger,
  body.tl-mobile .tl-bottomnav #auth-container #user-trigger {
    flex: 1 1 auto;
    width: 100% !important;
    max-width: none;
    height: 100%;
    min-height: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.2rem !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: var(--theme-highlight) !important;
    font-size: 0.72rem !important;
    transform: none !important;
  }
  body.tl-mobile .tl-bottomnav #auth-container .site-auth-trigger svg { width: 22px !important; height: 22px !important; }
  body.tl-mobile .tl-bottomnav .site-auth-label {
    position: static !important;
    width: auto;
    height: auto;
    clip: auto;
    font-size: 0 !important;
  }
  body.tl-mobile .tl-bottomnav .site-auth-label::after {
    content: "Ingresar";
    font-size: 0.72rem;
    font-weight: 600;
  }
  body.tl-mobile .tl-bottomnav #user-trigger #user-trigger-initials {
    width: 26px !important;
    height: 26px !important;
    background: var(--tl-blue) !important;
    color: #fff !important;
    font-size: 0.65rem;
  }
  body.tl-mobile .tl-bottomnav #user-trigger .d-flex { align-items: center !important; }
  body.tl-mobile .tl-bottomnav #user-trigger .small,
  body.tl-mobile .tl-bottomnav #user-trigger > svg { display: none !important; }
  body.tl-mobile .tl-bottomnav #user-trigger-name {
    max-width: 100%;
    font-size: 0.72rem !important;
    font-weight: 600;
    color: var(--theme-highlight) !important;
    text-align: center;
  }

  /* Menús de cuenta: se abren hacia arriba. */
  body.tl-mobile .tl-bottomnav #auth-menu,
  body.tl-mobile .tl-bottomnav #user-menu {
    position: fixed !important;
    left: 0.75rem !important;
    right: 0.75rem !important;
    top: auto !important;
    bottom: calc(70px + env(safe-area-inset-bottom)) !important;
    width: auto;
    min-width: 0 !important;
    max-width: none !important;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    margin: 0 !important;
  }

  /* Botones y avisos flotantes por encima de la barra. */
  body.tl-mobile .floating-social-stack { bottom: calc(76px + env(safe-area-inset-bottom)) !important; }
  body.tl-mobile .tl-footer { padding-bottom: 2rem; }
}

@media (max-width: 991.98px) {
  body.tl-mobile .live-recharge-stack[data-position^="bottom"] { bottom: calc(74px + env(safe-area-inset-bottom)) !important; }
  body.tl-mobile .tl-bottomnav #auth-menu,
  body.tl-mobile .tl-bottomnav #user-menu { z-index: 1100 !important; }
}

@media (max-width: 991.98px) {
  body.tl-mobile .tl-bottomnav #user-trigger > span:not(#user-trigger-initials) {
    flex: 0 0 auto !important;
    width: 100%;
    align-items: center !important;
    text-align: center !important;
  }
  body.tl-mobile .tl-bottomnav #user-trigger-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center !important;
  }
}

@media (max-width: 991.98px) {
  /* La hoja antigua daba margen y ancho propios al contenedor de cuenta. */
  body.tl-mobile .tl-bottomnav .tl-bn-account,
  body.tl-mobile .tl-bottomnav #auth-container {
    flex: 1 1 0 !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    order: 0 !important;
    justify-content: center !important;
  }
  body.tl-mobile .tl-bottomnav #auth-container .site-auth-trigger,
  body.tl-mobile .tl-bottomnav #auth-container #user-trigger {
    margin: 0 !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}
