/* ── PackBuddy Guided Tour ──────────────────────────── */

/* ── FAB ──────────────────────────────────────────── */
#pb-tour-fab {
  position: fixed;
  bottom: 88px;
  right: 22px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--orange, #FF6B35);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  box-shadow: 0 4px 16px rgba(255,107,53,.45);
  transition: transform .15s, box-shadow .15s;
  color: #fff;
}
#pb-tour-fab:hover { transform: scale(1.08); box-shadow: 0 6px 22px rgba(255,107,53,.6); }
#pb-tour-fab.pb-tour-pulse { animation: pb-fab-pulse 2.2s ease-in-out infinite; }
@keyframes pb-fab-pulse {
  0%,100% { box-shadow: 0 4px 16px rgba(255,107,53,.45), 0 0 0 0   rgba(255,107,53,.38); }
  50%     { box-shadow: 0 4px 16px rgba(255,107,53,.45), 0 0 0 16px rgba(255,107,53,0);  }
}

/* ── Backdrop ─────────────────────────────────────── */
#pb-tour-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 1299;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s;
}
#pb-tour-backdrop.pb-tour-active { opacity: 1; pointer-events: auto; }

/* ── Spotlight ring on target ─────────────────────── */
.pb-tour-spotlight {
  outline: 9999px solid rgba(0,0,0,.65) !important;
  outline-offset: 8px !important;
  border-radius: var(--radius, 14px) !important;
  position: relative !important;
  z-index: 1300 !important;
  box-shadow:
    0 0 0 2px #FF6B35,
    0 0 0 5px rgba(255,107,53,.28),
    0 0 24px 6px rgba(255,107,53,.18) !important;
  pointer-events: none !important;
  animation: pb-spotlight-ring 2s ease-in-out infinite;
}
@keyframes pb-spotlight-ring {
  0%,100% { box-shadow: 0 0 0 2px #FF6B35, 0 0 0 5px rgba(255,107,53,.28), 0 0 24px 6px rgba(255,107,53,.18); }
  50%     { box-shadow: 0 0 0 3px #FF6B35, 0 0 0 9px rgba(255,107,53,.18), 0 0 36px 10px rgba(255,107,53,.1); }
}

/* ── Corner frame (positioned by JS) ─────────────── */
#pb-tour-frame {
  position: fixed;
  z-index: 1305;
  pointer-events: none;
  display: none;
}
.pb-tc {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: #FF6B35;
  border-style: solid;
  border-radius: 3px;
}
.pb-tc--tl { top: 0;    left: 0;    border-width: 2.5px 0 0 2.5px; border-top-left-radius: 5px; }
.pb-tc--tr { top: 0;    right: 0;   border-width: 2.5px 2.5px 0 0; border-top-right-radius: 5px; }
.pb-tc--bl { bottom: 0; left: 0;    border-width: 0 0 2.5px 2.5px; border-bottom-left-radius: 5px; }
.pb-tc--br { bottom: 0; right: 0;   border-width: 0 2.5px 2.5px 0; border-bottom-right-radius: 5px; }

#pb-tour-frame.pb-frame-visible .pb-tc {
  animation: pb-corner-blink 1.8s ease-in-out infinite;
}
@keyframes pb-corner-blink {
  0%,100% { opacity: 1; }
  50%     { opacity: .4; }
}

/* Scan-line sweeping inside the frame */
#pb-tour-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(255,107,53,.09) 48%,
    rgba(255,107,53,.18) 50%,
    rgba(255,107,53,.09) 52%,
    transparent 100%);
  background-size: 100% 200%;
  animation: pb-scan 2.6s linear infinite;
  pointer-events: none;
}
@keyframes pb-scan {
  0%   { background-position: 0 -100%; }
  100% { background-position: 0  200%; }
}

/* ── Step label (positioned by JS) ───────────────── */
#pb-tour-label {
  position: fixed;
  z-index: 1310;
  background: #FF6B35;
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .08em;
  padding: .22rem .65rem .22rem .55rem;
  border-radius: 7px;
  pointer-events: none;
  white-space: nowrap;
  display: none;
  box-shadow: 0 3px 10px rgba(255,107,53,.45);
  animation: pb-label-in .25s ease;
}
@keyframes pb-label-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Arrow pointing down (label is above target) */
#pb-tour-label::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 12px;
  border: 5px solid transparent;
  border-top-color: #FF6B35;
  border-bottom: none;
}
/* Arrow pointing up (label is below target) */
#pb-tour-label.pb-label-below::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom: 5px solid #FF6B35;
  border-top: none;
}

