.chatbot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.chatbot-toggle {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f5c4c0 0%, #d4a5a5 100%);
  color: #fff;
  border: 2px solid #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(168, 100, 100, 0.32), 0 2px 6px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: chatbot-pulse 2.8s ease-in-out infinite;
}

.chatbot-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ff3b30;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 10px;
  border: 2px solid #fff;
  letter-spacing: 0.4px;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(255, 59, 48, 0.35);
  animation: chatbot-badge-pop 0.3s ease-out;
}

@keyframes chatbot-badge-pop {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.chatbot-toggle.chatbot-has-new {
  animation: chatbot-shake 0.7s ease-in-out 2;
}

@keyframes chatbot-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(6deg); }
  60% { transform: rotate(-4deg); }
  80% { transform: rotate(2deg); }
}

.chatbot-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(168, 100, 100, 0.4), 0 3px 8px rgba(0, 0, 0, 0.14);
}

@keyframes chatbot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.chatbot-panel {
  width: 360px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.14);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #f5c4c0 0%, #d4a5a5 100%);
  color: #fff;
  flex-shrink: 0;
}

.chatbot-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fff;
  color: #c98a8a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

.chatbot-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.chatbot-status {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
}

.chatbot-close {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-close:hover {
  opacity: 1;
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff8f6;
}

.chatbot-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.chatbot-msg.bot {
  align-self: flex-start;
  background: #fff;
  color: #222;
  border: 1px solid #f0d8d4;
  border-bottom-left-radius: 4px;
}

.chatbot-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #e8b8b5 0%, #d4a5a5 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chatbot-msg.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 16px;
  width: fit-content;
}

.chatbot-msg.typing-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #999;
  animation: chatbot-typing-blink 1.4s infinite ease-in-out;
}

.chatbot-msg.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.chatbot-msg.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes chatbot-typing-blink {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.chatbot-quickreplies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 4px;
  flex-shrink: 0;
}

.chatbot-quickreplies:empty {
  display: none;
}


