/* WooCommerce AI Shopping Assistant widget */

#wcai-assistant-root {
  --wcai-bg: #0f172a;
  --wcai-surface: #ffffff;
  --wcai-ink: #0f172a;
  --wcai-muted: #64748b;
  --wcai-accent: #0d9488;
  --wcai-accent-ink: #ffffff;
  --wcai-border: #e2e8f0;
  --wcai-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  font-family: "Segoe UI", system-ui, sans-serif;
  z-index: 99999;
}

.wcai-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--wcai-accent, #0d9488);
  color: var(--wcai-accent-ink);
  box-shadow: var(--wcai-shadow);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.18s ease, background 0.18s ease;
}

.wcai-launcher:hover {
  transform: translateY(-2px);
  background: #0f766e;
}

.wcai-launcher__icon {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}

.wcai-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 120px));
  background: var(--wcai-surface);
  color: var(--wcai-ink);
  border: 1px solid var(--wcai-border);
  border-radius: 16px;
  box-shadow: var(--wcai-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wcai-panel[hidden] {
  display: none !important;
}

.wcai-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--wcai-bg);
  color: #f8fafc;
}

.wcai-panel__title {
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.wcai-panel__close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}

.wcai-panel__close:hover {
  opacity: 1;
}

.wcai-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 40%);
}

.wcai-msg {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.wcai-msg--user {
  align-self: flex-end;
  background: var(--wcai-accent);
  color: var(--wcai-accent-ink);
  border-bottom-right-radius: 4px;
}

.wcai-msg--bot {
  align-self: flex-start;
  background: #f1f5f9;
  color: var(--wcai-ink);
  border-bottom-left-radius: 4px;
}

.wcai-msg--thinking {
  color: var(--wcai-muted);
  font-style: italic;
}

.wcai-msg--cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: transparent;
  padding: 0;
  max-width: 100%;
}

.wcai-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--wcai-border);
  border-radius: 12px;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wcai-card:hover {
  border-color: #99f6e4;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.12);
}

.wcai-card__img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: #e2e8f0;
}

.wcai-card__title {
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 2px;
}

.wcai-card__price {
  font-size: 0.85rem;
  color: var(--wcai-ink);
  margin-bottom: 4px;
}

.wcai-card__reason {
  font-size: 0.78rem;
  color: var(--wcai-muted);
  line-height: 1.35;
}

.wcai-panel__form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--wcai-border);
  background: #fff;
}

.wcai-panel__input {
  border: 1px solid var(--wcai-border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9rem;
}

.wcai-panel__input:focus {
  outline: 2px solid #99f6e4;
  border-color: var(--wcai-accent, #0d9488);
}

.wcai-panel__send {
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  background: var(--wcai-accent, #0d9488);
  color: var(--wcai-accent-ink);
  font-weight: 600;
  cursor: pointer;
}

.wcai-panel__send:hover {
  background: #0f766e;
}

.wcai-panel__mic {
  border: 1px solid var(--wcai-border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  padding: 0 10px;
  font-size: 1rem;
}

.wcai-panel__mic.is-listening {
  background: #fef3c7;
  border-color: #f59e0b;
}

.wcai-panel__brand {
  font-size: 0.7rem;
  color: var(--wcai-muted);
  text-align: center;
  padding: 0 12px 10px;
}

.wcai-panel--embedded {
  position: relative;
  right: auto;
  bottom: auto;
  width: 100%;
  max-width: 480px;
  height: 520px;
  margin: 0 auto;
}

.wcai-panel--modal {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100001;
}

.wcai-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 100000;
}

.wcai-backdrop[hidden],
.wcai-panel[hidden] {
  display: none !important;
}

/* Inline AI search bar — hero / nav / content */
.wcai-search-root,
.wcai-auto-search {
  width: 100%;
  max-width: 720px;
  margin: 0.75rem auto;
  padding: 0 12px;
  box-sizing: border-box;
}

.wcai-searchbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
  background: #fff;
  border: 1px solid var(--wcai-border, #e2e8f0);
  border-radius: 999px;
  padding: 6px 6px 6px 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.wcai-searchbar__input {
  border: 0;
  outline: none;
  font: inherit;
  font-size: 0.95rem;
  background: transparent;
  min-width: 0;
}

.wcai-searchbar__btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--wcai-accent, #0d9488);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.wcai-searchbar__btn:hover {
  filter: brightness(0.95);
}

/* CTA button widget */
.wcai-button-root {
  display: inline-flex;
  margin: 0.5rem 0;
}

.wcai-cta {
  border: 0;
  border-radius: 12px;
  padding: 12px 20px;
  background: var(--wcai-accent, #0d9488);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.25);
}

.wcai-cta:hover {
  filter: brightness(0.95);
}

.wcai-embed-root,
.wcai-panel-root {
  width: 100%;
  margin: 1.5rem 0;
}

.wcai-block-preview {
  padding: 16px;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  background: #f8fafc;
}

.wcai-block-preview code {
  font-size: 0.8rem;
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
}

@media (max-width: 480px) {
  .wcai-panel {
    right: 12px;
    bottom: 80px;
    width: calc(100vw - 24px);
    height: min(70vh, 560px);
  }

  .wcai-panel--embedded {
    height: min(70vh, 520px);
  }

  .wcai-panel--modal {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }

  .wcai-launcher {
    right: 12px;
    bottom: 12px;
  }

  .wcai-searchbar {
    border-radius: 14px;
    grid-template-columns: 1fr;
    padding: 10px;
  }
}
