/* =========================================================
   We Design America — Storefront Rebate AD (right rail)
   - CLOSED: slim vertical tab on RIGHT, above Ask A Question
   - OPEN: large SQUARE advertisement (centered, most of screen)
   - Auto-opens once on homepage only; X / scrim shrinks to tab
   - NOT a form: advertisement → approved rebate page
   ========================================================= */

:root {
  --wda-ad-red: #c8102e;
  --wda-ad-red2: #e31c3d;
  --wda-ad-navy: #0b1c2c;
  --wda-ad-navy2: #12283c;
  --wda-ad-gold: #f0c040;
  --wda-ad-text: #f4f7fb;
  --wda-ad-muted: #a9b6c7;
  /* Fluorescent money-green tab (pops on dark site) */
  --wda-ad-money: #00ff66;
  --wda-ad-money2: #39ff14;
  --wda-ad-money3: #00cc52;
  --wda-ad-money-ink: #04210f;
  /* Desktop: large card that always fits the visible viewport */
  --wda-ad-square: min(92vw, 560px);
  --wda-ad-max-h: calc(100dvh - 1.5rem);
  --wda-ad-tab-w: 2.85rem;
  /* Right rail stack: Rebate higher, Ask lower */
  --wda-ad-tab-top: 34%;
  --wda-ask-top: 72%;
}

#wdaRebateRoot {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---------- Persistent RIGHT edge tab (vertical rectangle) ---------- */
#wdaRebateTab {
  position: fixed;
  right: 0;
  left: auto;
  top: var(--wda-ad-tab-top);
  transform: translateY(-50%);
  z-index: 99980;
  width: var(--wda-ad-tab-w);
  min-height: 14.5rem;
  height: auto;
  border: 0;
  border-radius: 12px 0 0 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 1rem 0.28rem;
  color: var(--wda-ad-money-ink);
  background: linear-gradient(180deg, var(--wda-ad-money2) 0%, var(--wda-ad-money) 45%, var(--wda-ad-money3) 100%);
  box-shadow:
    -4px 0 24px rgba(0, 255, 102, 0.55),
    0 0 18px rgba(57, 255, 20, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.25) inset;
  transition: filter 0.2s ease, box-shadow 0.2s ease, opacity 0.15s ease;
  overflow: visible;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
#wdaRebateTab:hover {
  filter: brightness(1.06) saturate(1.08);
  box-shadow:
    -6px 0 32px rgba(0, 255, 102, 0.7),
    0 0 22px rgba(57, 255, 20, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}
#wdaRebateTab:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
/* No dollar/icon on tab — text only */
#wdaRebateTab .wda-ad-tab-icon {
  display: none !important;
}
#wdaRebateTab .wda-ad-tab-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.2;
  overflow: visible;
  padding: 0.25rem 0;
  text-align: center;
}
#wdaRebateTab .wda-ad-tab-pulse {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(0, 255, 102, 0.65);
  animation: wdaAdPulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes wdaAdPulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 255, 102, 0.65); }
  70% { box-shadow: 0 0 0 14px rgba(0, 255, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 255, 102, 0); }
}
#wdaRebateRoot.is-seen #wdaRebateTab .wda-ad-tab-pulse {
  display: none;
}

/* Hide tab completely while ad is open — no slide/glitch strip */
#wdaRebateRoot.is-open #wdaRebateTab {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(-50%);
}

