/* Niwa AI v0.2.0 - Centerstage Mode */
:root {
  --za-dark: #020c0a;
  --za-accent: #d2ef9a;
  --za-white: #FFFFFF;
  --za-shadow: 0 18px 60px rgba(2, 12, 10, .28);
  --za-gap: 16px;
  --za-flyout-radius: 24px;
  --za-bubble-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  --za-input-shadow: 0 6px 22px rgba(15, 23, 42, 0.1);
  --niwa-bg: rgba(255, 255, 255, 0.18);
  --niwa-border: rgba(255, 255, 255, 0.35);
  --niwa-text: #0b0b0b;
  --niwa-blur: 20px;
  --deep-glass-bg: rgba(30, 30, 30, 0.25);
  --deep-glass-border: rgba(255, 255, 255, 0.15);
  --deep-glass-blur: 40px;
  --deep-glass-text: #f5f5f5;
}

/* Launcher */
#za-launcher {
  position: fixed;
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none; /* Container doesn't block clicks */
}

#za-launcher .za-badge {
  height: 66px;
  width: 66px;
  border-radius: 999px;
  color: var(--za-white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--za-shadow);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform .2s ease, box-shadow .2s ease;
  pointer-events: auto !important; /* Ensure clickable */
}

#za-launcher .za-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 60px rgba(2, 12, 10, .36)
}

#za-launcher .za-label {
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: var(--za-shadow);
  font-size: 13px;
  background: var(--za-dark);
  color: var(--za-white);
  pointer-events: auto !important; /* Ensure clickable */
}

#za-launcher .za-ico {
  font-size: 22px;
  line-height: 1
}

/* Flyout – responsive positioning (simple display toggle, GSAP handles animation) */
#za-flyout {
  position: fixed;
  background: var(--za-white);
  border: 1px solid #e5e7eb;
  border-radius: var(--za-flyout-radius);
  box-shadow: var(--za-shadow);
  overflow: hidden;
  display: none;
  z-index: 99999;
  max-height: 95vh;
  min-height: 300px
}

#za-flyout.active {
  display: block !important
}

#za-flyout.mobile-center {
  transform: translateX(-50%) !important
}

#za-flyout .za-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px;
  background: linear-gradient(135deg, #0f2f2a 0%, #020c0a 65%);
  color: var(--za-white);
  position: sticky;
  top: 0;
  z-index: 10
}

#za-flyout .za-head .za-head-actions {
  display: flex;
  gap: 6px
}

#za-flyout .za-head .za-head-actions button {
  background: rgba(255, 255, 255, .08);
  border: 0;
  color: var(--za-white);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center
}

#za-flyout .za-head .za-head-actions button:hover {
  background: rgba(255, 255, 255, .16)
}

#za-flyout .za-title {
  font-weight: 700;
  letter-spacing: .2px;
  display: flex;
  align-items: center;
  gap: 10px
}

#za-flyout .za-title .za-head-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15)
}

.za-host {
  height: calc(100% - 52px);
  display: flex;
  flex-direction: column
}

/* Chat body + input (stabilan input) */
.za-shell {
  display: flex;
  flex-direction: column;
  height: 100%
}

.za-window {
  flex: 1;
  overflow: auto;
  padding: 12px;
  background: var(--za-white);
  white-space: pre-line;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y
}

.za-bubble {
  display: inline-block;
  padding: 10px 12px;
  border-radius: 14px;
  margin: 6px 0;
  line-height: 1.4;
  max-width: 85%;
  box-shadow: var(--za-bubble-shadow)
}

.za-bot {
  background: #f3f4f6;
  color: #111827;
  border-top-left-radius: 4px
}

.za-user {
  background: var(--za-dark);
  color: var(--za-white);
  border-top-right-radius: 4px;
  float: right;
  clear: both
}

.za-msg {
  clear: both
}

/* === Reset WordPress/Builder styles for input and button === */
.za-input,
.za-input *,
.za-send,
.za-send * {
  all: unset !important;
  box-sizing: border-box !important;
}

