/* ===== CHATBOT VARIABLES ===== */
:root {
  --chat-primary: #1239AB;
  --chat-primary-light: #1B76FF;
  --chat-accent: #FFBC3F;
  --chat-accent-light: #F2E73D;
  --chat-bg: #0a0a14;
  --chat-surface: #1a1a2e;
  --chat-surface-light: #25253d;
  --chat-text: #FFFAF5;
  --chat-text-muted: rgba(255, 250, 245, 0.6);
  --chat-border: rgba(255, 255, 255, 0.1);
  --chat-shadow: rgba(18, 57, 171, 0.4);
  --chat-radius: 20px;
}

/* ===== FLOATING BUTTON ===== */
.cq-chat-toggle {
  position: fixed;
  bottom: 96px;
  right: 32px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-light));
  border: none;
  cursor: pointer;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px var(--chat-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cq-chat-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px var(--chat-shadow);
}

.cq-chat-toggle svg {
  width: 30px;
  height: 30px;
  fill: white;
  transition: transform 0.3s ease;
}

.cq-chat-toggle.active svg {
  transform: rotate(90deg);
}

/* Notification badge */
.cq-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: var(--chat-accent);
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--chat-primary);
  animation: cqPulse 2s infinite;
}

.cq-chat-badge.show {
  display: flex;
}

/* ===== CHAT CONTAINER ===== */
.cq-chat-container {
  position: fixed;
  bottom: 170px;
  right: 32px;
  width: 380px;
  height: 520px;
  background: var(--chat-bg);
  border-radius: var(--chat-radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 10001;
  border: 1px solid var(--chat-border);
  animation: cqFadeIn 0.3s ease;
}

.cq-chat-container.open {
  display: flex;
}

/* ===== HEADER ===== */
.cq-chat-header {
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-light));
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.cq-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: white;
  padding: 3px;
  flex-shrink: 0;
}

.cq-chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.cq-chat-header-info {
  flex: 1;
}

.cq-chat-header-name {
  color: white;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
}

.cq-chat-header-status {
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cq-chat-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  display: inline-block;
}

.cq-chat-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.cq-chat-close:hover {
  opacity: 1;
}

/* ===== MESSAGES AREA ===== */
.cq-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.cq-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.cq-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.cq-chat-messages::-webkit-scrollbar-thumb {
  background: var(--chat-surface-light);
  border-radius: 2px;
}

/* Message bubbles */
.cq-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: cqMessageIn 0.3s ease;
  word-wrap: break-word;
}

.cq-msg a {
  color: var(--chat-accent);
  text-decoration: underline;
}

.cq-msg-bot {
  align-self: flex-start;
  background: var(--chat-surface);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
}

.cq-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-light));
  color: white;
  border-bottom-right-radius: 4px;
}

.cq-msg-bot strong {
  color: var(--chat-accent);
}

.cq-msg-bot em {
  color: var(--chat-text-muted);
}

.cq-msg-bot ul, .cq-msg-bot ol {
  margin: 6px 0;
  padding-left: 18px;
}

.cq-msg-bot li {
  margin-bottom: 3px;
}

/* Typing indicator */
.cq-typing {
  align-self: flex-start;
  background: var(--chat-surface);
  padding: 12px 18px;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.cq-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chat-text-muted);
  animation: cqTyping 1.4s infinite;
}

.cq-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.cq-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* ===== QUICK BUTTONS ===== */
.cq-quick-buttons {
  padding: 8px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}

.cq-quick-btn {
  padding: 6px 14px;
  border: 1px solid var(--chat-primary-light);
  border-radius: 20px;
  background: transparent;
  color: var(--chat-primary-light);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.cq-quick-btn:hover {
  background: var(--chat-primary);
  color: white;
  border-color: var(--chat-primary);
}

/* ===== INPUT AREA ===== */
.cq-chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--chat-border);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: var(--chat-bg);
}

.cq-chat-textarea {
  flex: 1;
  background: var(--chat-surface);
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--chat-text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color 0.2s;
}

.cq-chat-textarea::placeholder {
  color: var(--chat-text-muted);
}

.cq-chat-textarea:focus {
  border-color: var(--chat-primary-light);
}

.cq-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-light));
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, opacity 0.2s;
}

.cq-chat-send:hover {
  transform: scale(1.1);
}

.cq-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.cq-chat-send svg {
  width: 18px;
  height: 18px;
  fill: white;
}

/* ===== ANIMATIONS ===== */
@keyframes cqPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

@keyframes cqTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

@keyframes cqMessageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cqFadeIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
  .cq-chat-container {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .cq-chat-toggle {
    bottom: 88px;
    right: 20px;
    width: 56px;
    height: 56px;
  }

  .cq-chat-toggle svg {
    width: 26px;
    height: 26px;
  }
}