/* ---------- Advertisement panel (centered; not glued to edge tab) ---------- */
#wdaRebatePanel {
  position: fixed;
  top: 50%;
  left: 50%;
  right: auto;
  bottom: auto;
  width: var(--wda-ad-square);
  height: auto;
  max-width: min(92vw, 560px);
  max-height: var(--wda-ad-max-h);
  z-index: 99990;
  box-sizing: border-box;
  /* Center on X/Y without a forced square — top kicker never clips */
  transform: translate(-50%, -50%) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.32s cubic-bezier(0.22, 0.9, 0.3, 1),
    opacity 0.28s ease;
  background:
    radial-gradient(ellipse at 100% 0%, rgba(200, 16, 46, 0.42), transparent 48%),
    radial-gradient(ellipse at 0% 100%, rgba(240, 192, 64, 0.16), transparent 42%),
    linear-gradient(165deg, #050d16 0%, var(--wda-ad-navy) 42%, var(--wda-ad-navy2) 100%);
  color: var(--wda-ad-text);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#wdaRebateRoot.is-open #wdaRebatePanel {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

#wdaRebateScrim {
  position: fixed;
  inset: 0;
  z-index: 99985;
  background: rgba(5, 10, 18, 0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(3px);
}
#wdaRebateRoot.is-open #wdaRebateScrim {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- Ad content (fits square) ---------- */
.wda-ad-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 1rem 1.05rem 0.5rem;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  background: linear-gradient(180deg, rgba(5, 13, 22, 0.98), rgba(5, 13, 22, 0.85) 70%, transparent);
}

/* Scrolling kicker marquee in the gold pill */
.wda-ad-kicker {
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 3rem);
  overflow: hidden;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1a1208;
  background: linear-gradient(90deg, var(--wda-ad-gold), #ffe08a);
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  box-shadow: 0 0 20px rgba(240, 192, 64, 0.35);
}
.wda-ad-kicker-track {
  display: inline-block;
  white-space: nowrap;
  padding-left: 100%;
  animation: wdaAdKickerScroll 28s linear infinite;
}
@keyframes wdaAdKickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

.wda-ad-close {
  flex-shrink: 0;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.wda-ad-close:hover {
  background: rgba(200, 16, 46, 0.4);
}

.wda-ad-body {
  padding: 0.35rem 1.25rem 1.15rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  /* Keep "Money back…" visible at the top — not vertically centered off-screen */
  justify-content: flex-start;
}

.wda-ad-money {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wda-ad-gold);
  margin: 0 0 0.5rem;
}

.wda-ad-body h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.35rem, 3.6vw, 1.85rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  font-weight: 800;
  max-width: 16ch;
}

.wda-ad-headline-accent {
  color: #ffd0d6;
  background: linear-gradient(90deg, #fff, #ffd0d6 40%, var(--wda-ad-gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.wda-ad-lead {
  margin: 0 0 1rem;
  color: #d5deea;
  font-size: clamp(0.9rem, 2.2vw, 1.02rem);
  line-height: 1.5;
  font-weight: 500;
}
.wda-ad-lead strong {
  color: #fff;
  font-weight: 800;
}

.wda-ad-urgency {
  margin: 0 0 1.1rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border-left: 4px solid var(--wda-ad-red);
  background: rgba(200, 16, 46, 0.15);
  font-size: 0.84rem;
  line-height: 1.4;
  color: #ffd0d6;
  font-weight: 600;
}

.wda-ad-cta {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: auto;
  flex-shrink: 0;
}
.wda-ad-cta-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  box-sizing: border-box;
  text-decoration: none;
  text-align: center;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  padding: 1rem 1.1rem;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(180deg, var(--wda-ad-red2), var(--wda-ad-red));
  box-shadow: 0 12px 28px rgba(200, 16, 46, 0.4);
  transition: filter 0.15s ease, transform 0.15s ease;
}
.wda-ad-cta-primary:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.wda-ad-fine {
  margin: 0.75rem 0 0;
  font-size: 0.65rem;
  line-height: 1.4;
  color: rgba(169, 182, 199, 0.85);
  text-align: center;
}
.wda-ad-brand {
  margin: 0.45rem 0 0;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(240, 192, 64, 0.75);
}