/* ── Tour card ────────────────────────────────────── */
#pb-tour-card {
  position: fixed;
  z-index: 1400;
  background: var(--navy-card, #142236);
  color: #e6edf3;
  border: 1px solid rgba(255,107,53,.4);
  border-radius: var(--radius-lg, 22px);
  padding: 1.3rem 1.5rem 1.1rem;
  max-width: 340px;
  width: calc(100vw - 40px);
  box-shadow: 0 16px 48px rgba(0,0,0,.65), 0 0 0 1px rgba(255,107,53,.12);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: pb-card-in .28s cubic-bezier(.34,1.28,.64,1);
}
@keyframes pb-card-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)) scale(.94); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
/* When card is anchored (not centered), reset animation origin */
#pb-tour-card.pb-anchored {
  animation: pb-card-in-anchored .28s cubic-bezier(.34,1.28,.64,1);
}
@keyframes pb-card-in-anchored {
  from { opacity: 0; transform: translateY(8px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

[data-theme="light"] #pb-tour-card {
  background: #fff;
  color: #2D3748;
  border-color: rgba(255,107,53,.3);
  box-shadow: 0 8px 32px rgba(0,0,0,.15), 0 0 0 1px rgba(255,107,53,.1);
}

/* Directional arrow on card (pointing toward spotlit element) */
#pb-tour-card.pb-arrow-up::before {
  content: '';
  position: absolute;
  top: -9px;
  left: var(--arrow-x, 30px);
  border: 9px solid transparent;
  border-bottom-color: var(--navy-card, #142236);
  border-top: none;
}
#pb-tour-card.pb-arrow-down::before {
  content: '';
  position: absolute;
  bottom: -9px;
  left: var(--arrow-x, 30px);
  border: 9px solid transparent;
  border-top-color: var(--navy-card, #142236);
  border-bottom: none;
}
[data-theme="light"] #pb-tour-card.pb-arrow-up::before   { border-bottom-color: #fff; }
[data-theme="light"] #pb-tour-card.pb-arrow-down::before { border-top-color: #fff; }

.pb-tour-card-head {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin-bottom: .5rem;
}
.pb-tour-step-badge {
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .05em;
  background: rgba(255,107,53,.18);
  color: #FF6B35;
  padding: .2rem .55rem;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: .1rem;
}
.pb-tour-title {
  font-size: .95rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}
.pb-tour-text {
  font-size: .82rem;
  line-height: 1.55;
  color: rgba(230,237,243,.72);
  margin: 0 0 1rem;
}
[data-theme="light"] .pb-tour-text { color: #718096; }

/* Keyboard hint */
.pb-tour-kbd-hint {
  font-size: .65rem;
  color: rgba(230,237,243,.3);
  text-align: right;
  margin-bottom: .55rem;
  letter-spacing: .03em;
}
[data-theme="light"] .pb-tour-kbd-hint { color: #b0bec5; }
.pb-tour-kbd-hint kbd {
  font-family: inherit;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 4px;
  padding: .05rem .3rem;
  font-size: .62rem;
}
[data-theme="light"] .pb-tour-kbd-hint kbd {
  background: #f0f4f8;
  border-color: #dde3ec;
}

.pb-tour-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.pb-tour-skip {
  font-size: .77rem;
  color: rgba(230,237,243,.38);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-right: auto;
  transition: color .15s;
}
[data-theme="light"] .pb-tour-skip { color: #a0aec0; }
.pb-tour-skip:hover { color: #FF6B35; }

.pb-tour-prev, .pb-tour-next {
  border: none;
  border-radius: 10px;
  padding: .45rem .9rem;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.pb-tour-prev:active, .pb-tour-next:active { transform: scale(.95); }
.pb-tour-prev {
  background: rgba(255,255,255,.09);
  color: #e6edf3;
}
[data-theme="light"] .pb-tour-prev { background: #f0f4f8; color: #2D3748; }
.pb-tour-prev:hover { background: rgba(255,255,255,.16); }
[data-theme="light"] .pb-tour-prev:hover { background: #e2e8f0; }
.pb-tour-next { background: #FF6B35; color: #fff; }
.pb-tour-next:hover { background: #E05520; }

/* Progress dots */
.pb-tour-dots {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  margin-top: .85rem;
}
.pb-tour-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  transition: background .2s, width .25s cubic-bezier(.34,1.3,.64,1), border-radius .2s;
  flex-shrink: 0;
  cursor: pointer;
}
[data-theme="light"] .pb-tour-dot { background: #e2e8f0; }
.pb-tour-dot:hover { background: rgba(255,107,53,.45); }
.pb-tour-dot.active { background: #FF6B35; width: 20px; border-radius: 3px; }

/* ── Trust Bar ──────────────────────────────────────── */
#pb-trust-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .6rem .9rem;
  margin-top: 1rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius, 14px);
}
[data-theme="light"] #pb-trust-bar {
  background: rgba(255,107,53,.05);
  border-color: rgba(255,107,53,.2);
}
.pb-trust-item {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .71rem;
  font-weight: 600;
  color: rgba(230,237,243,.65);
  white-space: nowrap;
}
[data-theme="light"] .pb-trust-item { color: #718096; }
.pb-trust-sep {
  width: 1px;
  height: 12px;
  background: rgba(255,255,255,.15);
  flex-shrink: 0;
}
[data-theme="light"] .pb-trust-sep { background: rgba(0,0,0,.12); }

/* ── Free First Contact Strip ───────────────────────── */
#pb-free-strip {
  margin-top: .85rem;
  background: linear-gradient(135deg, rgba(255,107,53,.15) 0%, rgba(255,107,53,.06) 100%);
  border: 1.5px solid rgba(255,107,53,.4);
  border-radius: var(--radius, 14px);
  padding: .7rem 1rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
#pb-free-strip:hover {
  border-color: rgba(255,107,53,.7);
  background: linear-gradient(135deg, rgba(255,107,53,.22) 0%, rgba(255,107,53,.1) 100%);
}
[data-theme="light"] #pb-free-strip {
  background: linear-gradient(135deg, rgba(255,107,53,.09) 0%, rgba(255,107,53,.03) 100%);
}
.pb-free-strip-head { display: flex; align-items: center; gap: .55rem; }
.pb-free-badge {
  background: #FF6B35; color: #fff;
  font-size: .63rem; font-weight: 800; letter-spacing: .08em;
  padding: .18rem .5rem; border-radius: 6px; flex-shrink: 0;
}
.pb-free-strip-text { font-size: .82rem; font-weight: 700; color: #e6edf3; flex: 1; }
[data-theme="light"] .pb-free-strip-text { color: #2D3748; }
.pb-free-chevron { font-size: .7rem; color: rgba(230,237,243,.4); transition: transform .2s; }
.pb-free-strip-sub { font-size: .71rem; color: rgba(230,237,243,.5); margin-top: .18rem; }
[data-theme="light"] .pb-free-strip-sub { color: #a0aec0; }
.pb-free-strip-form { display: none; margin-top: .65rem; }
.pb-free-strip-form.open { display: block; }
#pb-free-strip.fs-open .pb-free-chevron { transform: rotate(180deg); }
.pb-free-email-row { display: flex; gap: .45rem; }
.pb-free-email-input {
  flex: 1; padding: .48rem .7rem; border-radius: 10px;
  border: 1px solid rgba(255,107,53,.35); background: rgba(0,0,0,.28);
  color: #e6edf3; font-size: .8rem; outline: none; min-width: 0;
}
[data-theme="light"] .pb-free-email-input { background: #fff; color: #2D3748; border-color: rgba(255,107,53,.35); }
.pb-free-email-input:focus { border-color: #FF6B35; }
.pb-free-submit-btn {
  background: #FF6B35; color: #fff; border: none; border-radius: 10px;
  padding: .48rem .95rem; font-size: .8rem; font-weight: 700; cursor: pointer;
  transition: background .15s; white-space: nowrap; flex-shrink: 0;
}
.pb-free-submit-btn:hover { background: #E05520; }
.pb-free-note { font-size: .67rem; color: rgba(230,237,243,.38); margin-top: .3rem; text-align: center; }
[data-theme="light"] .pb-free-note { color: #a0aec0; }
.pb-free-success { display: none; text-align: center; padding: .4rem 0; font-size: .82rem; font-weight: 700; color: var(--green, #27AE60); }
.pb-free-success.show { display: block; }

@media (max-width: 480px) {
  #pb-trust-bar { gap: .4rem; }
  .pb-trust-sep { display: none; }
  #pb-tour-fab  { bottom: 76px; right: 16px; width: 46px; height: 46px; }
  #pb-tour-card { padding: 1.1rem 1.2rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  #pb-tour-frame::after,
  .pb-tour-spotlight,
  #pb-tour-fab.pb-tour-pulse { animation: none !important; }
}
