/* FAQ Chatbot Styles */

:root {
  --chatbot-primary: #4A6B56;       /* Sage Green matching --color-primary */
  --chatbot-primary-hover: #375341; /* Darker green matching --color-primary-hover */
  --chatbot-secondary: #F0F5F2;     /* Very light green matching --color-primary-light */
  --chatbot-text-dark: #2C3531;     /* Slate black matching --text-main */
  --chatbot-text-light: #ffffff;
  --chatbot-text-muted: #626D68;    /* Charcoal gray matching --text-muted */
  --chatbot-border: #E8E5DF;        /* Soft gray matching --color-border */
  --chatbot-accent: #C97D54;        /* Apricot/terracotta matching --color-accent */
  --chatbot-font-family: 'Outfit', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", sans-serif;
}

/* Chatbot Container */
#faq-chatbot-widget {
  font-family: var(--chatbot-font-family);
  font-size: 14px;
  line-height: 1.5;
  color: var(--chatbot-text-dark);
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  box-sizing: border-box;
}

#faq-chatbot-widget * {
  box-sizing: border-box;
}

/* Launcher Button */
.chatbot-launcher {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chatbot-primary) 0%, #1e4b8a 100%);
  box-shadow: 0 4px 16px rgba(15, 37, 71, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: none;
  outline: none;
}

.chatbot-launcher:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 6px 20px rgba(15, 37, 71, 0.4);
}

.chatbot-launcher svg {
  width: 28px;
  height: 28px;
  fill: var(--chatbot-text-light);
  transition: transform 0.3s ease;
}

/* Launcher Icon Rotate on Open */
.chatbot-launcher.active svg {
  transform: rotate(90deg);
}

/* Chat Window */
.chatbot-window {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 380px;
  height: 520px;
  max-height: calc(85vh - 100px);
  max-width: calc(100vw - 48px);
  background-color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.chatbot-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.chatbot-header {
  background-color: var(--chatbot-primary);
  color: var(--chatbot-text-light);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-header-info {
  display: flex;
  flex-direction: column;
}

.chatbot-header-title {
  font-size: 16px;
  font-weight: bold;
  margin: 0;
}

.chatbot-header-subtitle {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chatbot-header-status-dot {
  width: 6px;
  height: 6px;
  background-color: #2ed573;
  border-radius: 50%;
  display: inline-block;
  animation: pulse 1.5s infinite;
}

.chatbot-close-btn {
  background: transparent;
  border: none;
  color: var(--chatbot-text-light);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  opacity: 0.8;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.chatbot-close-btn:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.1);
}

/* Messages Content Area */
.chatbot-messages-container {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background-color: #fcfdfe;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Scrollbar Style */
.chatbot-messages-container::-webkit-scrollbar {
  width: 6px;
}
.chatbot-messages-container::-webkit-scrollbar-track {
  background: transparent;
}
.chatbot-messages-container::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
}

/* Individual Message Row */
.chatbot-message-row {
  display: flex;
  width: 100%;
}

.chatbot-message-row.bot {
  justify-content: flex-start;
}

.chatbot-message-row.user {
  justify-content: flex-end;
}

/* Message Bubble */
.chatbot-message-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 13.5px;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.bot .chatbot-message-bubble {
  background-color: var(--chatbot-secondary);
  color: var(--chatbot-text-dark);
  border-top-left-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.user .chatbot-message-bubble {
  background-color: var(--chatbot-primary);
  color: var(--chatbot-text-light);
  border-top-right-radius: 4px;
}

/* Links in bot message */
.chatbot-message-bubble a {
  color: var(--chatbot-accent);
  text-decoration: underline;
  font-weight: bold;
}

.chatbot-message-bubble a:hover {
  opacity: 0.8;
}

/* Quick Suggestion Chips */
.chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding-left: 4px;
}

.chatbot-chip {
  background-color: #ffffff;
  color: var(--chatbot-primary);
  border: 1px solid var(--chatbot-primary);
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.chatbot-chip:hover {
  background-color: var(--chatbot-primary);
  color: var(--chatbot-text-light);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(15, 37, 71, 0.15);
}

/* Input Area */
.chatbot-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--chatbot-border);
  background-color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatbot-text-input {
  flex: 1;
  border: 1px solid var(--chatbot-border);
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s;
  background-color: #fafafa;
}

.chatbot-text-input:focus {
  border-color: var(--chatbot-primary);
  background-color: #ffffff;
}

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

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

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

.chatbot-send-btn svg {
  width: 18px;
  height: 18px;
  fill: var(--chatbot-text-light);
  margin-left: 2px; /* Slightly adjust for send icon alignment */
}

/* Typing Indicator */
.chatbot-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}

.chatbot-typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--chatbot-text-muted);
  border-radius: 50%;
  opacity: 0.4;
  animation: typing-bounce 1s infinite alternate;
}

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

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

/* Animations */
@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes typing-bounce {
  from {
    transform: translateY(0);
    opacity: 0.4;
  }
  to {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* Responsive / Mobile overrides */
@media (max-width: 480px) {
  #faq-chatbot-widget {
    bottom: 16px;
    right: 16px;
  }
  .chatbot-window {
    position: fixed;
    bottom: 84px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
    height: 70vh;
    max-height: 500px;
  }
}

/* Floating CTA instructions (for demo) */
.widget-hint {
  position: fixed;
  bottom: 96px;
  right: 24px;
  background-color: var(--chatbot-primary);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  animation: bounce 2s infinite;
  z-index: 999998;
}

.widget-hint::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 22px;
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: var(--chatbot-primary) transparent;
  display: block;
  width: 0;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-8px);
  }
  60% {
    transform: translateY(-4px);
  }
}

@media (max-width: 768px) {
  .widget-hint {
    bottom: 90px;
    right: 16px;
  }
}
