/* ═══════════════════════════════════════════════════════════════════
   ToolBoxesAI Promotion Engine v1.1
   Premium glassmorphic card · No gradients · Dark + Light themes
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Scoped Reset ───────────────────────────────────────── */
.tbai-promo-card,
.tbai-promo-card *,
.tbai-promo-card *::before,
.tbai-promo-card *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  line-height: normal;
}

/* ─── Card Container (Dark — default) ────────────────────── */
.tbai-promo-card {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 310px;
  z-index: 9990;

  /* Dark Glassmorphism */
  background: rgba(10, 10, 15, 0.82);
  backdrop-filter: blur(28px) saturate(1.3);
  -webkit-backdrop-filter: blur(28px) saturate(1.3);

  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.32),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.04);

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: rgba(255, 255, 255, 0.88);

  /* Hidden — slides in from right on desktop */
  opacity: 0;
  transform: translateX(110%);
  pointer-events: none;

  transition:
    transform 420ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 300ms ease;

  overflow: hidden;
}

.tbai-promo-card.tbai-promo--visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.tbai-promo-card.tbai-promo--dismissing {
  opacity: 0;
  transform: translateX(110%);
  pointer-events: none;
}

/* ─── Inner Padding ──────────────────────────────────────── */
.tbai-promo-inner {
  padding: 14px 16px 10px;
}

/* ─── Header Row ─────────────────────────────────────────── */
.tbai-promo-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

/* Logo — top-left */
.tbai-promo-logo {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.5);
}

.tbai-promo-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 7px;
  display: block;
}

.tbai-promo-logo svg {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
}

/* Letter fallback */
.tbai-promo-logo-letter {
  font-size: 15px;
  font-weight: 700;
  opacity: 0.6;
  user-select: none;
}

/* Meta */
.tbai-promo-meta {
  flex: 1;
  min-width: 0;
}

.tbai-promo-name {
  font-size: 13.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tbai-promo-tagline {
  font-size: 11.5px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.38);
  line-height: 1.4;
  margin-top: 2px;
}

/* ─── Close Button ───────────────────────────────────────── */
.tbai-promo-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.22);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  transition: color 200ms ease, transform 200ms ease;
  margin-top: -2px;
  font-family: inherit;
}

.tbai-promo-close:hover {
  color: rgba(255, 255, 255, 0.7);
  transform: scale(1.1);
}

/* ─── CTA Button — solid, no gradient ────────────────────── */
.tbai-promo-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 200ms ease,
    color 200ms ease,
    border-color 200ms ease;
}

.tbai-promo-cta:hover {
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.15);
}

.tbai-promo-cta-arrow {
  font-size: 12px;
  transition: transform 200ms ease;
}

.tbai-promo-cta:hover .tbai-promo-cta-arrow {
  transform: translateX(3px);
}

/* ─── Expand / Collapse Toggle ───────────────────────────── */
.tbai-promo-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 5px 0 2px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.28);
  transition: color 200ms ease;
  margin-top: 4px;
}

.tbai-promo-expand-btn:hover {
  color: rgba(255, 255, 255, 0.55);
}

.tbai-promo-expand-btn svg {
  animation: tbai-pulse 2.2s ease-in-out infinite;
}

@keyframes tbai-pulse {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  50%      { opacity: 0.7; transform: translateY(2px); }
}

/* Flip arrow when expanded */
.tbai-promo-card.tbai-promo--expanded .tbai-promo-expand-btn svg {
  transform: rotate(180deg);
  animation: none;
}

/* Hidden when no demos */
.tbai-promo-expand-btn.tbai-promo--hidden {
  display: none;
}

/* ─── Demo Image Panel ───────────────────────────────────── */
.tbai-promo-demo-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 380ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tbai-promo-card.tbai-promo--expanded .tbai-promo-demo-panel {
  max-height: 300px;
}

.tbai-promo-demo-viewport {
  overflow: hidden;
  border-radius: 8px;
  margin: 6px 16px 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
}

.tbai-promo-demo-track {
  display: flex;
  transition: transform 500ms ease;
}

.tbai-promo-demo-track img {
  width: 100%;
  min-width: 100%;
  height: auto;
  max-height: 260px;
  display: block;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.05);
}

