/* ─── Bitubi Chatbot Widget ─────────────────────────────────────────────────── */

#bitubi-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7ab800, #C4FF4D);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(196, 255, 77, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

#bitubi-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(196, 255, 77, 0.6);
}

#bitubi-chat-btn svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  transition: opacity 0.2s;
}

/* ─── Panel ─────────────────────────────────────────────────────────────────── */

#bitubi-chat-panel {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 680px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 12px 48px rgba(30, 42, 6, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.25s ease;
}

#bitubi-chat-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */

#bitubi-chat-header {
  background: linear-gradient(135deg, #2a3508 0%, #3a7d44 100%);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

#bitubi-chat-header .chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(195, 211, 57, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#bitubi-chat-header .chat-avatar svg {
  width: 22px;
  height: 22px;
  fill: #C4FF4D;
}

#bitubi-chat-header .chat-title {
  flex: 1;
}

#bitubi-chat-header .chat-title h3 {
  margin: 0;
  font-family: 'AT Surt', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

#bitubi-chat-header .chat-title p {
  margin: 2px 0 0;
  font-family: 'AT Surt', sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
}

#bitubi-chat-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

#bitubi-chat-close:hover {
  opacity: 1;
}

#bitubi-chat-close svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ─── Messages area ─────────────────────────────────────────────────────────── */

#bitubi-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f7f8f2;
  scroll-behavior: smooth;
}

#bitubi-chat-messages::-webkit-scrollbar {
  width: 4px;
}

#bitubi-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#bitubi-chat-messages::-webkit-scrollbar-thumb {
  background: #C4FF4D;
  border-radius: 4px;
}

/* ─── Bubble ────────────────────────────────────────────────────────────────── */

.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-family: 'AT Surt', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-bubble.bot {
  background: #fff;
  color: #2a3508;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  align-self: flex-start;
}

.chat-bubble.user {
  background: linear-gradient(135deg, #3a7d44, #4e9b57);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* ─── Typing indicator ──────────────────────────────────────────────────────── */

.chat-typing {
  background: #fff;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  align-self: flex-start;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  display: flex;
  gap: 5px;
  align-items: center;
}

.chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #C4FF4D;
  display: inline-block;
  animation: typingBounce 1.2s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ─── Product cards ─────────────────────────────────────────────────────────── */

.chat-products {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: stretch;
}

.chat-product-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border: 1.5px solid #e8ecda;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  cursor: pointer;
}

.chat-product-card:hover {
  border-color: #C4FF4D;
  box-shadow: 0 4px 14px rgba(196, 255, 77, 0.15);
  transform: translateY(-1px);
}

.chat-product-card.selected {
  border-color: #3a7d44;
  box-shadow: 0 4px 14px rgba(196, 255, 77, 0.25);
  background: #f4faf5;
}

.chat-product-card.selected .card-name {
  color: #3a7d44;
}

.chat-product-card img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f0f2e8;
}

.chat-product-card .card-img-placeholder {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  background: #f0f2e8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-product-card .card-img-placeholder svg {
  width: 28px;
  height: 28px;
  fill: #C4FF4D;
  opacity: 0.6;
}

.chat-product-card .card-info {
  flex: 1;
  padding: 10px 10px 10px 0;
  min-width: 0;
}

.chat-product-card .card-name {
  font-family: 'AT Surt', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #2a3508;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-product-card .card-desc {
  font-family: 'AT Surt', sans-serif;
  font-size: 11px;
  color: #666;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat-product-card .card-material {
  font-family: 'AT Surt', sans-serif;
  font-size: 10px;
  color: #999;
  margin: 2px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-product-card .card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.chat-product-card .card-price {
  font-family: 'AT Surt', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #3a7d44;
}

.chat-product-card .card-stock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'AT Surt', sans-serif;
  font-size: 10px;
  font-weight: 500;
  color: #666;
}

