/* WooChat AI — matches original React chat UI */

.woochat-ai-root {
  --woochat-ai-pink: #ec4899;
  --woochat-ai-pink-hover: #db2777;
  --woochat-ai-pink-light: #fdf2f8;
  --woochat-ai-bg: #fff5f7;
  --woochat-ai-bot-bottom: 5rem;
  --woochat-ai-bot-side: 1rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, sans-serif;
}

.woochat-ai-hidden {
  display: none !important;
}

/* Launcher */
.woochat-ai-launcher-img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 50%;
}

.woochat-ai-launcher {
  position: fixed;
  bottom: var(--woochat-ai-bot-bottom);
  z-index: 99998;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  border: none;
  background: var(--woochat-ai-pink);
  color: #fff;
  box-shadow: 0 10px 25px rgba(236, 72, 153, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
}

.woochat-ai-side-right .woochat-ai-launcher {
  right: var(--woochat-ai-bot-side);
}

.woochat-ai-side-left .woochat-ai-launcher {
  left: var(--woochat-ai-bot-side);
}

.woochat-ai-launcher:hover {
  background: var(--woochat-ai-pink-hover);
  transform: scale(1.05);
}

.woochat-ai-root.woochat-ai-open .woochat-ai-launcher {
  display: none;
}

@media (min-width: 768px) {
  .woochat-ai-launcher {
    bottom: 1.5rem;
  }

  .woochat-ai-side-right .woochat-ai-launcher {
    right: var(--woochat-ai-bot-side);
  }

  .woochat-ai-side-left .woochat-ai-launcher {
    left: var(--woochat-ai-bot-side);
  }
}

/* Panel overlay */
.woochat-ai-panel {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

@media (min-width: 768px) {
  .woochat-ai-panel {
    align-items: center;
  }
}

.woochat-ai-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

/* Compact chatbot mode */
.woochat-ai-mode-chatbot .woochat-ai-panel {
  inset: auto;
  bottom: calc(var(--woochat-ai-bot-bottom) + 4.25rem);
  width: min(420px, calc(100vw - 2rem));
  height: min(680px, calc(100vh - 7rem));
  align-items: stretch;
  justify-content: stretch;
}

.woochat-ai-mode-chatbot.woochat-ai-side-right .woochat-ai-panel {
  right: var(--woochat-ai-bot-side);
}

.woochat-ai-mode-chatbot.woochat-ai-side-left .woochat-ai-panel {
  left: var(--woochat-ai-bot-side);
}

.woochat-ai-mode-chatbot .woochat-ai-backdrop {
  display: none;
}

.woochat-ai-mode-chatbot .woochat-ai-modal {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border-radius: 1rem;
  animation: woochat-ai-pop-in 0.22s ease;
}

.woochat-ai-mode-chatbot.woochat-ai-open .woochat-ai-launcher {
  display: flex;
}

@keyframes woochat-ai-pop-in {
  from {
    transform: translateY(12px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@media (min-width: 768px) {
  .woochat-ai-mode-chatbot .woochat-ai-panel {
    bottom: 6rem;
  }
}

@media (max-width: 480px) {
  .woochat-ai-mode-chatbot .woochat-ai-panel {
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(var(--woochat-ai-bot-bottom) + 4.25rem);
    width: auto;
    height: min(640px, calc(100vh - 7rem));
  }
}

.woochat-ai-modal {
  position: relative;
  width: 100%;
  max-width: 28rem;
  height: 90vh;
  max-height: 700px;
  margin: 0 auto;
  background: #fff;
  border-radius: 0.75rem 0.75rem 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
  animation: woochat-ai-slide-up 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}

@media (min-width: 768px) {
  .woochat-ai-modal {
    border-radius: 0.75rem;
  }
}

@keyframes woochat-ai-slide-up {
  from {
    transform: translateY(100%);
    opacity: 0.8;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Header */
.woochat-ai-header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #f3f4f6;
  background: #fff;
}

.woochat-ai-header-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.woochat-ai-header-icon {
  color: var(--woochat-ai-pink);
  flex-shrink: 0;
}

.woochat-ai-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.woochat-ai-subtitle {
  margin: 0;
  font-size: 0.75rem;
  color: #6b7280;
}

.woochat-ai-header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.woochat-ai-btn-ghost {
  border: none;
  background: transparent;
  font-size: 0.75rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.woochat-ai-btn-ghost:hover {
  color: var(--woochat-ai-pink-hover);
}

.woochat-ai-btn-icon {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 4px;
  color: #374151;
  display: flex;
  align-items: center;
}

.woochat-ai-btn-icon:hover {
  background: #f3f4f6;
}

/* Messages */
.woochat-ai-messages {
  flex: 1;
  overflow-y: auto;
  background: var(--woochat-ai-bg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.woochat-ai-msg-row {
  display: flex;
}

.woochat-ai-msg-row.user {
  justify-content: flex-end;
}

.woochat-ai-msg-row.assistant {
  justify-content: flex-start;
}

.woochat-ai-msg-bubble {
  max-width: 75%;
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  word-break: break-word;
}

.woochat-ai-msg-bubble.user {
  background: var(--woochat-ai-pink);
  color: #fff;
}

.woochat-ai-msg-bubble.assistant {
  background: #fff;
  border: 1px solid #fce7f3;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  color: #1f2937;
}

/* Typing */
.woochat-ai-dot-typing {
  display: flex;
  align-items: center;
  height: 10px;
}

.woochat-ai-dot-typing .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 3px;
  background: #df3c76;
  animation: woochat-ai-dot 1.5s infinite linear both;
}

.woochat-ai-dot-typing .dot:nth-child(2) {
  animation-delay: 0.2s;
}

.woochat-ai-dot-typing .dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes woochat-ai-dot {
  0% {
    opacity: 0.2;
    transform: scale(0.7);
  }
  20% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0.2;
    transform: scale(0.7);
  }
}

/* Recommendations */
.woochat-ai-rec-loading {
  font-size: 0.8125rem;
  color: #9ca3af;
  padding: 0.5rem 0;
}

.woochat-ai-rec-block {
  margin: 0.5rem 0;
}

.woochat-ai-tool-card {
  max-width: 720px;
  margin: 0.5rem 0 0.75rem;
  padding: 0.875rem 1rem;
  border: 1px solid rgba(236, 72, 153, 0.22);
  border-radius: 1rem;
  background: #fff7fb;
  box-shadow: 0 10px 25px rgba(236, 72, 153, 0.08);
}

.woochat-ai-tool-card strong {
  display: inline-block;
  margin-right: 0.5rem;
  color: #831843;
  font-size: 0.875rem;
}

.woochat-ai-tool-card span {
  display: inline-flex;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: #fce7f3;
  color: #9d174d;
  font-size: 0.75rem;
  font-weight: 700;
}

.woochat-ai-tool-card p {
  margin: 0.5rem 0 0;
  color: #4b5563;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.woochat-ai-rec-title {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #be185d;
  margin-bottom: 0.5rem;
}

.woochat-ai-rec-card {
  background: #fff;
  border: 1px solid #fce7f3;
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.woochat-ai-rec-inner {
  display: flex;
  gap: 0.75rem;
}

.woochat-ai-rec-img {
  width: 5rem;
  height: 5rem;
  border-radius: 0.375rem;
  object-fit: cover;
  border: 1px solid #fce7f3;
  flex-shrink: 0;
}

.woochat-ai-rec-body {
  flex: 1;
  min-width: 0;
}

.woochat-ai-rec-name {
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0;
}

.woochat-ai-rec-reason {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0.25rem 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.woochat-ai-rec-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.woochat-ai-rec-price {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--woochat-ai-pink);
}

.woochat-ai-rec-actions {
  display: flex;
  gap: 0.25rem;
}

.woochat-ai-rec-btn {
  font-size: 0.75rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid #fbcfe8;
  background: #fff;
  color: #be185d;
}

.woochat-ai-rec-btn.primary {
  background: var(--woochat-ai-pink);
  color: #fff;
  border-color: var(--woochat-ai-pink);
}

.woochat-ai-rec-btn.primary:hover {
  background: var(--woochat-ai-pink-hover);
}

/* Footer */
.woochat-ai-footer {
  flex-shrink: 0;
  border-top: 1px solid #f3f4f6;
  background: #fff;
  padding: 1rem;
}

.woochat-ai-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.woochat-ai-input {
  flex: 1;
  border: 1px solid #fce7f3;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
}

.woochat-ai-input:focus {
  outline: 2px solid var(--woochat-ai-pink);
  outline-offset: 0;
  border-color: var(--woochat-ai-pink);
}

.woochat-ai-send {
  background: var(--woochat-ai-pink);
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.woochat-ai-send:hover:not(:disabled) {
  background: var(--woochat-ai-pink-hover);
}

.woochat-ai-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.woochat-ai-footer-hint {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  text-align: center;
  color: #6b7280;
}

/* Toast */
.woochat-ai-toast {
  position: fixed;
  bottom: 6rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100000;
  background: #1f2937;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  max-width: 90%;
  text-align: center;
}

.woochat-ai-toast.err {
  background: #dc2626;
}
