/* ═══════════════════════════════════════════════════════
   Bowie Overlay v1.3 — Video Forest + Dark Chat Theme
   ═══════════════════════════════════════════════════════ */

/* ── Overlay shell ───────────────────────────────────── */
#bowie-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  overflow: hidden;
}

#bowie-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
}

#bowie-overlay-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 20px;
  box-sizing: border-box;
}

/* ── Close button ────────────────────────────────────── */
#bowie-overlay-close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 10;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.6);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  border-radius: 0;
  padding: 0;
  opacity: 0;
}
#bowie-overlay-close:hover { color: #fff; border-color: rgba(255,255,255,0.4); }
#bowie-overlay-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ═══════════════════════════════════════════════════════
   VIDEO — Forest animation
   ═══════════════════════════════════════════════════════ */
#bowie-overlay-video-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#bowie-overlay-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════
   INTRO — Text + CTA (over last video frame)
   ═══════════════════════════════════════════════════════ */
#bowie-overlay-intro {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  position: absolute;
  inset: 0;
  padding: 0 20px 80px;
  pointer-events: none;
  z-index: 2;
}

/* ── Text ────────────────────────────────────────────── */
#bowie-overlay-text {
  text-align: center;
  max-width: 420px;
  pointer-events: none;
  opacity: 0;
}
#bowie-overlay-text h2 {
  font-family: 'DM Sans', 'Roboto Condensed', Helvetica, Arial, sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
  line-height: 1.2;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}
#bowie-overlay-text p {
  font-family: 'Roboto Condensed', Helvetica, Arial, sans-serif;
  font-size: 15px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  line-height: 1.5;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

/* ── CTA ─────────────────────────────────────────────── */
#bowie-overlay-cta-wrap {
  margin-top: 24px;
  pointer-events: none;
  opacity: 0;
}
.bowie-ovl-cta {
  display: inline-block;
  background: #fff;
  color: #111;
  font-family: 'DM Sans', 'Roboto Condensed', Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 40px;
  border: none;
  border-radius: 0;
  cursor: pointer;
  pointer-events: auto;
  line-height: 1;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.bowie-ovl-cta:hover { background: rgba(255, 255, 255, 0.85); }
.bowie-ovl-cta:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.6); outline-offset: 2px; }

/* ═══════════════════════════════════════════════════════
   CHAT PHASE — BSA window docked in overlay
   ═══════════════════════════════════════════════════════ */
#bowie-overlay-chat-dock {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  max-width: 480px;
  max-height: 680px;
  pointer-events: auto;
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
}

/* ── Dark theme overrides for BSA chat when inside overlay ── */
#bowie-overlay-chat-dock #bsa-chat-window {
  position: relative !important;
  bottom: auto !important;
  right: auto !important;
  left: auto !important;
  top: auto !important;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  z-index: auto !important;
  display: flex !important;

  /* Dark glass theme */
  background: rgba(20, 20, 20, 0.85) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5) !important;
  border-radius: 16px !important;
  animation: none !important;
}

/* Header dark */
#bowie-overlay-chat-dock #bsa-chat-window .bsa-header {
  background: #111 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-header h3 {
  color: #fff !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-header p,
#bowie-overlay-chat-dock #bsa-chat-window .bsa-status-label {
  color: rgba(255, 255, 255, 0.5) !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-close-btn {
  color: rgba(255, 255, 255, 0.6) !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-close-btn:hover {
  color: #fff !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-cart-link {
  color: rgba(255, 255, 255, 0.6) !important;
}

/* Messages area dark */
#bowie-overlay-chat-dock #bsa-chat-window .bsa-messages {
  background: #1a1a1a !important;
}

/* Bot messages */
#bowie-overlay-chat-dock #bsa-chat-window .bsa-msg-bot {
  background: #252525 !important;
  color: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-msg-bot strong,
#bowie-overlay-chat-dock #bsa-chat-window .bsa-msg-bot b {
  color: #fff !important;
}

/* User messages */
#bowie-overlay-chat-dock #bsa-chat-window .bsa-msg-user {
  background: #fff !important;
  color: #111 !important;
}

/* Quick reply buttons — keep original BSA styling, no dark override */

/* Input area dark */
#bowie-overlay-chat-dock #bsa-chat-window .bsa-input-area {
  background: #111 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-input {
  background: #222 !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-input::placeholder {
  color: rgba(255, 255, 255, 0.3) !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-send-btn {
  background: #fff !important;
  color: #111 !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-send-btn svg {
  fill: #111 !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-voice-btn {
  color: rgba(255, 255, 255, 0.5) !important;
}

/* Product cards dark */
#bowie-overlay-chat-dock #bsa-chat-window .bsa-product-card {
  background: #222 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.9) !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-product-card .bsa-pc-title {
  color: #fff !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-product-card .bsa-pc-price {
  color: #fff !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-pc-btn {
  background: #fff !important;
  color: #111 !important;
}

/* Spine calculator dark */
#bowie-overlay-chat-dock #bsa-chat-window .bsa-spine-calc {
  background: #222 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.85) !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-spine-calc input,
#bowie-overlay-chat-dock #bsa-chat-window .bsa-spine-calc select {
  background: #1a1a1a !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-spine-calc label {
  color: rgba(255, 255, 255, 0.6) !important;
}

/* Scrollbar dark */
#bowie-overlay-chat-dock #bsa-chat-window .bsa-messages::-webkit-scrollbar {
  width: 6px;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-messages::-webkit-scrollbar-track {
  background: transparent;
}
#bowie-overlay-chat-dock #bsa-chat-window .bsa-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

/* Links in dark mode */
#bowie-overlay-chat-dock #bsa-chat-window a {
  color: #fff !important;
}

/* Typing indicator */
#bowie-overlay-chat-dock #bsa-chat-window .bsa-typing {
  color: rgba(255, 255, 255, 0.4) !important;
}

/* Restore notice */
#bowie-overlay-chat-dock #bsa-chat-window .bsa-restore-marker {
  color: rgba(255, 255, 255, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 768px) {
  #bowie-overlay-text h2 { font-size: 22px; }
  #bowie-overlay-text p { font-size: 14px; }
  .bowie-ovl-cta { padding: 12px 32px; font-size: 13px; }
  #bowie-overlay-close { top: 16px; right: 16px; }
  #bowie-overlay-intro { padding-bottom: 60px; }

  #bowie-overlay-chat-dock {
    max-width: 100%;
    max-height: 100%;
    padding: 10px;
  }
}

/* Mobile */
@media (max-width: 480px) {
  #bowie-overlay-intro {
    padding-bottom: 40px;
  }
  #bowie-overlay-text h2 { font-size: 20px; }
  #bowie-overlay-text p { font-size: 13px; }
  .bowie-ovl-cta {
    padding: 14px 24px;
    font-size: 13px;
    width: 100%;
    max-width: 260px;
    text-align: center;
  }

  #bowie-overlay-chat-dock {
    max-width: 100%;
    max-height: 100%;
    padding: 0;
  }
  #bowie-overlay-chat-dock #bowie-overlay-chat-dock #bsa-chat-window {
    border: none !important;
  }
}