.chat-product-card .stock-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chat-product-card .card-stock.in_stock .stock-dot { background: #3a7d44; }
.chat-product-card .card-stock.low_stock .stock-dot { background: #e09d2a; }
.chat-product-card .card-stock.out_of_stock .stock-dot { background: #cc3333; }

.chat-product-card .card-badge {
  display: inline-block;
  font-family: 'AT Surt', sans-serif;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 20px;
  background: #f0f5d0;
  color: #3a7d44;
}

.chat-product-card .card-arrow {
  padding-right: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  text-decoration: none;
}

.chat-product-card .card-arrow svg {
  width: 16px;
  height: 16px;
  fill: #C4FF4D;
}

.chat-product-card .card-arrow:hover svg {
  fill: #3a7d44;
}

/* ─── Color list ────────────────────────────────────────────────────────────── */

.chat-color-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: stretch;
  margin-top: 2px;
}

.chat-color-row {
  background: #fff;
  border: 1.5px solid #e8ecda;
  border-radius: 10px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'AT Surt', sans-serif;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.chat-color-row:hover {
  border-color: #C4FF4D;
  background: #f9faf0;
}

.chat-color-row.selected {
  border-color: #3a7d44;
  background: #f4faf5;
}

.chat-color-row.selected .color-name {
  color: #3a7d44;
  font-weight: 600;
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(0,0,0,0.12);
}

.color-name {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: #2a3508;
  text-transform: capitalize;
}

.color-price {
  font-size: 12px;
  font-weight: 700;
  color: #3a7d44;
  white-space: nowrap;
}

.chat-color-row .color-stock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #666;
  white-space: nowrap;
}

.chat-color-row .stock-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chat-color-row .color-stock.in_stock .stock-dot { background: #3a7d44; }
.chat-color-row .color-stock.low_stock .stock-dot { background: #e09d2a; }
.chat-color-row .color-stock.out_of_stock .stock-dot { background: #cc3333; }

/* ─── Quote card ────────────────────────────────────────────────────────────── */

.chat-quote-card {
  background: #fff;
  border: 1.5px solid #C4FF4D;
  border-radius: 14px;
  overflow: hidden;
  align-self: stretch;
  box-shadow: 0 2px 10px rgba(196, 255, 77, 0.12);
}

.quote-header {
  background: linear-gradient(135deg, #2a3508, #3a7d44);
  color: #fff;
  font-family: 'AT Surt', sans-serif;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 16px;
  letter-spacing: 0.3px;
}

.quote-body {
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quote-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quote-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(0,0,0,0.12);
}

.quote-color-name {
  flex: 1;
  font-family: 'AT Surt', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #2a3508;
  text-transform: capitalize;
}

.quote-stock-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'AT Surt', sans-serif;
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.quote-stock-pill .stock-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.quote-stock-pill.in_stock { background: #eaf5ec; color: #3a7d44; }
.quote-stock-pill.in_stock .stock-dot { background: #3a7d44; }
.quote-stock-pill.low_stock { background: #fef9ec; color: #b07a10; }
.quote-stock-pill.low_stock .stock-dot { background: #e09d2a; }
.quote-stock-pill.out_of_stock { background: #fef0f0; color: #cc3333; }
.quote-stock-pill.out_of_stock .stock-dot { background: #cc3333; }

.quote-meta {
  display: flex;
  justify-content: space-between;
  font-family: 'AT Surt', sans-serif;
  font-size: 11px;
  color: #999;
}

.quote-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f4faf5;
  border-radius: 10px;
  padding: 10px 14px;
}

.quote-total-label {
  font-family: 'AT Surt', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #5a6a3a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quote-total-amount {
  font-family: 'AT Surt', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #3a7d44;
  line-height: 1;
}

/* ─── Confirm banner (post-quote) ───────────────────────────────────────────── */

.chat-confirm-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #eaf5ec, #f4faf5);
  border: 1.5px solid #a8d5b0;
  border-radius: 12px;
  padding: 12px 16px;
  align-self: flex-start;
  max-width: 90%;
}

.confirm-icon {
  width: 26px;
  height: 26px;
  background: #3a7d44;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.confirm-text {
  font-family: 'AT Surt', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #2a3508;
  line-height: 1.4;
}

/* ─── Suggestion chips ──────────────────────────────────────────────────────── */

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-self: flex-start;
  padding: 2px 0;
}

.chat-suggestion-btn {
  background: #fff;
  border: 1.5px solid #3a7d44;
  border-radius: 20px;
  color: #3a7d44;
  font-family: 'AT Surt', sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.chat-suggestion-btn:hover {
  background: #3a7d44;
  color: #fff;
}

/* ─── Input area ────────────────────────────────────────────────────────────── */

#bitubi-chat-footer {
  padding: 12px 14px;
  background: #fff;
  border-top: 1px solid #e8ecda;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
}

#bitubi-chat-input {
  flex: 1;
  border: 1.5px solid #dde4c4;
  border-radius: 10px;
  padding: 9px 12px;
  font-family: 'AT Surt', sans-serif;
  font-size: 13px;
  color: #2a3508;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  max-height: 80px;
  min-height: 38px;
  line-height: 1.4;
  background: #f7f8f2;
}

#bitubi-chat-input:focus {
  border-color: #3a7d44;
  background: #fff;
}

#bitubi-chat-input::placeholder {
  color: #aab87a;
}

#bitubi-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #7ab800, #C4FF4D);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.2s, transform 0.15s;
}

#bitubi-chat-send:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

#bitubi-chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

#bitubi-chat-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  #bitubi-chat-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 90px;
  }

  #bitubi-chat-btn {
    right: 16px;
    bottom: 20px;
  }
}

/* ─── Quote draft card (chatbot leaves a real draft in the system) ─────────── */

.chat-quote-draft-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(135deg, #f3edff, #faf7ff);
  border: 1.5px solid #d6c4f5;
  border-radius: 14px;
  padding: 14px 16px;
  align-self: flex-start;
  max-width: 92%;
  margin-top: 4px;
}

.quote-draft-icon {
  width: 28px;
  height: 28px;
  background: #8942FE;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.quote-draft-body {
  font-family: 'AT Surt', sans-serif;
  color: #2a1b4e;
  font-size: 13px;
  line-height: 1.45;
}

.quote-draft-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.quote-draft-meta {
  color: #4a3a7a;
  margin-bottom: 4px;
}

.quote-draft-msg {
  color: #6a5a8a;
}

/* ─── Escalation card (chatbot escala a comercial humano) ──────────────────── */

.chat-escalation-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #fff8e1, #fffbf0);
  border: 1.5px solid #f0d97a;
  border-radius: 14px;
  padding: 14px 16px;
  align-self: flex-start;
  max-width: 92%;
  margin-top: 4px;
}

.escalation-icon {
  width: 32px;
  height: 32px;
  background: #c49500;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.escalation-body {
  font-family: 'AT Surt', sans-serif;
  color: #5a3f00;
  font-size: 13px;
  line-height: 1.45;
}

.escalation-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.escalation-msg {
  color: #8a6e1a;
}