.chatbot-qr {
  background: #fff;
  border: 1px solid #ddd;
  color: #222;
  padding: 7px 13px;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.chatbot-qr:hover {
  background: #f5f5f5;
  border-color: #1a1a1a;
}

.chatbot-progress {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid #f0d8d4;
  flex-shrink: 0;
}
.chatbot-progress.is-visible { display: flex; }
.chatbot-progress-bar {
  flex: 1;
  height: 4px;
  background: #f5e2dd;
  border-radius: 999px;
  overflow: hidden;
}
.chatbot-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #e8b8b5, #d4a5a5);
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.chatbot-progress-text {
  font-size: 11px;
  color: #a47373;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.chatbot-summary-row-btn {
  appearance: none;
  background: #fff;
  border: 1px solid #f0d8d4;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.chatbot-summary-row-btn:last-child { margin-bottom: 0; }
.chatbot-summary-row-btn:hover {
  background: #fff5f3;
  border-color: #d4a5a5;
}
.chatbot-summary-row-btn .chatbot-summary-label { color: #888; min-width: 76px; flex-shrink: 0; }
.chatbot-summary-row-btn .chatbot-summary-value {
  flex: 1;
  color: #222;
  text-align: right;
  font-weight: 500;
  word-break: break-all;
}
.chatbot-summary-edit {
  font-size: 11px;
  color: #c98a8a;
  font-weight: 600;
  padding: 3px 8px;
  border: 1px solid #f0d8d4;
  border-radius: 999px;
  flex-shrink: 0;
}
.chatbot-summary-row-btn:hover .chatbot-summary-edit {
  background: #d4a5a5;
  color: #fff;
  border-color: #d4a5a5;
}
.chatbot-summary-help { font-size: 13px; }
.chatbot-summary-list { display: flex; flex-direction: column; }

.chatbot-privacy {
  margin: 8px 0 12px;
  padding: 10px 12px;
  background: #fff5f3;
  border: 1px solid #f0d8d4;
  border-radius: 10px;
  font-size: 12.5px;
  position: relative;
}
.chatbot-privacy-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin: 0;
  color: #1a1a1a;
}
.chatbot-privacy-check {
  width: 16px;
  height: 16px;
  accent-color: #d4a5a5;
  cursor: pointer;
  flex-shrink: 0;
}
.chatbot-privacy-text { flex: 1; line-height: 1.4; }
.chatbot-privacy-req { color: #d4a5a5; font-weight: 600; font-size: 11px; }
.chatbot-privacy-more {
  position: absolute;
  top: 10px;
  right: 12px;
  background: transparent;
  border: none;
  color: #c98a8a;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 4px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chatbot-privacy-detail {
  margin-top: 8px;
  padding: 10px 10px;
  background: #fff;
  border: 1px solid #f0d8d4;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.65;
  color: #707070;
}
.chatbot-privacy-detail p { margin: 0 0 4px; }
.chatbot-privacy-detail p:last-child { margin-bottom: 0; }
.chatbot-privacy-detail strong { color: #1a1a1a; font-weight: 600; margin-right: 4px; }

.chatbot-action-card {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 14px;
  padding: 14px;
  max-width: 90%;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chatbot-action-text {
  font-size: 14px;
  line-height: 1.5;
  color: #222;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.chatbot-action-buttons {
  display: flex;
  gap: 6px;
}

.chatbot-action-btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #ddd;
  background: #fff;
  color: #222;
  transition: all 0.15s ease;
  font-family: inherit;
}

.chatbot-action-btn:hover {
  border-color: #1a1a1a;
  background: #f5f5f5;
}

.chatbot-action-btn.primary {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

.chatbot-action-btn.primary:hover {
  background: #2a2a2a;
}

.chatbot-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.chatbot-action-btn.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0.85;
}
.chatbot-btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: chatbot-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes chatbot-spin {
  to { transform: rotate(360deg); }
}

.chatbot-invite-btn {
  width: 100%;
  margin-top: 10px;
}

.chatbot-invite-card .chatbot-action-text {
  margin-bottom: 4px;
}

.chatbot-flow-options {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin: 4px 0 2px;
}

.chatbot-flow-opt {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1.5px solid #f0d8d4;
  color: #1a1a1a;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  font-family: inherit;
  box-shadow: 0 1px 0 rgba(168, 100, 100, 0.04);
}
.chatbot-flow-opt::after {
  content: '›';
  color: #c98a8a;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  opacity: 0.7;
  transition: transform 0.18s ease;
}
.chatbot-flow-opt:hover:not(:disabled) {
  background: #fff5f3;
  border-color: #d4a5a5;
  box-shadow: 0 6px 16px rgba(168, 100, 100, 0.1);
}
.chatbot-flow-opt:hover:not(:disabled)::after { transform: translateX(3px); opacity: 1; }
.chatbot-flow-opt.selected {
  background: linear-gradient(135deg, #e8b8b5 0%, #d4a5a5 100%);
  color: #fff;
  border-color: #d4a5a5;
}
.chatbot-flow-opt.selected::after { color: #fff; opacity: 1; }
.chatbot-flow-opt:disabled { opacity: 0.55; cursor: not-allowed; }

.chatbot-flow-multi .chatbot-flow-opt::after { content: '+'; font-weight: 300; font-size: 22px; }
.chatbot-flow-multi .chatbot-flow-opt.selected::after { content: '✓'; font-size: 15px; }

.chatbot-flow-confirm {
  width: 100%;
  background: linear-gradient(135deg, #e8b8b5 0%, #d4a5a5 100%);
  color: #fff;
  border: none;
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
  box-shadow: 0 6px 16px rgba(168, 100, 100, 0.22);
  margin-top: 4px;
}
.chatbot-flow-confirm:hover:not(:disabled) {
  filter: brightness(1.04);
  box-shadow: 0 8px 20px rgba(168, 100, 100, 0.3);
}
.chatbot-flow-confirm:disabled {
  background: #d8d8d8;
  box-shadow: none;
  cursor: not-allowed;
}

.chatbot-flow-date {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 90%;
}

.chatbot-flow-date-row {
  display: flex;
  gap: 6px;
  width: 100%;
}

.chatbot-flow-date-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 18px;
  padding: 9px 14px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  background: #fff;
  color: #222;
}

.chatbot-flow-date-input:focus {
  border-color: #1a1a1a;
}

.chatbot-flow-date-input:disabled {
  opacity: 0.6;
}

.chatbot-summary-card {
  background: #fafafa;
}

.chatbot-summary-header {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 10px;
}

.chatbot-summary-list {
  margin-bottom: 12px;
}

.chatbot-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed #e5e5e5;
  font-size: 13px;
}

.chatbot-summary-row:last-child {
  border-bottom: none;
}

.chatbot-summary-label {
  color: #888;
  flex-shrink: 0;
}

.chatbot-summary-value {
  color: #222;
  text-align: right;
  word-break: break-all;
}

.chatbot-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #ececec;
  flex-shrink: 0;
  background: #fff;
}

.chatbot-cta {
  flex-shrink: 0;
  border-top: 1px solid #ececec;
  background: #fafafa;
}

.chatbot-cta-btn {
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  color: #1a1a1a;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease;
  font-family: inherit;
}

.chatbot-cta-btn:hover {
  background: #f0f0f0;
}

.chatbot-cta-btn svg:last-child {
  opacity: 0.6;
  transition: transform 0.15s ease;
}

.chatbot-cta-btn:hover svg:last-child {
  transform: translateX(2px);
  opacity: 1;
}

.chatbot-input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
  font-family: inherit;
}

.chatbot-input:focus {
  border-color: #1a1a1a;
}

.chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1a1a1a;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.chatbot-send:hover {
  background: #333;
}

.chatbot-send:disabled {
  background: #ccc;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .chatbot {
    bottom: 104px;
  }
}

@media (max-width: 480px) {
  .chatbot {
    right: 12px;
  }
  .chatbot-panel {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    border-radius: 12px;
    z-index: 10000;
  }
}
