/* chatbot-widget.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --cb-primary: #6366f1; /* Indigo */
  --cb-primary-hover: #4f46e5;
  --cb-bg: rgba(15, 23, 42, 0.85); /* Dark slate glass */
  --cb-surface: rgba(30, 41, 59, 0.9);
  --cb-border: rgba(255, 255, 255, 0.1);
  --cb-text: #f8fafc;
  --cb-text-muted: #cbd5e1;
  --cb-bot-msg: rgba(51, 65, 85, 0.8);
  --cb-user-msg: var(--cb-primary);
  --cb-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --cb-glass-blur: blur(12px);
}

#cb-widget-container * {
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

#cb-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Jumping Button */
#cb-trigger-btn {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: cb-jump 4s infinite ease-in-out;
}

#cb-trigger-btn:hover {
  transform: scale(1.05);
  animation-play-state: paused;
}

#cb-trigger-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

@keyframes cb-jump {
  0%, 80%, 100% { transform: translateY(0); }
  85% { transform: translateY(-10px); }
  90% { transform: translateY(0); }
  95% { transform: translateY(-5px); }
}

/* Chat Window */
#cb-chat-window {
  width: 360px;
  height: 520px;
  max-height: calc(100vh - 100px);
  background: var(--cb-bg);
  backdrop-filter: var(--cb-glass-blur);
  -webkit-backdrop-filter: var(--cb-glass-blur);
  border: 1px solid var(--cb-border);
  border-radius: 20px;
  box-shadow: var(--cb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

/* Header */
.cb-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--cb-border);
  display: flex;
  align-items: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 100%);
  position: relative;
  z-index: 20;
}

.cb-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--cb-text);
  font-weight: 600;
  font-size: 16px;
}

.cb-bot-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.cb-bot-avatar svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.cb-close-btn {
  background: transparent;
  border: none;
  color: var(--cb-text-muted);
  cursor: pointer;
  padding: 8px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9999;
  font-size: 20px;
  font-weight: bold;
  line-height: 1;
}

.cb-close-btn:hover {
  color: white;
}

.cb-trigger-btn svg, .cb-send-btn svg {
  pointer-events: none;
}

.cb-close-btn:hover {
  color: white;
}

/* Messages Area */
.cb-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

/* Scrollbar styling */
.cb-messages::-webkit-scrollbar {
  width: 6px;
}
.cb-messages::-webkit-scrollbar-track {
  background: transparent;
}
.cb-messages::-webkit-scrollbar-thumb {
  background: var(--cb-border);
  border-radius: 10px;
}

.cb-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--cb-text);
  animation: cb-msg-fade 0.3s ease forwards;
  opacity: 0;
  transform: translateY(10px);
}

@keyframes cb-msg-fade {
  to { opacity: 1; transform: translateY(0); }
}

.cb-msg-bot {
  background: var(--cb-bot-msg);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.cb-msg-user {
  background: var(--cb-user-msg);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Options / Buttons inside chat */
.cb-options-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.cb-option-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--cb-primary);
  color: var(--cb-text);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cb-option-btn:hover {
  background: var(--cb-primary);
  color: white;
}

/* Input Area */
.cb-input-area {
  padding: 16px;
  border-top: 1px solid var(--cb-border);
  background: rgba(0,0,0,0.1);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.cb-input {
  flex: 1;
  background: var(--cb-surface);
  border: 1px solid var(--cb-border);
  border-radius: 20px;
  padding: 12px 16px;
  color: var(--cb-text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
  overflow-y: hidden;
  box-sizing: border-box;
  min-height: 44px;
  max-height: 120px;
  font-family: 'Inter', sans-serif;
  line-height: 1.4;
}

.cb-input:focus {
  border-color: var(--cb-primary);
}

.cb-input::placeholder {
  color: var(--cb-text-muted);
}

.cb-send-btn {
  background: var(--cb-primary);
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.cb-send-btn:hover {
  background: var(--cb-primary-hover);
}

.cb-send-btn:active {
  transform: scale(0.95);
}

.cb-send-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  margin-left: 2px; /* optical alignment */
}

.cb-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--cb-bot-msg);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: fit-content;
}

.cb-dot {
  width: 6px;
  height: 6px;
  background: var(--cb-text-muted);
  border-radius: 50%;
  animation: cb-bounce 1.4s infinite ease-in-out both;
}

.cb-dot:nth-child(1) { animation-delay: -0.32s; }
.cb-dot:nth-child(2) { animation-delay: -0.16s; }

@media (max-width: 480px) {
  #cb-widget-container {
    bottom: 16px;
    right: 16px;
  }
  #cb-chat-window {
    width: calc(100vw - 32px);
    height: 500px;
  }
  .cb-trigger-text {
    display: none;
  }
  #cb-trigger-btn {
    padding: 14px;
    border-radius: 50%;
  }
}
