/*
 * LB APPAREL Hub — PWA launch + slow-loading UI
 * Global, injected from /_inc/head_meta.php.
 * No business data is cached or duplicated by this layer.
 */

:root {
  --lb-pwa-red: #a63232;
  --lb-pwa-ink: #282828;
}

/* -------------------------------------------------------------------------
   Launch splash — shown only when the Hub is opened as an installed PWA,
   once per application session.
   ------------------------------------------------------------------------- */
.lb-pwa-splash {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  display: grid;
  place-items: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  background: #fff;
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  animation: lbPwaSplashExit 260ms ease 1180ms forwards;
}

.lb-pwa-splash__content {
  width: min(360px, 78vw);
  display: grid;
  justify-items: center;
  gap: 20px;
}

.lb-pwa-splash__logo {
  display: block;
  width: min(320px, 72vw);
  max-width: 100%;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transform: translateY(5px) scale(.985);
  animation: lbPwaLogoIn 360ms cubic-bezier(.22,.75,.2,1) 70ms forwards;
}

.lb-pwa-splash__line {
  position: relative;
  display: block;
  width: min(224px, 50vw);
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
}

.lb-pwa-splash__line::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--lb-pwa-red);
  transform: scaleX(0);
  transform-origin: center center;
  animation: lbPwaLineOpen 620ms cubic-bezier(.22,.8,.22,1) 300ms forwards;
}

@keyframes lbPwaLogoIn {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes lbPwaLineOpen {
  0%   { transform: scaleX(0); opacity: .75; }
  100% { transform: scaleX(1); opacity: 1; }
}

@keyframes lbPwaSplashExit {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}

/* -------------------------------------------------------------------------
   Slow operation loader — intentionally small and non-blocking.
   It appears only after a request/navigation has crossed the delay threshold.
   ------------------------------------------------------------------------- */
.lb-pwa-loader {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 2147483645;
  width: 76px;
  height: 76px;
  transform: translate(-50%, 14px) scale(.96);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
}

.lb-pwa-loader.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0) scale(1);
}