/* Input – Pill-matched height with arrow button */
.za-input {
  display: flex !important;
  border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
  padding: 16px 16px !important;
  background: transparent !important;
  align-items: center !important;
  position: relative !important;
  gap: 12px !important;
}

.za-input input {
  flex: 1 1 auto !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  border-radius: 40px !important;
  padding: 0 70px 0 20px !important;
  font-size: 15px !important;
  /* Fixed height independent of pill height */
  height: 50px !important;
  min-height: 50px !important;
  max-height: 50px !important;
  line-height: normal !important;
  background: rgba(255, 255, 255, 0.95) !important;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.1) !important;
  transition: all 0.3s ease !important;
  color: #0b0b0b !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  outline: none !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
}

.za-input input::placeholder {
  color: rgba(11, 11, 11, 0.5) !important;
  opacity: 1 !important;
}

.za-input input:focus {
  outline: none !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  background: rgba(255, 255, 255, 0.75) !important;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.5) !important;
  transform: translateY(-1px) !important;
}

.za-send {
  position: absolute !important;
  right: 26px !important;
  background: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  cursor: pointer !important;
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
  flex-shrink: 0 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  text-decoration: none !important;
  outline: none !important;
  /* Hide any text content inside button */
  font-size: 0 !important;
  color: transparent !important;
  text-indent: -9999px !important;
  overflow: hidden !important;
}

.za-send:hover {
  background: rgba(255, 255, 255, 0.95) !important;
  transform: translateY(-2px) scale(1.05) !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15) !important;
}

.za-send:active {
  transform: translateY(0) scale(0.98) !important;
}

.za-send::before {
  content: "" !important;
  display: block !important;
  width: 12px !important;
  height: 12px !important;
  border: 3.5px solid #333 !important;
  border-left: 0 !important;
  border-top: 0 !important;
  transform: rotate(225deg) !important;
  margin-top: 3px !important;
  flex-shrink: 0 !important;
  /* Reset any text styles */
  font-size: 16px !important;
  text-indent: 0 !important;
}

/* Extra selector to hide button text content */
.za-send,
.za-send * {
  font-size: 0 !important;
  line-height: 0 !important;
}

.za-send::before {
  font-size: 16px !important;
}

.za-email-input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: var(--za-flyout-radius);
  padding: 0 16px;
  font-size: 14px;
  height: 48px;
  background: #fff;
  box-shadow: var(--za-input-shadow)
}

.za-email-submit {
  background: var(--za-accent);
  color: #0c0c0c;
  border: 0;
  border-radius: var(--za-flyout-radius);
  padding: 0 20px;
  cursor: pointer;
  font-weight: 700;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--za-input-shadow);
  flex-shrink: 0
}

/* Proizvodi – Niwa card rail */
.niwa-products {
  --card-w: 238px;
  --gap: 12px;
  --radius: 14px;
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 8px;
  scrollbar-width: none;
  -ms-overflow-style: none
}
.niwa-products::-webkit-scrollbar { display: none }
.niwa-products { cursor: grab }
.niwa-products.dragging { cursor: grabbing; scroll-behavior: auto; scroll-snap-type: none; user-select: none }

.niwa-card {
  flex: 0 0 var(--card-w);
  scroll-snap-align: start;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .2s, transform .2s
}
.niwa-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.06);
  transform: translateY(-2px)
}

/* ── Image ── */
.niwa-card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #fff;
  overflow: hidden;
  cursor: pointer
}
.niwa-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block
}

/* Bottom hazy buffer — short, soft fog into image */
.niwa-card-img::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 30%;
  background: linear-gradient(
    to top,
    #fff 0px,
    #fff 14px,
    rgba(255,255,255,0.15) 40%,
    rgba(255,255,255,0.06) 65%,
    rgba(255,255,255,0.02) 85%,
    transparent 100%
  );
  z-index: 2;
  pointer-events: none
}

/* Badge — absolute on image top-left, no buffer */
.niwa-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  display: inline-block;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: .02em
}

/* Content — title + description + CTA below the image */
.niwa-card-content {
  padding: 14px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1
}
.niwa-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden
}
.niwa-card-desc {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0
}

