/* ==========================================================================
   Niwa AI – Attention Capture Bubbles
   ---------------------------------------------------------------------------
   Glass-morphism attention bubbles matching the morph chat glass style.

   NOTE: Attention bubbles live in document.body (outside .niwa-widget),
   so theme selectors use [data-niwa-theme] ON the bubble element itself.
   The JS copies data-niwa-theme from .niwa-widget to each bubble.
   ========================================================================== */

/* ── Base (light theme default) ────────────────────────────────────────── */
.niwa-attention-bubble {
  position: fixed;
  z-index: var(--niwa-layer-attention);
  width: min(320px, calc(100vw - 32px));
  max-width: 320px;
  padding: 14px 16px 16px;
  padding-right: 42px;
  border-radius: var(--niwa-radius-lg, 22px);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    visibility 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
  pointer-events: none;

  /* Light glass — matches morph light glass */
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.06);

  /* Light text colors (inline since outside .niwa-widget token scope) */
  color: #1A1A1A;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.niwa-attention-bubble.niwa-bubble-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.niwa-attention-bubble:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 0, 0, 0.14);
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.12),
    0 2px 6px rgba(0, 0, 0, 0.08);
}

/* ── Header ────────────────────────────────────────────────────────────── */
.niwa-attention-bubble .niwa-bubble-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.niwa-attention-bubble .niwa-bubble-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.niwa-attention-bubble .niwa-bubble-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.niwa-attention-bubble .niwa-bubble-title {
  color: #1A1A1A;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.niwa-attention-bubble .niwa-bubble-text {
  color: #6B7280;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
}

/* ── Close Button ──────────────────────────────────────────────────────── */
.niwa-attention-bubble .niwa-bubble-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  color: #6B7280;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.niwa-attention-bubble .niwa-bubble-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #1A1A1A;
  transform: translateY(-1px);
}

/* ── Action Button ─────────────────────────────────────────────────────── */
.niwa-attention-bubble .niwa-bubble-button-container {
  margin-top: 12px;
}

.niwa-attention-bubble .niwa-bubble-action-btn {
  width: 100%;
  justify-content: center;
}

/* ==========================================================================
   Dark Theme
   Selector: [data-niwa-theme="dark"] ON the bubble itself (not parent).
   ========================================================================== */
.niwa-attention-bubble[data-niwa-theme="dark"] {
  /* Dark glass — matches morph dark glass */
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.05) inset;

  /* Dark text colors */
  color: #E8E6E1;
}

.niwa-attention-bubble[data-niwa-theme="dark"]:hover {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.niwa-attention-bubble[data-niwa-theme="dark"] .niwa-bubble-title {
  color: #E8E6E1;
}

.niwa-attention-bubble[data-niwa-theme="dark"] .niwa-bubble-text {
  color: #9CA3AF;
}

.niwa-attention-bubble[data-niwa-theme="dark"] .niwa-bubble-avatar {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.niwa-attention-bubble[data-niwa-theme="dark"] .niwa-bubble-close {
  background: rgba(255, 255, 255, 0.1);
  color: #9CA3AF;
}

.niwa-attention-bubble[data-niwa-theme="dark"] .niwa-bubble-close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #E8E6E1;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .niwa-attention-bubble {
    left: 16px !important;
    right: 16px !important;
    max-width: none;
    width: auto;
    transform: translateY(10px) !important;
  }

  .niwa-attention-bubble.niwa-bubble-visible {
    transform: translateY(0) !important;
  }
}