/* ─── Progress Bar ───────────────────────────────────────── */
.tbai-promo-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 0 14px 14px;
  overflow: hidden;
}

.tbai-promo-progress-fill {
  height: 100%;
  width: 100%;
  background: rgba(255, 255, 255, 0.14);
  transform-origin: left;
}

.tbai-promo-progress-fill.tbai-promo--ticking {
  animation: tbai-deplete 15s linear forwards;
}

@keyframes tbai-deplete {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ═══════════════════════════════════════════════════════════════════
   LIGHT THEME — Premium white glassmorphism
   Applied via .tbai-promo--light class (auto-detected by JS)
   ═══════════════════════════════════════════════════════════════════ */
.tbai-promo-card.tbai-promo--light {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.10),
    0 1px 3px rgba(0, 0, 0, 0.06),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.7);
  color: rgba(15, 15, 20, 0.88);
}

/* Logo */
.tbai-promo--light .tbai-promo-logo {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.06);
  color: rgba(15, 15, 20, 0.5);
}

.tbai-promo--light .tbai-promo-logo-letter {
  color: rgba(15, 15, 20, 0.5);
}

/* Text */
.tbai-promo--light .tbai-promo-name {
  color: rgba(15, 15, 20, 0.9);
}

.tbai-promo--light .tbai-promo-tagline {
  color: rgba(15, 15, 20, 0.45);
}

/* Close */
.tbai-promo--light .tbai-promo-close {
  color: rgba(15, 15, 20, 0.22);
}

.tbai-promo--light .tbai-promo-close:hover {
  color: rgba(15, 15, 20, 0.65);
}

/* CTA */
.tbai-promo--light .tbai-promo-cta {
  color: rgba(15, 15, 20, 0.65);
  background: rgba(15, 15, 20, 0.05);
  border-color: rgba(15, 15, 20, 0.08);
}

.tbai-promo--light .tbai-promo-cta:hover {
  background: rgba(15, 15, 20, 0.09);
  color: rgba(15, 15, 20, 0.9);
  border-color: rgba(15, 15, 20, 0.14);
}

/* Expand */
.tbai-promo--light .tbai-promo-expand-btn {
  color: rgba(15, 15, 20, 0.25);
}

.tbai-promo--light .tbai-promo-expand-btn:hover {
  color: rgba(15, 15, 20, 0.5);
}

/* Demo viewport */
.tbai-promo--light .tbai-promo-demo-viewport {
  border-color: rgba(0, 0, 0, 0.06);
  background: rgba(0, 0, 0, 0.03);
}

/* Progress */
.tbai-promo--light .tbai-promo-progress {
  background: rgba(0, 0, 0, 0.03);
}

.tbai-promo--light .tbai-promo-progress-fill {
  background: rgba(0, 0, 0, 0.10);
}

/* ─── Responsive · Mobile (≤ 767 px) ─────────────────────── */
@media (max-width: 767px) {
  .tbai-promo-card {
    bottom: auto;
    top: 12px;
    right: 12px;
    width: 268px;
    transform: translateY(-120%);
  }

  .tbai-promo-card.tbai-promo--visible {
    transform: translateY(0);
  }

  .tbai-promo-card.tbai-promo--dismissing {
    transform: translateY(-120%);
  }

  .tbai-promo-inner {
    padding: 12px 14px 8px;
  }

  .tbai-promo-name    { font-size: 13px; }
  .tbai-promo-tagline { font-size: 11px; }
}

/* ─── Responsive · Tablet (768 – 1023 px) ────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  .tbai-promo-card {
    bottom: 16px;
    right: 16px;
    width: 300px;
  }
}

/* ─── Reduced Motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .tbai-promo-card {
    transition: opacity 200ms ease !important;
  }

  .tbai-promo-card,
  .tbai-promo-card.tbai-promo--visible,
  .tbai-promo-card.tbai-promo--dismissing {
    transform: none !important;
  }

  .tbai-promo-expand-btn svg { animation: none !important; }
  .tbai-promo-progress-fill.tbai-promo--ticking { animation: none !important; }
  .tbai-promo-demo-track { transition: none !important; }
  .tbai-promo-demo-panel { transition: none !important; }
}