/* CTA row — price left + button right */
.niwa-card-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px
}
.niwa-card-price {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0
}
.niwa-price-current {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  white-space: nowrap
}
.niwa-price-old {
  font-size: 12px;
  color: #888;
  text-decoration: line-through;
  white-space: nowrap
}

/* Footer — rating + delivery info */
.niwa-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 16px;
  margin-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: #fafafa;
  border-radius: 0 0 var(--radius) var(--radius);
  min-width: 0
}

/* Delivery info */
.niwa-card-delivery {
  font-size: 11px;
  color: #6b7280;
  white-space: nowrap
}
.niwa-card-delivery strong {
  color: #1a1a1a;
  font-weight: 600
}

/* Star rating */
.niwa-card-rating {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #9ca3af;
  line-height: 1;
  min-width: 0
}
.niwa-card-rating .niwa-stars {
  display: inline-flex;
  gap: 0;
  color: #facc15;
  font-size: 13px;
  letter-spacing: -1px
}
.niwa-card-rating .niwa-rating-count {
  font-size: 10px;
  color: #9ca3af
}

/* Pill button */
.niwa-btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: #1a1a1a;
  color: #fff;
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  transition: background .15s, transform .1s;
  flex-shrink: 0
}
.niwa-btn-pill:hover { background: #333 }
.niwa-btn-pill:active { transform: scale(.97) }
.niwa-btn-pill:disabled { background: #999; cursor: wait }

/* Sugestije – kao cipovi */
.za-suggests {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px
}

.za-chip {
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  cursor: pointer;
  background: #fff
}

.za-chip:hover {
  background: #f3f4f6
}

/* Device-specific media queries */
/* Mobile (<768px) */
@media (max-width: 767px) {
  #za-flyout {
    /* Ensure responsive behavior */
    max-width: 100vw;
    max-height: 100vh;
  }

  /* Center positioning support */
  #za-flyout.mobile-center {
    left: 50% !important;
    right: auto !important;
  }
}

@media (max-width: 1023px) {

  #za-flyout,
  #za-flyout .za-window,
  #za-flyout .za-input {
    overscroll-behavior: contain;
  }

  #za-flyout .za-input {
    touch-action: manipulation;
  }
}


/* === ZA v4: Hardcode SVG inside launcher badge === */
#za-launcher .za-badge {
  position: relative !important;
  background-image: none !important;
  overflow: hidden;
}

#za-launcher .za-badge .za-ico,
#za-launcher .za-badge i,
#za-launcher .za-badge svg,
#za-launcher .za-badge img {
  display: none !important;
}

#za-launcher .za-badge::before {
  content: "";
  position: absolute;
  inset: 2%;
  background-image: url('../img/Niwa.webp');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
}

@media (max-width: 640px) {
  #za-launcher .za-badge::before {
    inset: 2% !important;
  }

  #za-launcher .za-badge {
    height: 70px !important;
    width: 70px !important;
  }
}


/* === Centerstage Mode - Pill Launcher === */
#za-launcher.za-centerstage {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: 24px !important;
  transform: translateX(-50%) !important;
  flex-direction: row !important;
  width: auto !important;
  height: auto !important;
  z-index: 99999 !important;
  display: flex !important;
}

#za-launcher.za-centerstage .za-badge {
  display: none;
  /* Hide circular badge in centerstage mode */
}

#za-launcher.za-centerstage .za-pill {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 14px !important;
  padding: 0 20px !important;
  /* Height from admin settings, not hardcoded */
  /* Glassmorph with gradient hover */
  background: rgba(236, 233, 230, 0.35) !important;
  backdrop-filter: blur(40px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  border-radius: 40px !important;
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.3),
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
  cursor: pointer !important;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
  background-size: 200% auto !important;
  position: relative !important;
  pointer-events: auto !important; /* Ensure clickable */
}

