/* ── CHATBOT — Tapup Studio ── */

/* Floating trigger button */
.cb-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #22C55E;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(34,197,94,0.35), 0 2px 8px rgba(0,0,0,0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.cb-trigger:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(34,197,94,0.45), 0 2px 10px rgba(0,0,0,0.14);
}

.cb-trigger:active { transform: scale(0.96); }

.cb-trigger svg {
  width: 24px;
  height: 24px;
  color: #fff;
  transition: opacity 0.15s, transform 0.2s;
  position: absolute;
}

.cb-trigger .cb-icon-chat  { opacity: 1;  transform: scale(1) rotate(0deg); }
.cb-trigger .cb-icon-close { opacity: 0;  transform: scale(0.6) rotate(45deg); }

.cb-trigger.open .cb-icon-chat  { opacity: 0;  transform: scale(0.6) rotate(-45deg); }
.cb-trigger.open .cb-icon-close { opacity: 1;  transform: scale(1) rotate(0deg); }

/* Unread dot */
.cb-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #EF4444;
  border: 2px solid #fff;
  transition: opacity 0.2s;
}

.cb-dot.hidden { opacity: 0; pointer-events: none; }

/* Chat window */
.cb-window {
  position: fixed;
  bottom: 96px;
  right: 28px;
  z-index: 8999;
  width: 360px;
  max-height: 520px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #E2E8F0;
  box-shadow: 0 8px 40px rgba(15,23,42,0.12), 0 2px 10px rgba(15,23,42,0.06);
  overflow: hidden;
  /* closed state */
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  transform-origin: bottom right;
}

.cb-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.cb-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: #0F172A;
  flex-shrink: 0;
}

.cb-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #22C55E;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cb-avatar svg { width: 16px; height: 16px; color: #fff; }

.cb-header-info { flex: 1; }

.cb-header-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.cb-header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #94A3B8;
  margin-top: 1px;
}

.cb-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22C55E;
  flex-shrink: 0;
}

/* Messages area */
.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  background: #F8FAFC;
}

.cb-messages::-webkit-scrollbar { width: 4px; }
.cb-messages::-webkit-scrollbar-track { background: transparent; }
.cb-messages::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }

/* Message bubbles */
.cb-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  animation: cb-msg-in 0.22s ease;
}

@keyframes cb-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cb-msg.bot  { justify-content: flex-start; }
.cb-msg.user { justify-content: flex-end; }

.cb-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.cb-msg.bot  .cb-bubble {
  background: #fff;
  color: #0F172A;
  border: 1px solid #E2E8F0;
  border-bottom-left-radius: 4px;
}

.cb-msg.user .cb-bubble {
  background: #22C55E;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.cb-bubble-error {
  background: #FEF2F2 !important;
  border-color: #FECACA !important;
  color: #DC2626 !important;
}

/* Typing indicator */
.cb-typing .cb-bubble {
  padding: 12px 16px;
}

.cb-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.cb-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94A3B8;
  animation: cb-bounce 1.2s infinite ease-in-out;
}

.cb-dots span:nth-child(2) { animation-delay: 0.18s; }
.cb-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes cb-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-5px); }
}

/* Quick replies */
.cb-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
  background: #F8FAFC;
}

.cb-quick-btn {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #0F172A;
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 20px;
  padding: 6px 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  white-space: nowrap;
}

.cb-quick-btn:hover {
  border-color: #22C55E;
  color: #22C55E;
}

/* Input row */
.cb-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #E2E8F0;
  background: #fff;
  flex-shrink: 0;
}

.cb-input {
  flex: 1;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13.5px;
  color: #0F172A;
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  padding: 9px 13px;
  outline: none;
  resize: none;
  transition: border-color 0.15s;
  min-height: 38px;
  max-height: 90px;
  line-height: 1.45;
}

.cb-input::placeholder { color: #94A3B8; }
.cb-input:focus { border-color: #22C55E; }

.cb-send {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #22C55E;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
  outline: none;
}

.cb-send:hover  { opacity: 0.88; }
.cb-send:active { transform: scale(0.93); }
.cb-send svg    { width: 16px; height: 16px; color: #fff; }

/* ── Inquiry form bubble ── */
.cb-bubble-form {
  background: #fff !important;
  border: 1px solid #E2E8F0 !important;
  padding: 18px 16px !important;
  max-width: 96% !important;
  width: 100%;
}

.cb-form-title {
  font-size: 13px;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 12px;
}

.cb-inquiry-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cb-field {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: #0F172A;
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  padding: 9px 12px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
}

.cb-field::placeholder { color: #94A3B8; }
.cb-field:focus        { border-color: #22C55E; }

.cb-field-ta {
  resize: none;
  line-height: 1.45;
  min-height: 72px;
}

.cb-form-submit {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #22C55E;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  margin-top: 4px;
  transition: opacity 0.15s;
}

.cb-form-submit:hover    { opacity: 0.88; }
.cb-form-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.cb-form-note {
  font-size: 11px;
  color: #94A3B8;
  text-align: center;
  margin-top: 2px;
}

.cb-field-error {
  font-size: 12px;
  color: #DC2626;
  margin-top: 2px;
}

/* Success state */
.cb-form-success {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 4px 0;
}

.cb-form-success svg {
  width: 20px;
  height: 20px;
  color: #22C55E;
  flex-shrink: 0;
  margin-top: 2px;
}

.cb-form-success p {
  font-size: 13px;
  color: #0F172A;
  line-height: 1.5;
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .cb-window {
    width: calc(100vw - 16px);
    left: 8px;
    right: 8px;
    bottom: 84px;
    max-height: 75vh;
  }

  .cb-trigger {
    bottom: 16px;
    right: 16px;
  }

  .cb-bubble { max-width: 88%; }
}