/* ---------- Ask A Question = vertical edge tab BELOW rebate tab ---------- */
body.wda-rebate-ad-on .chat-widget {
  top: var(--wda-ask-top) !important;
  bottom: auto !important;
  right: 0 !important;
  left: auto !important;
  transform: translateY(-50%) !important;
  z-index: 99970 !important;
  display: flex !important;
  flex-direction: row-reverse !important;
  align-items: center !important;
  gap: 0.75rem !important;
  width: auto !important;
  max-width: 100vw !important;
  pointer-events: none !important;
}
body.wda-rebate-ad-on .chat-widget .chat-launcher,
body.wda-rebate-ad-on .chat-widget .chat-panel {
  pointer-events: auto !important;
}

/* Force pill-style launchers into vertical edge tabs (WDA was bottom-right) */
body.wda-rebate-ad-on .chat-launcher {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.4rem !important;
  width: var(--wda-ad-tab-w) !important;
  min-height: 9.75rem !important;
  padding: 0.85rem 0.28rem !important;
  border: 0 !important;
  border-radius: 12px 0 0 12px !important;
  background: linear-gradient(180deg, #f5f7fb, #e8edf4 55%, #d5dde8) !important;
  color: #0b1c2c !important;
  box-shadow: -4px 0 18px rgba(0, 0, 0, 0.28) !important;
  /* keep label readable */
  line-height: 1 !important;
}
body.wda-rebate-ad-on .chat-launcher-label {
  display: block !important;
  writing-mode: vertical-rl !important;
  transform: rotate(180deg) !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  line-height: 1.1 !important;
  color: #0b1c2c !important;
}
body.wda-rebate-ad-on .chat-dot {
  width: 8px !important;
  height: 8px !important;
  flex-shrink: 0 !important;
  /* font-size kept for labels */
}
body.wda-rebate-ad-on .chat-panel {
  position: relative !important;
  width: min(340px, calc(100vw - 3.75rem)) !important;
  max-height: min(70vh, 520px) !important;
  margin-right: 0.15rem !important;
}

/* CGS ask.js — .ask-fab / #askOpen (not only generic ask-tab class) */
body.wda-rebate-ad-on #askRoot {
  position: static !important;
  transform: none !important;
  inset: auto !important;
}
body.wda-rebate-ad-on #askOpen.ask-fab,
body.wda-rebate-ad-on .ask-fab,
body.wda-rebate-ad-on #askTab,
body.wda-rebate-ad-on .ask-tab,
body.wda-rebate-ad-on .ask-launcher {
  position: fixed !important;
  top: var(--wda-ask-top) !important;
  bottom: auto !important;
  right: 0 !important;
  left: auto !important;
  transform: translateY(-50%) !important;
  z-index: 99970 !important;
}

/* Any CGS page with both rails — stack rebate ABOVE ask (never overlap) */
body.page-home.wda-rebate-ad-on #askOpen.ask-fab,
body.page-home.wda-rebate-ad-on .ask-fab,
body.page-lighting.wda-rebate-ad-on #askOpen.ask-fab,
body.page-lighting.wda-rebate-ad-on .ask-fab,
body.page-book-lighting.wda-rebate-ad-on #askOpen.ask-fab,
body.page-book-lighting.wda-rebate-ad-on .ask-fab,
body.page-book.wda-rebate-ad-on #askOpen.ask-fab,
body.page-book.wda-rebate-ad-on .ask-fab,
body.page-quote.wda-rebate-ad-on #askOpen.ask-fab,
body.page-quote.wda-rebate-ad-on .ask-fab,
body.neon-body.wda-rebate-ad-on #askOpen.ask-fab,
body.neon-body.wda-rebate-ad-on .ask-fab,
body.wda-rebate-ad-on #askOpen.ask-fab,
body.wda-rebate-ad-on .ask-fab {
  position: fixed !important;
  top: var(--wda-ask-top) !important; /* ~72% — below rebate */
  bottom: auto !important;
  right: 0 !important;
  left: auto !important;
  transform: translateY(-50%) !important;
  z-index: 99970 !important;
}
body.page-home.wda-rebate-ad-on #wdaRebateTab,
body.page-lighting.wda-rebate-ad-on #wdaRebateTab,
body.page-book-lighting.wda-rebate-ad-on #wdaRebateTab,
body.page-book.wda-rebate-ad-on #wdaRebateTab,
body.page-quote.wda-rebate-ad-on #wdaRebateTab,
body.neon-body.wda-rebate-ad-on #wdaRebateTab,
body.wda-rebate-ad-on #wdaRebateTab {
  top: var(--wda-ad-tab-top) !important; /* ~34% — above ask */
  bottom: auto !important;
  right: 0 !important;
  left: auto !important;
  z-index: 99980 !important;
}