#za-launcher.za-centerstage .za-pill:hover {
  transform: translateY(-3px) scale(1.02) !important;
  background: linear-gradient(to right, #ECE9E6 0%, #FFFFFF 51%, #ECE9E6 100%) !important;
  background-position: right center !important;
  background-size: 200% auto !important;
  box-shadow: 0 0 50px rgba(255, 255, 255, 0.5),
    0 12px 48px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.7) !important;
}

#za-launcher.za-centerstage .za-pill-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#za-launcher.za-centerstage .za-pill-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#za-launcher.za-centerstage .za-pill-text {
  font-size: 17px;
  font-weight: 500;
  color: var(--za-pill-text-color, #374151) !important;
  white-space: nowrap;
  opacity: 1;
  flex: 1;
}

#za-launcher.za-centerstage .za-pill-arrow {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: auto;
  transition: all 0.2s ease;
}

#za-launcher.za-centerstage .za-pill:hover .za-pill-arrow {
  background: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

#za-launcher.za-centerstage .za-pill-arrow::before {
  content: "";
  display: block;
  width: 12px;
  height: 12px;
  border: 3.5px solid var(--za-pill-arrow-color, #374151);
  border-left: 0;
  border-top: 0;
  transform: rotate(225deg);
  margin-top: 4px;
}

/* Pill transformation to X button when chat is open - PERFECT CIRCLE using pill height */
#za-flyout.active~#za-launcher.za-centerstage .za-pill,
#za-launcher.za-centerstage .za-pill.chat-open,
#za-launcher.za-centerstage.za-pill.chat-open {
  /* X button is perfect circle: width and height both equal to pill height */
  width: var(--pill-height, 60px) !important;
  height: var(--pill-height, 60px) !important;
  padding: 0 !important;
  border-radius: 50% !important;
  justify-content: center !important;
  /* Same glassmorph as pill */
  background: rgba(236, 233, 230, 0.35) !important;
  backdrop-filter: blur(40px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
  border: 1px solid rgba(255, 255, 255, 0.5) !important;
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.3),
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.6) !important;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
  background-size: 200% auto !important;
}

#za-flyout.active~#za-launcher.za-centerstage .za-pill:hover,
#za-launcher.za-centerstage .za-pill.chat-open:hover {
  background: linear-gradient(to right, #ECE9E6 0%, #FFFFFF 51%, #ECE9E6 100%) !important;
  background-position: right center !important;
  box-shadow: 0 0 50px rgba(255, 255, 255, 0.5),
    0 12px 48px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.7) !important;
  transform: translateY(-3px) scale(1.05) !important;
}

#za-flyout.active~#za-launcher.za-centerstage .za-pill-icon,
#za-flyout.active~#za-launcher.za-centerstage .za-pill-text,
#za-launcher.za-centerstage .za-pill.chat-open .za-pill-icon,
#za-launcher.za-centerstage .za-pill.chat-open .za-pill-text {
  display: none !important;
}

#za-flyout.active~#za-launcher.za-centerstage .za-pill-arrow,
#za-launcher.za-centerstage .za-pill.chat-open .za-pill-arrow {
  margin: 0 !important;
  background: transparent !important;
  width: 100% !important;
  height: 100% !important;
}

#za-flyout.active~#za-launcher.za-centerstage .za-pill-arrow::before,
#za-launcher.za-centerstage .za-pill.chat-open .za-pill-arrow::before {
  /* X shape */
  content: "\00D7" !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 42px !important;
  font-weight: 300 !important;
  color: var(--za-pill-arrow-open-color, var(--za-pill-arrow-color, #333)) !important;
  border: none !important;
  transform: none !important;
  margin: 0 !important;
  line-height: 1 !important;
}

/* Flyout positioning for centerstage - DYNAMIC spacing above X button */
#za-flyout.za-centerstage-flyout {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  /* JavaScript direktno setuje bottom - JEDINO mesto za kontrolu gap-a */
  margin: 0 auto !important;
  transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Mobile adjustments for centerstage */
@media (max-width: 767px) {
  #za-launcher.za-centerstage .za-pill {
    padding: 0 16px;
    gap: 10px;
  }

  #za-launcher.za-centerstage .za-pill-text {
    font-size: 14px;
  }

  #za-flyout.za-centerstage-flyout {
    /* JavaScript direktno setuje bottom inline style */
    width: 90% !important;
    max-width: 400px !important;
  }
}