.lb-pwa-loader__shell {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 8px 28px rgba(17,24,39,.16), 0 0 0 1px rgba(17,24,39,.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lb-pwa-loader__ring {
  position: absolute;
  inset: 5px;
  width: 66px;
  height: 66px;
  transform-origin: 50% 50%;
  animation: lbPwaRingSpin 900ms linear infinite;
}

.lb-pwa-loader__track,
.lb-pwa-loader__progress {
  fill: none;
  stroke-width: 3.2;
}

.lb-pwa-loader__track {
  stroke: rgba(166,50,50,.13);
}

.lb-pwa-loader__progress {
  stroke: var(--lb-pwa-red);
  stroke-linecap: round;
  stroke-dasharray: 18 120;
  stroke-dashoffset: 0;
  animation: lbPwaRingFill 1200ms ease-in-out infinite;
}

.lb-pwa-loader__logo-wrap {
  position: absolute;
  inset: 15px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 999px;
  background: #000;
}

.lb-pwa-loader__logo {
  display: block;
  width: 54px;
  height: 41px;
  max-width: none;
  object-fit: contain;
}

@keyframes lbPwaRingSpin {
  to { transform: rotate(360deg); }
}

@keyframes lbPwaRingFill {
  0%   { stroke-dasharray: 12 126; stroke-dashoffset: 0; }
  48%  { stroke-dasharray: 104 34; stroke-dashoffset: -14; }
  100% { stroke-dasharray: 12 126; stroke-dashoffset: -126; }
}

@media (max-width: 600px) {
  .lb-pwa-loader {
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: 70px;
    height: 70px;
  }
  .lb-pwa-loader__shell { width: 70px; height: 70px; }
  .lb-pwa-loader__ring { inset: 4px; width: 62px; height: 62px; }
  .lb-pwa-loader__logo-wrap { inset: 14px; }
  .lb-pwa-loader__logo { width: 50px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .lb-pwa-splash,
  .lb-pwa-splash__logo,
  .lb-pwa-splash__line::after,
  .lb-pwa-loader,
  .lb-pwa-loader__ring,
  .lb-pwa-loader__progress {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* -------------------------------------------------------------------------
   Install prompt — shown only when installation is relevant and available.
   Chromium/Android uses the native browser install prompt. iOS/iPadOS and
   Safari on macOS receive concise manual instructions because those browsers
   do not expose the same programmable install prompt.
   ------------------------------------------------------------------------- */
.lb-pwa-install {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 2147483644;
  width: min(430px, calc(100vw - 40px));
  min-height: 84px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 48px 18px 20px;
  border: 1px solid rgba(40,40,40,.10);
  border-radius: 16px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 16px 42px rgba(17,24,39,.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(.985);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
  pointer-events: none;
}

.lb-pwa-install.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.lb-pwa-install__copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.lb-pwa-install__title {
  color: var(--lb-pwa-ink);
  font-size: 15px;
  line-height: 1.25;
  font-weight: 700;
}

.lb-pwa-install__message {
  color: rgba(40,40,40,.72);
  font-size: 13px;
  line-height: 1.4;
}

.lb-pwa-install__action {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 10px;
  background: var(--lb-pwa-red);
  color: #fff;
  padding: 10px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 120ms ease, opacity 120ms ease;
}

.lb-pwa-install__action:hover { transform: translateY(-1px); }
.lb-pwa-install__action:active { transform: translateY(0); }
.lb-pwa-install__action:disabled { opacity: .58; cursor: default; }

.lb-pwa-install__close {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  top: 10px;
  right: 11px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(40,40,40,.58);
  font: inherit;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.lb-pwa-install__close:hover {
  background: rgba(40,40,40,.06);
  color: var(--lb-pwa-ink);
}

.lb-pwa-install--ios,
.lb-pwa-install--mac-safari {
  grid-template-columns: 1fr;
}

@media (max-width: 740px) {
  .lb-pwa-install {
    left: 16px;
    right: 16px;
    bottom: calc(94px + env(safe-area-inset-bottom));
    width: auto;
    min-height: 80px;
    padding: 16px 44px 16px 17px;
    border-radius: 15px;
  }

  .lb-pwa-install--native {
    grid-template-columns: 1fr auto;
  }

  .lb-pwa-install__action {
    padding: 10px 13px;
  }
}

@media (max-width: 420px) {
  .lb-pwa-install--native {
    grid-template-columns: 1fr;
  }
  .lb-pwa-install__action {
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lb-pwa-install {
    transition-duration: 1ms !important;
  }
}

/* -------------------------------------------------------------------------
   PWA update banner
   ------------------------------------------------------------------------- */
.lb-pwa-update{
  position:fixed;right:20px;top:calc(18px + env(safe-area-inset-top));z-index:2147483643;
  width:min(460px,calc(100vw - 40px));display:grid;grid-template-columns:1fr auto;gap:14px;align-items:center;
  padding:15px 46px 15px 18px;border:1px solid rgba(40,40,40,.10);border-radius:15px;background:rgba(255,255,255,.98);
  box-shadow:0 16px 42px rgba(17,24,39,.16);opacity:0;visibility:hidden;transform:translateY(-12px);transition:.18s ease;pointer-events:none;
}
.lb-pwa-update.is-visible{opacity:1;visibility:visible;transform:translateY(0);pointer-events:auto}
.lb-pwa-update strong{display:block;font-size:13px;color:var(--lb-pwa-ink);margin-bottom:3px}.lb-pwa-update span{display:block;font-size:12px;color:rgba(40,40,40,.66)}
.lb-pwa-update__action{border:0;border-radius:9px;padding:9px 13px;background:var(--lb-pwa-red);color:#fff;font:inherit;font-size:12px;font-weight:800;cursor:pointer}
.lb-pwa-update__close{position:absolute;right:9px;top:8px;border:0;background:transparent;width:28px;height:28px;border-radius:999px;font-size:21px;color:#777;cursor:pointer}
.lb-pwa-update__close:hover{background:#f3f3f3}

/* -------------------------------------------------------------------------
   Standalone quick actions
   ------------------------------------------------------------------------- */
/* v1.13 — click-safe quick actions.
   The hidden menu is absolutely positioned and the parent is pointer-transparent,
   so it never creates an invisible hit-area over Hub content. */
.lb-pwa-quick{position:fixed;right:22px;bottom:calc(22px + env(safe-area-inset-bottom));z-index:2147483600;width:54px;height:54px;pointer-events:none}
.lb-pwa-quick__button{position:absolute;right:0;bottom:0;width:54px;height:54px;border:0;border-radius:999px;background:var(--lb-pwa-red);color:#fff;font:300 32px/1 system-ui;box-shadow:0 10px 28px rgba(17,24,39,.22);cursor:pointer;transition:transform .16s ease;pointer-events:auto;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
.lb-pwa-quick.is-open .lb-pwa-quick__button{transform:rotate(45deg)}
.lb-pwa-quick__menu{position:absolute;right:0;bottom:calc(100% + 10px);min-width:220px;max-width:min(360px,calc(100vw - 32px));max-height:min(70vh,calc(100dvh - 110px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;display:grid;gap:4px;padding:8px;border:1px solid rgba(40,40,40,.08);border-radius:14px;background:rgba(255,255,255,.98);box-shadow:0 14px 36px rgba(17,24,39,.18);opacity:0;visibility:hidden;transform:translateY(8px) scale(.98);transform-origin:bottom right;transition:.16s ease;pointer-events:none;scrollbar-gutter:stable}
.lb-pwa-quick.is-open .lb-pwa-quick__menu{opacity:1;visibility:visible;transform:none;pointer-events:auto}
.lb-pwa-quick__menu a{display:block;padding:10px 12px;border-radius:9px;color:#2b2928;text-decoration:none;font-size:12px;font-weight:700;white-space:nowrap;touch-action:manipulation;-webkit-tap-highlight-color:rgba(166,50,50,.08)}.lb-pwa-quick__menu a:hover{background:#f7f2f0;color:var(--lb-pwa-red)}

/* Generic PWA toast used by app settings/actions. */
.lb-pwa-toast{pointer-events:none;position:fixed;left:50%;bottom:calc(104px + env(safe-area-inset-bottom));z-index:2147483647;max-width:min(520px,calc(100vw - 32px));padding:11px 15px;border-radius:11px;background:#222;color:#fff;font-size:12px;font-weight:700;box-shadow:0 10px 28px rgba(0,0,0,.24);opacity:0;visibility:hidden;transform:translate(-50%,8px);transition:.16s ease;text-align:center}.lb-pwa-toast.is-visible{opacity:1;visibility:visible;transform:translate(-50%,0)}

@media(max-width:740px){
  .lb-pwa-update{left:16px;right:16px;top:calc(14px + env(safe-area-inset-top));width:auto;grid-template-columns:1fr;padding:14px 42px 14px 15px}.lb-pwa-update__action{justify-self:start}
  .lb-pwa-quick{right:16px;bottom:calc(16px + env(safe-area-inset-bottom));width:50px;height:50px}.lb-pwa-quick__button{width:50px;height:50px;font-size:29px}
}
@media(prefers-reduced-motion:reduce){.lb-pwa-update,.lb-pwa-quick__button,.lb-pwa-quick__menu,.lb-pwa-toast{transition-duration:1ms!important}}

/* v1.5 — DB-driven PWA shortcut rows (same PNG icons as Hub actions). */
.lb-pwa-quick__menu a{display:grid;grid-template-columns:28px 1fr;align-items:center;gap:9px;min-height:42px}
.lb-pwa-quick__menu a img{width:26px;height:26px;object-fit:contain}
.lb-pwa-quick__fallback{width:24px;height:24px;border-radius:7px;background:#f1ecea;display:block}

/* v1.6 — all Hub shortcuts in the in-app quick menu, scrollable when needed. */
.lb-pwa-quick__menu::-webkit-scrollbar{width:7px}
.lb-pwa-quick__menu::-webkit-scrollbar-thumb{background:rgba(166,50,50,.28);border-radius:999px}
@media(max-width:740px){.lb-pwa-quick__menu{min-width:min(280px,calc(100vw - 32px));max-height:calc(100dvh - 96px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}}
