/* ── Chat Widget ────────────────────────────────── */
.ccw-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #2AA198;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.ccw-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.ccw-chat-bubble svg {
  width: 26px;
  height: 26px;
}

/* ── Chat Window ───────────────────────────────── */
.ccw-chat-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  z-index: 1001;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
}

.ccw-chat-window.open {
  display: flex;
}

/* Header */
.ccw-chat-header {
  background: #0F3D52;
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ccw-chat-header-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.ccw-chat-status {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 2px;
}

.ccw-chat-status.live {
  opacity: 1;
  color: #4ADE80;
}

.ccw-chat-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 1.3rem;
  padding: 4px;
  line-height: 1;
}

.ccw-chat-close:hover {
  color: #fff;
}

/* Messages */
.ccw-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ccw-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.ccw-msg-ai {
  background: #E6F2F7;
  color: #1A2F3A;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.ccw-msg-user {
  background: #2AA198;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.ccw-msg-mark {
  background: #E8F5E9;
  color: #1A2F3A;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.ccw-msg-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  opacity: 0.6;
}

.ccw-typing {
  align-self: flex-start;
  padding: 10px 14px;
  background: #E6F2F7;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  font-size: 0.85rem;
  color: #5A6B73;
}

.ccw-typing::after {
  content: '';
  animation: ccw-dots 1.4s infinite;
}

@keyframes ccw-dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Input area */
.ccw-chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid #DDE4E7;
  flex-shrink: 0;
}

.ccw-chat-escalate-link {
  display: block;
  text-align: center;
  font-size: 0.78rem;
  color: #5A6B73;
  margin-bottom: 8px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
}

.ccw-chat-escalate-link:hover {
  color: #1B5E7B;
}

.ccw-chat-input-row {
  display: flex;
  gap: 8px;
}

.ccw-chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #DDE4E7;
  border-radius: 24px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.ccw-chat-input:focus {
  border-color: #2AA198;
}

.ccw-chat-input:disabled {
  background: #F7FAFB;
  color: #999;
}

.ccw-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2AA198;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}

.ccw-chat-send:hover {
  background: #238F87;
}

.ccw-chat-send:disabled {
  background: #DDE4E7;
  cursor: default;
}

.ccw-chat-send svg {
  width: 18px;
  height: 18px;
}

/* Escalation form */
.ccw-escalate-form {
  padding: 16px;
  border-top: 1px solid #DDE4E7;
  flex-shrink: 0;
}

.ccw-escalate-form p {
  font-size: 0.85rem;
  color: #4A5E6A;
  margin-bottom: 12px;
}

.ccw-escalate-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #DDE4E7;
  border-radius: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  margin-bottom: 8px;
  outline: none;
}

.ccw-escalate-form input:focus {
  border-color: #2AA198;
}

.ccw-escalate-btn {
  width: 100%;
  padding: 10px;
  background: #3D8B37;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
}

.ccw-escalate-btn:hover {
  background: #2D6B29;
}

.ccw-escalate-cancel {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: #5A6B73;
  cursor: pointer;
  background: none;
  border: none;
}

/* Calendly button */
.ccw-calendly-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 16px;
  background: #1B5E7B;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.ccw-calendly-btn:hover {
  background: #0F3D52;
}

.ccw-callback-anytime-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 8px 16px;
  background: transparent;
  color: #1B5E7B;
  border: 1.5px solid #1B5E7B;
  border-radius: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.ccw-callback-anytime-btn:hover {
  background: #1B5E7B;
  color: #fff;
}

/* New chat button */
.ccw-new-chat-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 12px 16px;
  padding: 10px;
  background: #2AA198;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.ccw-new-chat-btn:hover {
  background: #238F87;
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 480px) {
  .ccw-chat-window {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .ccw-chat-bubble {
    bottom: 16px;
    right: 16px;
  }
}
