/* Worker.NG — Smart Combo PWA UI
   Mobile-first, high-polish visuals, subtle motion, minimal footprint
*/

/* Base variables */
:root{
  --accent: #007a3d;
  --glass: rgba(255,255,255,0.92);
  --muted: #6b7280;
  --shadow: 0 8px 28px rgba(9,10,13,0.12);
  --rounded: 14px;
  --z-top: 120000;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

/* ---------------------------
   Floating Bubble (compact)
   --------------------------- */
#pwa-fly-bubble {
  position: fixed;
  left: 16px; /* moved from right to left */
  bottom: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--accent), #006231);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 22px rgba(3,10,7,0.28);
  z-index: var(--z-top);
  border: none;
  cursor: pointer;
  transform: translateY(12px) scale(0.98);
  transition: transform 320ms cubic-bezier(.22,.9,.36,1), opacity 200ms ease;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}

/* Entrance */
#pwa-fly-bubble.pwa-bubble-entrance {
  transform: translateY(0) scale(1);
}

/* Pulse to attract attention */
#pwa-fly-bubble.pwa-bubble-pulse {
  animation: pwa-pulse 1800ms ease-in-out 0s 2;
}
@keyframes pwa-pulse {
  0%{ transform: scale(1); }
  40%{ transform: scale(1.08); }
  100%{ transform: scale(1); }
}

#pwa-fly-bubble .pwa-bubble-icon { font-size: 20px; line-height: 1; }
#pwa-fly-bubble .pwa-bubble-dot {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 9px;
  height: 9px;
  background: #ffd54f;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255,213,79,0.4);
  opacity: 0.95;
  transform-origin: center;
}

/* fadeout */
#pwa-fly-bubble.pwa-fadeout { opacity: 0; transform: translateY(8px) scale(0.9); }

/* bubble to card transition helper */
#pwa-fly-bubble.pwa-bubble-to-card{ transform: translateY(-8px) scale(0.9); opacity: 0.0; transition: all 260ms ease; }

/* ---------------------------
   Install Card (expanded)
   --------------------------- */
#pwa-install-card {
  position: fixed;
  left: 16px; /* moved from right to left */
  bottom: 86px;
  width: calc(100% - 40px);
  max-width: 420px;
  background: var(--glass);
  border-radius: var(--rounded);
  box-shadow: var(--shadow);
  display: flex;
  gap: 12px;
  padding: 14px;
  align-items: center;
  z-index: var(--z-top);
  opacity: 0;
  transform: translateY(16px) scale(0.995);
  transition: opacity 260ms ease, transform 320ms cubic-bezier(.22,.9,.36,1);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(8,12,9,0.04);
}

/* show */
#pwa-install-card.pwa-card-show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* hide */
#pwa-install-card.pwa-card-hide {
  opacity: 0;
  transform: translateY(8px) scale(0.985);
}

/* Left icon */
.pwa-card-left {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(180deg,#fff,#f6f7f7);
  overflow: hidden;
}
.pwa-card-icon { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; }

/* Body */
.pwa-card-body { flex: 1 1 auto; min-width: 0; }
.pwa-card-title { font-weight: 600; color: #052e19; font-size: 15px; margin-bottom: 6px; }
.pwa-card-desc { font-size: 13px; color: var(--muted); margin-bottom: 10px; line-height: 1.25; }

/* Actions */
.pwa-card-actions { display:flex; gap:8px; align-items:center; }
.pwa-card-actions .primary {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13px;
  cursor: pointer;
}
.pwa-card-actions .secondary {
  background: transparent;
  border: 1px solid rgba(3,10,7,0.06);
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

/* close button */
.pwa-card-close {
  position: absolute;
  right: 10px;
  top: 8px;
  background: transparent;
  border: none;
  color: #445;
  font-size: 16px;
  cursor: pointer;
}

/* ---------------------------
   iOS instruction sheet
   --------------------------- */
#pwa-ios-instructions {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%) scale(0.98);
  background: white;
  border-radius: 12px;
  padding: 16px;
  width: calc(100% - 42px);
  max-width: 380px;
  box-shadow: var(--shadow);
  z-index: var(--z-top);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
}
#pwa-ios-instructions.pwa-ios-show { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.pwa-ios-title { font-weight: 700; margin-bottom: 6px; color: var(--accent); }
.pwa-ios-text { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
#pwa-ios-close.primary { width:100%; }

/* ---------------------------
   Exit-intent modal
   --------------------------- */
#pwa-exit-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: calc(var(--z-top) + 10);
  pointer-events: none;
}
.pwa-exit-card {
  width: calc(100% - 32px);
  max-width: 480px;
  margin: 18px;
  background: linear-gradient(180deg, #fff, #fbfcfb);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  pointer-events: auto;
  transform: translateY(24px);
  opacity: 0;
  transition: transform 320ms cubic-bezier(.22,.9,.36,1), opacity 260ms ease;
}
#pwa-exit-modal.pwa-exit-show .pwa-exit-card { transform: translateY(0); opacity:1; }

.pwa-exit-left {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:20px;
}
.pwa-exit-title { font-weight:700; color:#042; }
.pwa-exit-desc { color:var(--muted); font-size:13px; margin-top:4px; }
.pwa-exit-actions { display:flex; gap:8px; margin-top:8px; }
.pwa-exit-actions .primary { background: var(--accent); border: none; color: #fff; padding: 8px 12px; border-radius: 9px; font-size: 13px; }
.pwa-exit-actions .ghost { background: transparent; border: 1px solid rgba(3,10,7,0.06); color: var(--muted); padding: 8px 12px; border-radius: 9px; font-size: 13px; }

/* ---------------------------
   Fallback toast
   --------------------------- */
#pwa-fallback-toast {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%) translateY(12px);
  background: #111;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  z-index: calc(var(--z-top) + 2);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
  max-width: 92%;
  font-size: 13px;
}
#pwa-fallback-toast.pwa-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Responsive adjustments */
@media (max-width: 520px) {
  #pwa-install-card { bottom: 74px; left: 12px; right: 12px; width: calc(100% - 24px); max-width: none; border-radius: 12px; }
  .pwa-card-left { display:flex; }
  .pwa-card-body { padding-right: 10px; }
  #pwa-fly-bubble { left: 14px; bottom: 16px; width: 52px; height: 52px; }
}

/* Accessibility focus */
#pwa-fly-bubble:focus, #pwa-card-install:focus, #pwa-exit-install:focus, #pwa-topbar-install:focus {
  outline: 3px solid rgba(0,122,61,0.18);
  outline-offset: 3px;
}
