:root { --bp-chatbot-vh: 1vh; --bp-chatbot-vv-offset-top: 0px; }
.bp-chatbot-widget * { box-sizing: border-box; }
.bp-chatbot-widget, .bp-chatbot-widget input, .bp-chatbot-widget button { font-family: inherit; }
.bp-chatbot-launcher-hidden .bp-chatbot-toggle { display: none !important; }
.bp-chatbot-toggle {
  position: fixed;
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: var(--bp-chatbot-primary, #c4a962);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  cursor: pointer;
  z-index: 1010;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
}
.bp-chatbot-toggle:hover { transform: scale(1.06); box-shadow: 0 10px 30px rgba(0,0,0,.22); }
.bp-chatbot-toggle img, .bp-chatbot-launcher-image { width: 38px; height: 38px; display: block; object-fit: contain; border-radius: 50%; }
.bp-chatbot-launcher-text { display: flex; align-items: center; justify-content: center; width: 46px; height: 46px; line-height: 1; font-size: 29px; font-weight: 800; color: #fff; user-select: none; }
.bp-chatbot-position-bottom-right .bp-chatbot-toggle { right: 22px; bottom: 22px; }
.bp-chatbot-position-bottom-left .bp-chatbot-toggle { left: 22px; bottom: 22px; }
.bp-chatbot-position-top-right .bp-chatbot-toggle { right: 22px; top: 22px; }
.bp-chatbot-position-top-left .bp-chatbot-toggle { left: 22px; top: 22px; }

.bp-chatbot-window {
  position: fixed;
  display: none;
  flex-direction: column;
  width: min(410px, calc(100vw - 24px));
  height: min(555px, calc(100vh - 24px));
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 22px 70px rgba(15, 23, 42, .28);
  overflow: hidden;
  z-index: 10030;
  color: var(--bp-chatbot-text, #1f2933);
}
.bp-chatbot-window.open { display: flex; }
.bp-chatbot-position-bottom-right .bp-chatbot-window { right: 22px; bottom: 25px; }
.bp-chatbot-position-bottom-left .bp-chatbot-window { left: 22px; bottom: 25px; }
.bp-chatbot-position-top-right .bp-chatbot-window { right: 22px; top: 25px; }
.bp-chatbot-position-top-left .bp-chatbot-window { left: 22px; top: 25px; }

.bp-chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border-bottom: 1px solid #edf0f2;
  flex: 0 0 auto;
}
.bp-chatbot-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bp-chatbot-brand img { width: 42px; height: 42px; border-radius: 50%; }
.bp-chatbot-brand h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--bp-chatbot-text, #1f2933); }
.bp-chatbot-brand span { font-size: 12px; color: #6b7280; }
.bp-chatbot-actions { display: flex; align-items: center; gap: 7px; }
.bp-chatbot-actions button {
  border: 0;
  background: #f3f4f6;
  color: #374151;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}
#bp-chatbot-close { width: 34px; height: 34px; padding: 0; font-size: 22px; line-height: 1; }

.bp-chatbot-messages {
  flex: 1 1 auto;
  background: var(--bp-chatbot-bg, #fffdf8);
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bp-chatbot-message { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.bp-chatbot-message-user { justify-content: flex-start; }
.bp-chatbot-message-bot { justify-content: flex-start; }
.bp-chatbot-message-user .bp-chatbot-avatar { display: none; }
.bp-chatbot-avatar { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; overflow: hidden; background: #fff; }
.bp-chatbot-avatar img { width: 100%; height: 100%; display: block; }
.bp-chatbot-bubble {
  padding: 11px 13px;
  border-radius: 16px;
  max-width: 82%;
  font-size: 14px;
  line-height: 1.8;
  white-space: normal;
  word-break: break-word;
  box-shadow: 0 1px 4px rgba(15,23,42,.06);
}
.bp-chatbot-message-bot .bp-chatbot-bubble { background: var(--bp-chatbot-bot, #f5e6d3); border-bottom-right-radius: 6px; }
.bp-chatbot-message-user .bp-chatbot-bubble { background: var(--bp-chatbot-user, #e9ecef); margin-right: auto; border-bottom-left-radius: 6px; }
.bp-chatbot-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.bp-chatbot-choice {
  width: 100%;
  text-align: right;
  border: 1px solid rgba(196,169,98,.45);
  background: #fff;
  color: var(--bp-chatbot-text, #1f2933);
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.bp-chatbot-choice:hover { border-color: var(--bp-chatbot-primary, #c4a962); background: #fffaf0; transform: translateY(-1px); }
.bp-chatbot-order-card {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: right;
}
.bp-chatbot-order-card strong { display: block; margin-bottom: 4px; }
.bp-chatbot-order-card span { display: block; color: #6b7280; font-size: 12px; }
.bp-chatbot-feedback { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.bp-chatbot-feedback button {
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px #e5e7eb;
}
.bp-chatbot-feedback button:hover { box-shadow: inset 0 0 0 1px var(--bp-chatbot-primary, #c4a962); }
.bp-chatbot-loading .bp-chatbot-bubble { color: #6b7280; }
.bp-chatbot-footer {
  flex: 0 0 auto;
  display: none;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border-top: 1px solid #edf0f2;
}
.bp-chatbot-footer.bp-chatbot-footer-active { display: flex; }
.bp-chatbot-footer input {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 11px 12px;
  min-width: 0;
  outline: none;
  direction: rtl;
}
.bp-chatbot-footer input:focus { border-color: var(--bp-chatbot-primary, #c4a962); }
.bp-chatbot-footer button {
  border: 0;
  border-radius: 14px;
  padding: 0 16px;
  color: #fff;
  background: var(--bp-chatbot-primary, #c4a962);
  cursor: pointer;
  font-weight: 700;
}
.bp-chatbot-footer button:disabled { opacity: .6; cursor: not-allowed; }
.bp-chatbot-small { font-size: 12px; color: #6b7280; display: block; margin-top: 6px; }

@media (max-width: 640px) {
  html.bp-chatbot-mobile-open,
  body.bp-chatbot-mobile-open {
    overflow: hidden !important;
  }
  .bp-chatbot-window {
    width: 100vw;
    width: 100dvw;
    height: calc(var(--bp-chatbot-vh, 1vh) * 100);
    max-height: calc(var(--bp-chatbot-vh, 1vh) * 100);
    border-radius: 0;
    left: 0 !important;
    right: 0 !important;
    top: var(--bp-chatbot-vv-offset-top, 0px) !important;
    bottom: auto !important;
  }
  @supports (height: 100dvh) {
    .bp-chatbot-window {
      height: 100dvh;
      max-height: 100dvh;
    }
  }
  .bp-chatbot-header {
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }
  .bp-chatbot-messages {
    padding: 14px 14px 10px;
    -webkit-overflow-scrolling: touch;
  }
  .bp-chatbot-footer {
    gap: 6px;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .bp-chatbot-footer input {
    font-size: 16px;
    min-height: 44px;
    padding: 10px 11px;
  }
  .bp-chatbot-footer button {
    min-height: 44px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .bp-chatbot-attach { width: 44px; min-width: 44px; }
  .bp-chatbot-file-note {
    bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }
  .bp-chatbot-toggle { width: 58px; height: 58px; }
  .bp-chatbot-position-bottom-right .bp-chatbot-toggle { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .bp-chatbot-position-bottom-left .bp-chatbot-toggle { left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .bp-chatbot-bubble { max-width: 88%; }
}

.bp-chatbot-ticket-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bp-chatbot-ticket-card strong { display: block; }
.bp-chatbot-ticket-card span { display: block; color: #6b7280; font-size: 12px; }
.bp-chatbot-ticket-thread { display: flex; flex-direction: column; gap: 8px; }
.bp-chatbot-ticket-messages { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.bp-chatbot-ticket-message {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
}
.bp-chatbot-ticket-message-admin { background: #fffaf0; border-color: rgba(196,169,98,.45); }
.bp-chatbot-ticket-message-customer { background: #f8fafc; }
.bp-chatbot-ticket-message-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #6b7280;
  font-size: 11px;
  margin-bottom: 4px;
}
.bp-chatbot-ticket-message-meta strong { color: #374151; }
.bp-chatbot-ticket-message-body { line-height: 1.8; }
.bp-chatbot-ticket-empty { color: #6b7280; font-size: 12px; }

.bp-chatbot-attach {
  width: 42px;
  min-width: 42px;
  padding: 0 !important;
  background: #f3f4f6 !important;
  color: #374151 !important;
  border: 1px solid #e5e7eb !important;
  font-size: 18px;
}
.bp-chatbot-file-note {
  position: absolute;
  right: 14px;
  bottom: 54px;
  max-width: calc(100% - 28px);
  padding: 4px 8px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-size: 11px;
  line-height: 1.5;
  opacity: .92;
  pointer-events: none;
}
.bp-chatbot-footer { position: relative; }
.bp-chatbot-ticket-attachments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.bp-chatbot-ticket-attachment {
  display: block;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #374151;
  text-decoration: none !important;
}
.bp-chatbot-ticket-attachment img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
  background: #f3f4f6;
}
.bp-chatbot-ticket-attachment span {
  display: block;
  padding: 5px 7px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11px;
}

.bp-chatbot-ticket-card .bp-chatbot-small,
.bp-chatbot-ticket-thread .bp-chatbot-small {
  display: block;
}
.bp-chatbot-choice[data-bp-ticket-option] {
  text-align: right;
  white-space: normal;
}

.bp-chatbot-order-card-summary em {
  display: block;
  margin-top: 6px;
  color: var(--bp-chatbot-primary, #c4a962);
  font-style: normal;
  font-size: 11px;
}
.bp-chatbot-order-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
}
.bp-chatbot-order-details strong { display: block; margin-bottom: 3px; }
.bp-chatbot-order-details span { display: block; color: #6b7280; font-size: 12px; }
.bp-chatbot-order-products {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.bp-chatbot-order-product {
  padding: 7px 8px;
  border-radius: 10px;
  background: #f8fafc;
}
.bp-chatbot-order-product span { color: var(--bp-chatbot-text, #1f2933); }
.bp-chatbot-order-product small { display: block; margin-top: 2px; color: #6b7280; font-size: 11px; }
