/* ==========================================================================
   Niwa Chatbot – Action Buttons (Glass Outline Pills)
   ---------------------------------------------------------------------------
   Adapted from React QuickAction: rounded-full, outline border,
   dark translucent bg, neutral text. Same look in both themes.

   STRUCTURE:
     .niwa-actions                    (flex-wrap container)
       .niwa-action                   (individual pill button/link)
         .niwa-action__icon           (optional SVG icon, 16px)
         .niwa-action__label          (button text)
   ========================================================================== */

/* ── Container ──────────────────────────────────────────────────────────── */
/* In chat — actions after a bot message (inside .niwa-messages wrapper or
   directly inside the body container when no wrapper exists in WP). */
.niwa-messages .niwa-actions,
.niwa-morph__body > .niwa-actions,
.niwa-center__body > .niwa-actions,
.niwa-shortcode__body > .niwa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--niwa-space-sm);
  padding: var(--niwa-space-sm) var(--niwa-space-lg);
  padding-left: calc(28px + var(--niwa-space-sm) + var(--niwa-space-lg));
}

/* Suggestions — inside chat body at bottom, right-aligned */
.niwa-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  padding: 6px var(--niwa-space-lg);
  margin-top: auto;
}

.niwa-suggestions:empty {
  display: none;
}

/* ── Button — matches React QuickAction exactly ─────────────────────────── */
/* Higher specificity with .niwa-widget to override WordPress theme button styles. */
.niwa-widget .niwa-action,
.niwa-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 9999px;
  font: 500 11.5px/1 var(--niwa-font-family) !important;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  text-transform: none;
  letter-spacing: -0.015em !important;
  outline: none;
  box-shadow: none;
  min-height: 0;

  background: var(--niwa-product-control-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 0;
  color: var(--niwa-product-text);

  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease,
    opacity 160ms ease !important;
}

.niwa-action:hover {
  background: var(--niwa-product-control-active);
  color: var(--niwa-product-text);
  transform: translateY(-1px);
}

.niwa-action:active {
  background: var(--niwa-product-control-active);
  transform: scale(0.97);
}

/* ── Dark Theme ─────────────────────────────────────────────────────────── */
[data-niwa-theme="dark"] .niwa-action {
  background: var(--niwa-product-control-bg);
  color: var(--niwa-product-text);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

[data-niwa-theme="dark"] .niwa-action:hover {
  background: var(--niwa-product-control-active);
  color: var(--niwa-product-text);
}

[data-niwa-theme="dark"] .niwa-action:active {
  background: var(--niwa-product-control-active);
}

/* ── Icon ───────────────────────────────────────────────────────────────── */
.niwa-action__icon {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.niwa-action__icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Focus Visible ──────────────────────────────────────────────────────── */
.niwa-action:focus-visible {
  outline: 2px solid var(--niwa-color-primary);
  outline-offset: 2px;
}

/* ── Quick Reply Chips ──────────────────────────────────────────────────── */
.niwa-quick-replies {
  display: flex;
  gap: var(--niwa-space-sm);
  padding: var(--niwa-space-sm) var(--niwa-space-lg);
  padding-left: calc(28px + var(--niwa-space-sm) + var(--niwa-space-lg));
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;

  /* Hide scrollbar on quick-replies */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.niwa-quick-replies::-webkit-scrollbar {
  display: none;
}

/* ── Individual Chip ────────────────────────────────────────────────────── */
.niwa-quick-reply {
  flex-shrink: 0;
  padding: var(--niwa-space-sm) var(--niwa-space-lg);
  border-radius: var(--niwa-radius-full);
  border: 0;
  background: var(--niwa-product-control-bg);
  color: var(--niwa-product-text);
  font-size: var(--niwa-font-size-sm);
  font-weight: var(--niwa-font-weight-medium);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--niwa-transition-fast),
    color var(--niwa-transition-fast),
    transform var(--niwa-transition-fast);
}

.niwa-quick-reply:hover {
  background: var(--niwa-product-control-active);
  color: var(--niwa-product-text);
  transform: translateY(-1px);
}

.niwa-quick-reply:active {
  transform: translateY(0) scale(0.97);
}
