/* ========================================
   Dream Kerala Holidays - Chatbot Styles
   ======================================== */

/* Toggle Button */
.chatbot-toggle {
  position: fixed;
  bottom: 180px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2d6a4f, #40916c);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(45, 106, 79, 0.4);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(45, 106, 79, 0.5);
}

/* Chat Window */
.chatbot-window {
  position: fixed;
  bottom: 180px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chatbot-slideUp 0.3s ease;
}

@keyframes chatbot-slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.chatbot-header {
  background: linear-gradient(135deg, #2d6a4f, #40916c);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.chatbot-header__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.chatbot-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.chatbot-header__status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 5px;
}

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

.chatbot-header__close {
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
  padding: 4px 8px;
}

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

/* Messages Area */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8faf9;
}

.chatbot-messages::-webkit-scrollbar {
  width: 5px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

/* Message Bubbles */
.chatbot-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 85%;
}

.chatbot-message--assistant {
  align-self: flex-start;
}

.chatbot-message--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chatbot-message__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e8f5e9;
  color: #2d6a4f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}

.chatbot-message__bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chatbot-message--assistant .chatbot-message__bubble {
  background: #fff;
  color: #333;
  border: 1px solid #e8e8e8;
  border-bottom-left-radius: 4px;
}

.chatbot-message--user .chatbot-message__bubble {
  background: linear-gradient(135deg, #2d6a4f, #40916c);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.chatbot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 18px !important;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-6px);
  }
}

/* Input Area */
.chatbot-input {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid #eee;
  background: #fff;
  gap: 8px;
}

.chatbot-input input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chatbot-input input:focus {
  border-color: #2d6a4f;
}

.chatbot-input input::placeholder {
  color: #999;
}

.chatbot-input button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2d6a4f, #40916c);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.chatbot-input button:hover:not(:disabled) {
  transform: scale(1.05);
}

.chatbot-input button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .chatbot-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 200px);
    bottom: 160px;
    right: 8px;
    border-radius: 12px;
  }

  .chatbot-toggle {
    bottom: 160px;
    right: 16px;
    width: 54px;
    height: 54px;
    font-size: 22px;
  }
}


/* ========================================
   Rich Text Message Styles
   ======================================== */

/* Tables */
.cb-table-wrap {
  overflow-x: auto;
  margin: 8px 0;
  border-radius: 6px;
}

.cb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}

.cb-table th,
.cb-table td {
  padding: 6px 10px;
  border: 1px solid #e0e0e0;
  text-align: left;
}

.cb-table th {
  background: #f0faf4;
  font-weight: 600;
  color: #2d6a4f;
}

.cb-table tr:nth-child(even) {
  background: #f9f9f9;
}

/* Lists */
.cb-list {
  margin: 6px 0;
  padding-left: 20px;
}

.cb-list li {
  margin: 3px 0;
  line-height: 1.5;
}

/* Headings */
.cb-h1,
.cb-h2,
.cb-h3 {
  margin: 8px 0 4px;
  color: #2d6a4f;
}

.cb-h1 {
  font-size: 16px;
  font-weight: 700;
}

.cb-h2 {
  font-size: 14px;
  font-weight: 600;
}

.cb-h3 {
  font-size: 13px;
  font-weight: 600;
}

/* Code */
.cb-code-block {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  overflow-x: auto;
  margin: 6px 0;
  font-family: 'Courier New', monospace;
  white-space: pre-wrap;
}

.cb-inline-code {
  background: #f0f0f0;
  color: #d63384;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
}

/* Links */
.cb-link {
  color: #2d6a4f;
  text-decoration: underline;
  word-break: break-all;
}

.cb-link:hover {
  color: #1b4332;
}

/* Horizontal Rule */
.cb-hr {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 8px 0;
}

/* Make bubble support block elements properly */
.chatbot-message__bubble strong {
  font-weight: 600;
}

.chatbot-message__bubble em {
  font-style: italic;
}

.chatbot-message--user .chatbot-message__bubble .cb-list {
  padding-left: 18px;
}

.chatbot-message--user .chatbot-message__bubble a {
  color: #fff;
  text-decoration: underline;
}


/* ========================================
   Quick Reply Buttons
   ======================================== */

.chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 8px 36px;
  animation: fadeInOptions 0.3s ease;
}

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

.chatbot-quick-reply {
  background: #fff;
  border: 1.5px solid #2d6a4f;
  color: #2d6a4f;
  padding: 6px 12px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chatbot-quick-reply:hover:not(:disabled) {
  background: #2d6a4f;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(45, 106, 79, 0.3);
}

.chatbot-quick-reply:active:not(:disabled) {
  transform: translateY(0);
}

.chatbot-quick-reply:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