/* === Simple Typing Animation === */
.za-typing {
  clear: both;
  margin: 6px 0;
}

.za-typing .za-bubble {
  max-width: 85%;
  background: #f3f4f6 !important;
  color: #111827 !important;
  border-top-left-radius: 4px;
  border: 1px solid var(--niwa-border) !important;
  padding: 12px 16px;
}

.za-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.za-typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6b7280;
  animation: za-typing-bounce 1.4s infinite ease-in-out;
}

.za-typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

.za-typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

.za-typing-dots span:nth-child(3) {
  animation-delay: 0s;
}

@keyframes za-typing-bounce {

  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}



/* === NIWA AI – Glassmind-inspired overrides === */

#za-launcher .za-badge {
  background: rgba(255, 255, 255, 0.25) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid var(--niwa-border);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

#za-flyout {
  background: var(--niwa-bg) !important;
  backdrop-filter: blur(var(--niwa-blur));
  -webkit-backdrop-filter: blur(var(--niwa-blur));
  border: 1px solid var(--niwa-border);
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25);
}

#za-flyout .za-head {
  background: rgba(255, 255, 255, 0.35) !important;
  color: var(--niwa-text) !important;
  border-bottom: 1px solid var(--niwa-border);
}

#za-flyout .za-head .za-head-actions button {
  background: rgba(255, 255, 255, 0.6) !important;
  border: 1px solid var(--niwa-border) !important;
  color: var(--niwa-text) !important;
}

.za-window {
  background: transparent !important;
  color: var(--niwa-text);
}

.za-bubble {
  border: 1px solid var(--niwa-border) !important;
  box-shadow: var(--za-bubble-shadow) !important;
}

.za-bot {
  background: rgba(255, 255, 255, 0.75) !important;
  color: var(--niwa-text) !important;
}

.za-user {
  background: rgba(255, 255, 255, 0.95) !important;
  color: var(--niwa-text) !important;
  float: right;
  clear: both;
}

.za-input {
  background: transparent !important;
  border-top: 1px solid var(--niwa-border) !important;
}

.za-input input {
  background: rgba(255, 255, 255, 0.6) !important;
  border: 1px solid var(--niwa-border) !important;
  color: var(--niwa-text) !important;
  box-shadow: var(--za-input-shadow) !important;
}

.za-send {
  background: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid var(--niwa-border) !important;
  color: var(--niwa-text) !important;
  box-shadow: var(--za-input-shadow) !important;
}

/* Email form with glassmorphism */
.za-email-input {
  background: rgba(255, 255, 255, 0.6) !important;
  border: 1px solid var(--niwa-border) !important;
  color: var(--niwa-text) !important;
  box-shadow: var(--za-input-shadow) !important;
}

.za-email-submit {
  background: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid var(--niwa-border) !important;
  color: var(--niwa-text) !important;
  box-shadow: var(--za-input-shadow) !important;
}

.za-chip {
  border: 1px solid var(--niwa-border) !important;
  background: rgba(255, 255, 255, 0.75) !important;
}

.za-chip:hover {
  background: rgba(255, 255, 255, 0.9) !important;
}

/* ======================= Dark Mode ======================= */
#za-flyout.za-dark {
  background: rgba(24, 27, 34, 0.92) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5) !important;
}

/* Header */
#za-flyout.za-dark .za-head {
  background: rgba(255, 255, 255, 0.04) !important;
  color: #e4e4e7 !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}
#za-flyout.za-dark .za-head .za-head-actions button {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #e4e4e7 !important;
}
#za-flyout.za-dark .za-head .za-head-actions button:hover {
  background: rgba(255, 255, 255, 0.14) !important;
}
#za-flyout.za-dark .za-title {
  color: #e4e4e7 !important;
}

/* Window */
#za-flyout.za-dark .za-window {
  background: transparent !important;
  color: #e4e4e7 !important;
}