/* Hide Call/Quote dock when suppressed (quote/book/neon/etc.) */
body.cgs-no-call-bar .cgs-call-bar,
body.page-quote .cgs-call-bar,
body.page-book .cgs-call-bar,
body.page-book-lighting .cgs-call-bar {
  display: none !important;
}
body.cgs-no-call-bar,
body.page-quote,
body.page-book,
body.page-book-lighting {
  padding-bottom: 0 !important;
}

@media (max-width: 720px) {
  :root {
    --wda-ad-tab-top: 30%;
    --wda-ask-top: 70%;
  }
  #wdaRebateTab {
    min-height: 13.5rem;
    width: 2.55rem;
    padding: 0.85rem 0.22rem;
  }
  #wdaRebateTab .wda-ad-tab-label {
    font-size: 0.64rem;
    letter-spacing: 0.12em;
  }

  /*
   * Mobile open panel: full readable card, NOT a forced square.
   * Anchor below safe-area so the top kicker + "Money back" are never cut off.
   */
  #wdaRebatePanel {
    top: max(0.85rem, calc(env(safe-area-inset-top, 0px) + 0.5rem));
    left: 50%;
    right: auto;
    bottom: auto;
    width: min(94vw, 420px);
    height: auto;
    max-width: 94vw;
    max-height: calc(100dvh - max(0.85rem, calc(env(safe-area-inset-top, 0px) + 0.5rem)) - max(0.85rem, env(safe-area-inset-bottom, 0px)) - 0.75rem);
    max-height: calc(100vh - max(0.85rem, calc(env(safe-area-inset-top, 0px) + 0.5rem)) - max(0.85rem, env(safe-area-inset-bottom, 0px)) - 0.75rem);
    transform: translate(-50%, 0) scale(0.96);
    border-radius: 14px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
  }
  #wdaRebateRoot.is-open #wdaRebatePanel {
    transform: translate(-50%, 0) scale(1);
  }
  .wda-ad-top {
    flex-shrink: 0;
    padding: 0.75rem 0.85rem 0.45rem;
    padding-top: 0.75rem;
  }
  .wda-ad-kicker {
    max-width: calc(100% - 2.5rem);
  }
  .wda-ad-body {
    flex: 1 1 auto;
    padding: 0.35rem 0.95rem 1.15rem;
    padding-bottom: max(1.15rem, env(safe-area-inset-bottom, 0px));
    justify-content: flex-start;
    overflow: visible;
  }
  .wda-ad-money {
    font-size: 0.72rem;
    margin-bottom: 0.45rem;
    display: block;
    position: relative;
    z-index: 1;
  }
  .wda-ad-body h2 {
    font-size: clamp(1.2rem, 5.5vw, 1.45rem);
    max-width: none;
    margin-bottom: 0.55rem;
  }
  .wda-ad-lead {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
  }
  .wda-ad-urgency {
    font-size: 0.8rem;
    margin-bottom: 0.85rem;
  }
  .wda-ad-cta-primary {
    padding: 0.9rem 0.9rem;
    font-size: 0.95rem;
  }
  .wda-ad-fine {
    font-size: 0.62rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #wdaRebatePanel,
  #wdaRebateScrim,
  #wdaRebateTab {
    transition: none;
  }
  #wdaRebateTab .wda-ad-tab-pulse {
    animation: none;
  }
  .wda-ad-kicker-track {
    animation: none;
    padding-left: 0;
    white-space: normal;
  }
}
