.maro-ai {
  --maro-ai-bg: #ffffff;
  --maro-ai-panel: #ffffff;
  --maro-ai-text: #17201a;
  --maro-ai-muted: #66756d;
  --maro-ai-line: #dce5df;
  --maro-ai-soft: #f4f8f5;
  --maro-ai-primary: #159947;
  --maro-ai-primary-strong: #0e7a37;
  --maro-ai-shadow: 0 22px 70px rgba(13, 35, 23, 0.22);
  color: var(--maro-ai-text);
}

.maro-ai[data-theme="dark"] {
  --maro-ai-bg: #101713;
  --maro-ai-panel: #121c17;
  --maro-ai-text: #edf7f0;
  --maro-ai-muted: #a7b8ad;
  --maro-ai-line: #29382f;
  --maro-ai-soft: #1a261f;
  --maro-ai-primary: #25d366;
  --maro-ai-primary-strong: #39e778;
  --maro-ai-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
}

.maro-ai-launcher {
  position: fixed;
  inset-inline-end: 22px;
  bottom: 22px;
  z-index: 1050;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--maro-ai-primary), var(--maro-ai-primary-strong));
  color: #fff;
  box-shadow: 0 14px 34px rgba(21, 153, 71, 0.34);
  font-weight: 800;
  letter-spacing: 0;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.maro-ai-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(21, 153, 71, 0.42);
}

.maro-ai-launcher__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.82rem;
}

.maro-ai-panel {
  position: fixed;
  top: 0;
  inset-inline-end: 0;
  z-index: 1060;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  width: min(430px, 100vw);
  height: 100dvh;
  background: var(--maro-ai-panel);
  color: var(--maro-ai-text);
  box-shadow: var(--maro-ai-shadow);
  transform: translateX(110%);
  opacity: 0;
  pointer-events: none;
  transition: transform 220ms ease, opacity 220ms ease;
}

[dir="rtl"] .maro-ai-panel {
  transform: translateX(110%);
}

.maro-ai.is-open .maro-ai-panel {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.maro-ai-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  background: linear-gradient(135deg, var(--maro-ai-soft), var(--maro-ai-panel));
  border-bottom: 1px solid var(--maro-ai-line);
}

.maro-ai-kicker {
  display: inline-block;
  margin-bottom: 4px;
  color: var(--maro-ai-primary);
  font-size: 0.78rem;
  font-weight: 900;
}

.maro-ai-panel h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
}

.maro-ai-panel p {
  margin: 5px 0 0;
  color: var(--maro-ai-muted);
  font-size: 0.86rem;
}

.maro-ai-header-actions {
  display: flex;
  gap: 8px;
}

.maro-ai-icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--maro-ai-line);
  border-radius: 50%;
  background: var(--maro-ai-bg);
  color: var(--maro-ai-text);
  font-size: 1.2rem;
  line-height: 1;
}

.maro-ai-starters {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--maro-ai-line);
}

.maro-ai-starters button {
  flex: 0 0 auto;
  border: 1px solid var(--maro-ai-line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--maro-ai-soft);
  color: var(--maro-ai-text);
  font-size: 0.84rem;
  white-space: nowrap;
}

.maro-ai-messages {
  min-height: 0;
  padding: 16px;
  overflow-y: auto;
  background: var(--maro-ai-bg);
}

.maro-ai-message {
  display: flex;
  margin-bottom: 12px;
}

.maro-ai-message--user {
  justify-content: flex-start;
}

.maro-ai-message--assistant {
  justify-content: flex-end;
}

.maro-ai-message__bubble {
  max-width: 86%;
  padding: 11px 13px;
  border-radius: 16px;
  background: var(--maro-ai-soft);
  color: var(--maro-ai-text);
  line-height: 1.8;
  white-space: pre-wrap;
}

.maro-ai-message--user .maro-ai-message__bubble {
  background: var(--maro-ai-primary);
  color: #fff;
  border-bottom-left-radius: 5px;
}

.maro-ai-message--assistant .maro-ai-message__bubble {
  border-bottom-right-radius: 5px;
}

.maro-ai-products {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.maro-ai-product-card {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--maro-ai-line);
  border-radius: 8px;
  background: var(--maro-ai-panel);
}

.maro-ai-product-card img {
  width: 74px;
  height: 74px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.maro-ai-product-card h3 {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 850;
  line-height: 1.45;
}

.maro-ai-product-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--maro-ai-muted);
  font-size: 0.78rem;
}

.maro-ai-product-price {
  margin-top: 6px;
  font-weight: 900;
}

.maro-ai-product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.maro-ai-product-actions a,
.maro-ai-product-actions button {
  border: 1px solid var(--maro-ai-line);
  border-radius: 8px;
  padding: 7px 9px;
  background: var(--maro-ai-soft);
  color: var(--maro-ai-text);
  font-size: 0.8rem;
  text-decoration: none;
}

.maro-ai-product-actions button {
  background: var(--maro-ai-primary);
  border-color: var(--maro-ai-primary);
  color: #fff;
}

.maro-ai-product-actions button:disabled {
  background: var(--maro-ai-line);
  border-color: var(--maro-ai-line);
  color: var(--maro-ai-muted);
  cursor: not-allowed;
}

.maro-ai-typing {
  padding: 0 18px 10px;
  background: var(--maro-ai-bg);
}

.maro-ai-typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-inline-end: 4px;
  border-radius: 50%;
  background: var(--maro-ai-primary);
  animation: maroAiTyping 1s infinite ease-in-out;
}

.maro-ai-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.maro-ai-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes maroAiTyping {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.maro-ai-composer {
  display: flex;
  gap: 8px;
  padding: 14px;
  background: var(--maro-ai-panel);
  border-top: 1px solid var(--maro-ai-line);
}

.maro-ai-composer input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--maro-ai-line);
  border-radius: 999px;
  padding: 11px 14px;
  background: var(--maro-ai-bg);
  color: var(--maro-ai-text);
}

.maro-ai-composer button {
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  background: var(--maro-ai-primary);
  color: #fff;
  font-weight: 800;
}

@media (max-width: 575.98px) {
  .maro-ai-launcher {
    inset-inline: 14px;
    justify-content: center;
    bottom: 14px;
  }

  .maro-ai-panel {
    width: 100vw;
  }

  .maro-ai-product-card {
    grid-template-columns: 68px 1fr;
  }

  .maro-ai-product-card img {
    width: 68px;
    height: 68px;
  }
}
