/* Chatbot Styles - Redesigned with Collapsible Q&A */
:root {
  --chatbot-primary: #87CEEB;
  --chatbot-secondary: #ADD8E6;
  --chatbot-text: #333333;
  --chatbot-light-text: #6b7280;
  --chatbot-bg: #E0F2FE;
  --chatbot-light-bg: #F0F9FF;
  --chatbot-border: #B0E0E6;
  --chatbot-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
  --chatbot-radius: 12px;
  --chatbot-width: 380px;
  --chatbot-height: 600px;
  --chatbot-answer-bg: #ffffff;
  --chatbot-question-active: #5BA3C7;
}

/* Chatbot Container */
.chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: 'Montserrat', sans-serif;
}

/* Chatbot Button - The icon that opens the chatbot */
.chatbot-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--chatbot-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--chatbot-shadow);
  transition: all 0.3s ease;
  position: absolute;
  bottom: 0;
  right: 0;
  font-size: 24px;
}

.chatbot-button:hover {
  transform: scale(1.05);
  background-color: var(--chatbot-secondary);
}

/* Chatbot Panel - The main chatbot interface */
.chatbot-panel {
  width: var(--chatbot-width);
  height: 600px;
  max-height: 80vh;
  background-color: var(--chatbot-bg);
  border-radius: var(--chatbot-radius);
  box-shadow: var(--chatbot-shadow);
  overflow: hidden;
  display: none;
  flex-direction: column;
  position: absolute;
  bottom: 70px;
  right: 0;
  transition: all 0.3s ease;
}

/* Chatbot Header */
.chatbot-header {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  color: white;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.chatbot-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chatbot-header i {
  font-size: 20px;
}

.chatbot-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.chatbot-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Chatbot Messages Area - Redesigned for Q&A */
.chatbot-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background-color: var(--chatbot-light-bg);
  display: flex !important;
  flex-direction: column !important;
  gap: 12px;
  scroll-behavior: smooth;
  position: relative;
}

/* Welcome Message */
.chatbot-welcome {
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
  padding: 16px;
  border-radius: 12px;
  border-left: 4px solid var(--chatbot-primary);
  margin-bottom: 8px;
}

.chatbot-welcome p {
  margin: 0;
  color: var(--chatbot-text);
  font-size: 14px;
  line-height: 1.6;
}

/* Q&A Item Container */
.chatbot-qa-item {
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: visible;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 12px;
  border: 2px solid transparent;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100% !important;
  min-height: 50px;
  position: relative;
  z-index: 1;
}

.chatbot-qa-item.expanded {
  border-color: var(--chatbot-primary);
  box-shadow: 0 4px 12px rgba(135, 206, 235, 0.3);
  z-index: 10;
  position: relative;
  overflow: visible !important;
}

/* Move expanded items to bottom using flexbox order */
.chatbot-qa-item:not(.expanded) {
  order: 1;
}

.chatbot-qa-item.expanded {
  order: 999;
  margin-top: auto;
}

/* Question Button */
.chatbot-question-btn {
  background-color: white !important;
  color: var(--chatbot-text) !important;
  padding: 16px 18px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: relative;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 1;
  box-sizing: border-box;
}

.chatbot-question-btn:hover {
  background-color: #f8fafc;
}

.chatbot-question-btn.expanded {
  background-color: var(--chatbot-primary);
  color: white;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.chatbot-question-btn .question-text {
  flex: 1;
  line-height: 1.5;
  display: block;
  visibility: visible;
  color: inherit;
}

.chatbot-question-btn .question-icon {
  font-size: 12px;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.chatbot-question-btn.expanded .question-icon {
  transform: rotate(180deg);
}

/* Answer Container */
.chatbot-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
  background-color: var(--chatbot-answer-bg);
  border-top: 1px solid transparent;
  opacity: 0;
  visibility: hidden;
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.chatbot-answer.expanded {
  max-height: 3000px !important;
  padding: 18px !important;
  border-top: 1px solid var(--chatbot-border) !important;
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
  overflow: visible !important;
}

.chatbot-answer-content {
  color: var(--chatbot-text) !important;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  width: 100%;
  padding: 0;
  margin: 0;
}

.chatbot-answer-content p {
  margin: 0 0 12px 0;
}

.chatbot-answer-content p:last-child {
  margin-bottom: 0;
}

/* Regular Chat Messages (for typed questions) */
.chatbot-message {
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 85%;
  word-wrap: break-word;
  animation: messageSlideIn 0.3s ease;
}

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

.chatbot-message.bot {
  background-color: #ffffff;
  color: var(--chatbot-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--chatbot-border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chatbot-message.user {
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 6px rgba(135, 206, 235, 0.3);
}

/* Chatbot Suggestions - Common Questions */
.chatbot-suggestions {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  border-top: 2px solid var(--chatbot-border);
  background: linear-gradient(to bottom, #ffffff 0%, var(--chatbot-light-bg) 100%);
  flex-shrink: 0;
}

.chatbot-suggestions-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--chatbot-light-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding: 0 4px;
}

/* Chatbot Input Area */
.chatbot-input-container {
  padding: 16px 20px;
  display: flex;
  gap: 10px;
  border-top: 2px solid var(--chatbot-border);
  background-color: white;
  flex-shrink: 0;
}

.chatbot-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--chatbot-border);
  border-radius: 24px;
  outline: none;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s ease;
}

.chatbot-input:focus {
  border-color: var(--chatbot-primary);
  box-shadow: 0 0 0 3px rgba(135, 206, 235, 0.1);
}

.chatbot-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-secondary) 100%);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
  box-shadow: 0 2px 6px rgba(135, 206, 235, 0.3);
}

.chatbot-send:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(135, 206, 235, 0.4);
}

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

/* Animation for the chatbot panel opening/closing */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.chatbot-panel.active {
  display: flex;
  animation: slideUp 0.3s ease forwards;
}

/* Scrollbar Styling */
.chatbot-messages::-webkit-scrollbar,
.chatbot-suggestions::-webkit-scrollbar {
  width: 6px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb,
.chatbot-suggestions::-webkit-scrollbar-thumb {
  background: var(--chatbot-border);
  border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover,
.chatbot-suggestions::-webkit-scrollbar-thumb:hover {
  background: var(--chatbot-primary);
}

/* Responsive Adjustments */
@media (max-width: 480px) {
  :root {
    --chatbot-width: 90vw;
  }
  
  .chatbot-panel {
    right: 0;
    left: 0;
    margin: 0 auto;
    bottom: 80px;
    width: var(--chatbot-width);
    height: 70vh;
  }
  
  .chatbot-button {
    right: 20px;
  }
  
  .chatbot-answer.expanded {
    padding: 14px;
  }
  
  .chatbot-question-btn {
    padding: 14px 16px;
    font-size: 13px;
  }
}

/* Loading Animation */
.chatbot-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}

.chatbot-typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--chatbot-primary);
  animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}