/* Bubbles */
#za-flyout.za-dark .za-bot {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #e4e4e7 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}
#za-flyout.za-dark .za-user {
  background: rgba(255, 255, 255, 0.10) !important;
  color: #e4e4e7 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Input */
#za-flyout.za-dark .za-input {
  border-top-color: rgba(255, 255, 255, 0.08) !important;
}
#za-flyout.za-dark .za-input input {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #e4e4e7 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
}
#za-flyout.za-dark .za-input input::placeholder {
  color: #a1a1aa !important;
}
#za-flyout.za-dark .za-input input:focus {
  border-color: rgba(255, 255, 255, 0.18) !important;
  background: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.3) !important;
}

/* Send button */
#za-flyout.za-dark .za-send {
  background: rgba(255, 255, 255, 0.10) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}
#za-flyout.za-dark .za-send::before {
  border-color: #e4e4e7 !important;
}
#za-flyout.za-dark .za-send:hover {
  background: rgba(255, 255, 255, 0.16) !important;
}

/* Product cards — dark mode */
#za-flyout.za-dark .niwa-card {
  background: #0a0a0a !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06) !important;
}
#za-flyout.za-dark .niwa-card:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.10) !important;
}
#za-flyout.za-dark .niwa-card-img {
  background: #0a0a0a !important;
}
/* Dark hazy bottom buffer gradient */
#za-flyout.za-dark .niwa-card-img::after {
  background: linear-gradient(
    to top,
    #0a0a0a 0px,
    #0a0a0a 14px,
    rgba(10,10,10,0.15) 40%,
    rgba(10,10,10,0.06) 65%,
    rgba(10,10,10,0.02) 85%,
    transparent 100%
  ) !important;
}
#za-flyout.za-dark .niwa-card-title {
  color: #fff !important;
}
#za-flyout.za-dark .niwa-card-desc {
  color: #888 !important;
}
#za-flyout.za-dark .niwa-price-current {
  color: #fff !important;
}
#za-flyout.za-dark .niwa-price-old {
  color: rgba(255,255,255,0.5) !important;
}
#za-flyout.za-dark .niwa-badge {
  background: #ff3b30 !important;
}
/* Dark footer */
#za-flyout.za-dark .niwa-card-footer {
  background: #161616 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
}
#za-flyout.za-dark .niwa-card-rating {
  color: #71717a !important;
}
#za-flyout.za-dark .niwa-card-rating .niwa-stars {
  color: #ffb400 !important;
}
#za-flyout.za-dark .niwa-card-rating .niwa-rating-count {
  color: #71717a !important;
}
#za-flyout.za-dark .niwa-card-delivery {
  color: #888 !important;
}
#za-flyout.za-dark .niwa-card-delivery strong {
  color: #fff !important;
}
/* Pill button — inverted in dark mode */
#za-flyout.za-dark .niwa-btn-pill {
  background: #fff !important;
  color: #000 !important;
}
#za-flyout.za-dark .niwa-btn-pill:hover {
  background: #e4e4e7 !important;
}
#za-flyout.za-dark .niwa-btn-pill:disabled {
  background: #52525b !important;
  color: #a1a1aa !important;
}

/* Suggestion chips */
#za-flyout.za-dark .za-chip {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #e4e4e7 !important;
}
#za-flyout.za-dark .za-chip:hover {
  background: rgba(255, 255, 255, 0.12) !important;
}

/* Email form */
#za-flyout.za-dark .za-email-input {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #e4e4e7 !important;
}
#za-flyout.za-dark .za-email-submit {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #e4e4e7 !important;
}

/* Typing animation */
#za-flyout.za-dark .za-typing .za-bubble {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #e4e4e7 !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}
#za-flyout.za-dark .za-typing-dots span {
  background: #a1a1aa !important;
}

/* Copy code button */
#za-flyout.za-dark .za-copy-code-btn {
  background: #d2ef9a !important;
  color: #020c0a !important;
}

