/* ==========================================================================
   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-family: var(--niwa-font-family);
  font-size: 12px;
  font-weight: var(--niwa-font-weight-medium);
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  text-transform: none;
  letter-spacing: normal;
  line-height: normal;
  outline: none;
  box-shadow: none;
  min-height: 0;

  /* Light theme: glass outline with dark text */
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.15);
  color: #374151;

  transition:
    background 150ms ease,
    color 150ms ease,
    border-color 150ms ease;
}

.niwa-action:hover {
  background: rgba(255, 255, 255, 0.45);
  color: #111827;
  border-color: rgba(0, 0, 0, 0.25);
}

.niwa-action:active {
  background: rgba(255, 255, 255, 0.55);
}

/* ── Dark Theme ─────────────────────────────────────────────────────────── */
[data-niwa-theme="dark"] .niwa-action {
  background: rgba(0, 0, 0, 0.5);
  border-color: #404040;
  color: #D1D5DB;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

[data-niwa-theme="dark"] .niwa-action:hover {
  background: #404040;
  color: #FFFFFF;
  border-color: #525252;
}

[data-niwa-theme="dark"] .niwa-action:active {
  background: #333333;
}

/* ── 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: 1.5px solid var(--niwa-color-primary);
  color: var(--niwa-color-primary);
  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-color-primary);
  color: var(--niwa-color-text-inverse);
  transform: translateY(-1px);
}

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