/* Scrollbar */
#za-flyout.za-dark .za-window::-webkit-scrollbar {
  width: 6px;
}
#za-flyout.za-dark .za-window::-webkit-scrollbar-track {
  background: transparent;
}
#za-flyout.za-dark .za-window::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

/* Launcher dark mode */
#za-launcher.za-dark .za-badge {
  background: rgba(24, 27, 34, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}
#za-launcher.za-dark .za-label {
  background: rgba(24, 27, 34, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  color: #e4e4e7 !important;
}

/* Centerstage pill dark mode */
#za-launcher.za-dark.za-centerstage .za-pill {
  background: rgba(24, 27, 34, 0.75) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.3),
    0 8px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}
#za-launcher.za-dark.za-centerstage .za-pill:hover {
  background: rgba(36, 39, 48, 0.85) !important;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.4),
    0 12px 48px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}
#za-launcher.za-dark.za-centerstage .za-pill-text {
  color: #e4e4e7 !important;
}
#za-launcher.za-dark.za-centerstage .za-pill-arrow::before {
  border-color: #e4e4e7 !important;
}

/* Attention capture bubble dark mode */
.za-dark ~ .za-attention-bubble,
.za-attention-bubble.za-dark {
  background: rgba(24, 27, 34, 0.92) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.3),
    0 8px 32px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}
.za-dark ~ .za-attention-bubble .za-bubble-title,
.za-attention-bubble.za-dark .za-bubble-title {
  color: #e4e4e7 !important;
}
.za-dark ~ .za-attention-bubble .za-bubble-text,
.za-attention-bubble.za-dark .za-bubble-text {
  color: #a1a1aa !important;
}

/* Copy Code Button for CB Coupon Messages */
.za-coupon-actions {
  margin-top: 12px;
  text-align: center;
}

.za-copy-code-btn {
  background: #d2ef9a !important;
  color: #020c0a !important;
  border: none !important;
  padding: 10px 20px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  transition: all 0.2s ease !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  display: inline-block !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.za-copy-code-btn:hover {
  background: #c0e088 !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.za-copy-code-btn:active {
  transform: translateY(0) !important;
}

/* ======================= Attention Capture Bubbles ======================= */

.za-attention-bubble {
  position: fixed;
  z-index: 99998;
  /* Below flyout but above everything else */
  max-width: 300px;
  width: 300px;
  padding: 12px 16px;
  padding-right: 36px;
  /* Space for close button */

  /* Glassmorphism style */
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.3),
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);

  cursor: pointer;

  /* Animation prep */
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Prevent text selection on bubble */
  user-select: none;
  -webkit-user-select: none;
}

/* Bubble Header */
.za-bubble-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.za-bubble-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.za-bubble-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.za-bubble-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  letter-spacing: 0.2px;
}

.za-attention-bubble.za-bubble-visible {
  opacity: 1;
  transform: translateY(0);
}

.za-bubble-text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  font-weight: 400;
}

.za-bubble-close {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  width: 20px !important;
  height: 20px !important;
  background: transparent !important;
  border: none !important;
  border-radius: 4px !important;
  color: #666 !important;
  font-size: 18px !important;
  line-height: 1 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 0.2s ease, color 0.2s ease !important;
  padding: 0 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.za-bubble-close:hover {
  background: rgba(0, 0, 0, 0.05) !important;
  color: #333 !important;
}

.za-attention-bubble:hover {
  background: rgba(236, 233, 230, 0.95);
  box-shadow: 0 0 50px rgba(255, 255, 255, 0.4),
    0 12px 40px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transform: translateY(-2px) scale(1.01);
}

/* Mobile responsive */
@media (max-width: 480px) {
  .za-attention-bubble {
    width: calc(100vw - 32px);
    max-width: calc(100vw - 32px);
    left: 16px !important;
    right: 16px !important;
    transform: translateX(0) !important;
  }

  .za-attention-bubble.za-bubble-visible {
    transform: translateY(0) translateX(0) !important;
  }
}

/* Fade-in animation */
@keyframes za-bubble-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade-out animation */
@keyframes za-bubble-fade-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(10px);
  }
}
