/* ===========================
   FAQ Chatbot — Stylesheet
   Modern glassmorphism design
   =========================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

:root {
  /* Color Palette — Green & White */
  --bg-primary: #f5f9f5;
  --bg-secondary: #eaf2ea;
  --bg-tertiary: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --bg-glass-light: rgba(0, 128, 0, 0.06);

  --accent-primary: #008000;
  --accent-secondary: #2e9e2e;
  --accent-tertiary: #006600;
  --accent-glow: rgba(0, 128, 0, 0.25);

  --gradient-primary: linear-gradient(
    135deg,
    #008000 0%,
    #2e9e2e 50%,
    #45b045 100%
  );
  --gradient-secondary: linear-gradient(
    135deg,
    #006600 0%,
    #008000 50%,
    #2e9e2e 100%
  );
  --gradient-bg: linear-gradient(180deg, #f0f7f0 0%, #e8f3e8 50%, #f5f9f5 100%);
  --gradient-card: linear-gradient(
    135deg,
    rgba(0, 128, 0, 0.06),
    rgba(0, 128, 0, 0.02)
  );

  --text-primary: #1a2e1a;
  --text-secondary: #4a6b4a;
  --text-muted: #7a9a7a;

  --border-color: rgba(0, 128, 0, 0.15);
  --border-glow: rgba(0, 128, 0, 0.35);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(0, 128, 0, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  background: var(--gradient-bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
  position: relative;
} */


body {
  font-family: "Inter", sans-serif;
  background: var(--gradient-bg);
  color: var(--text-primary);
  /* min-height: 100vh; */
  overflow: auto; 
  position: relative;
}

/* ===== Docked Chat Container ===== */
.chat-container {
  width: 500px;
  height: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  overflow: hidden;
  
  /* Docking Logic */
  position: fixed;
  bottom: 100px;
  right: 25px;
  z-index: 1001;
  
  /* Hidden State for Toggle */
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: all var(--transition-normal);
}

.chat-container.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* ===== Launcher Button ===== */
.chat-launcher {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  z-index: 1000;
  transition: all var(--transition-fast);
}

.chat-launcher:hover {
  transform: scale(1.1) rotate(5deg);
}



/* 2. Dock the container to the side */
.chat-container.docked {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 420px;       /* Keeps your original width feel */
    height: 700px;      /* Keeps your original height feel */
    max-height: 85vh;
    margin: 0;
    
    /* Animation: Maintain your slideUp but add a toggle state */
    display: none;      /* Hidden by default */
}

/* When the toggle script runs */
.chat-container.docked.active {
    display: flex;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 3. Style the launcher using your theme's green gradients */
.chat-launcher {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 65px;
    height: 65px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    border: 1px solid var(--border-color);
    color: white;
    font-size: 28px;
    cursor: pointer;
    z-index: 2000;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.chat-launcher:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-glow);
}

/* Mobile: Ensure it still looks good docked */
@media (max-width: 480px) {
    .chat-container.docked {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}





/* ===== Animated Background ===== */
.bg-orbs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.bg-orbs .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: float 20s infinite ease-in-out;
}

.bg-orbs .orb:nth-child(1) {
  width: 400px;
  height: 400px;
  background: var(--accent-primary);
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.bg-orbs .orb:nth-child(2) {
  width: 300px;
  height: 300px;
  background: #45b045;
  bottom: -80px;
  left: -80px;
  animation-delay: -7s;
}

.bg-orbs .orb:nth-child(3) {
  width: 200px;
  height: 200px;
  background: #006600;
  top: 50%;
  left: 50%;
  animation-delay: -14s;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(30px, -50px) scale(1.1);
  }
  50% {
    transform: translate(-20px, 20px) scale(0.95);
  }
  75% {
    transform: translate(40px, 30px) scale(1.05);
  }
}



/* ===== Chat Container ===== */
/* .chat-container {
  width: 100%;
  max-width: 520px;
  height: 92vh;
  max-height: 780px;
  display: flex;
  flex-direction: column;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  overflow: hidden;
  position: relative;
  z-index: 1;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
} */

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ===== Header ===== */
.chat-header {
  padding: 20px 24px;
  background: linear-gradient(180deg, rgba(0, 128, 0, 0.08), transparent);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.chat-header .avatar {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.chat-header .info h1 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.chat-header .info .status {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.chat-header .info .status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.chat-header .menu-btn {
  margin-left: auto;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass-light);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-fast);
}

.chat-header .menu-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* ===== Category Bar ===== */
.category-bar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-color);
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.category-chip {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-glass-light);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 5px;
}

.category-chip:hover,
.category-chip.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

/* ===== Messages Area ===== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* ===== Message Bubbles ===== */
.message {
  display: flex;
  gap: 10px;
  animation: messageIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 90%;
}

.message.bot {
  align-self: flex-start;
}

.message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message .msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  align-self: flex-end;
}

.message.bot .msg-avatar {
  background: var(--gradient-primary);
  box-shadow: 0 0 12px rgba(0, 128, 0, 0.2);
}

.message.user .msg-avatar {
  background: var(--bg-glass-light);
  border: 1px solid var(--border-color);
}

.message .msg-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.message .bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-primary);
}

.message.bot .bubble {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.message.user .bubble {
  background: var(--gradient-primary);
  color: white;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 128, 0, 0.25);
}

.message .bubble strong {
  color: var(--accent-tertiary);
  font-weight: 600;
}

.message.user .bubble strong {
  color: white;
}

.message .msg-category {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  color: var(--accent-secondary);
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(0, 128, 0, 0.08);
  width: fit-content;
  margin-bottom: 2px;
}

.message .msg-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  padding: 0 4px;
}

/* ===== Typing Indicator ===== */
.typing-indicator {
  display: none;
  align-self: flex-start;
  gap: 10px;
  padding: 0;
  animation: messageIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.typing-indicator.visible {
  display: flex;
}

.typing-indicator .msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  align-self: flex-end;
  box-shadow: 0 0 12px rgba(0, 128, 0, 0.2);
}

.typing-indicator .dots {
  padding: 14px 18px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  border-bottom-left-radius: 4px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-indicator .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-secondary);
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.16s;
}
.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* ===== Suggestion Chips ===== */
.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
  animation: messageIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.suggestion-chip {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  color: var(--accent-tertiary);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.suggestion-chip:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

/* ===== Input Area ===== */
.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: rgba(240, 247, 240, 0.6);
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4px 6px 4px 16px;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.chat-input-wrapper:focus-within {
  border-color: var(--accent-primary);
  box-shadow:
    0 0 0 3px rgba(0, 128, 0, 0.12),
    var(--shadow-glow);
}

.chat-input-wrapper input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 10px 0;
}

.chat-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 128, 0, 0.25);
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0, 128, 0, 0.35);
}

.send-btn:active {
  transform: scale(0.95);
}

.send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

/* ===== Welcome Section ===== */
.welcome-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 30px 20px;
  animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.welcome-section .welcome-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-lg);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-glow);
}

.welcome-section h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 6px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-section p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 320px;
}

.welcome-section .quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 20px;
  width: 100%;
  max-width: 360px;
}

.quick-action-btn {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
  font-family: inherit;
}

.quick-action-btn .qa-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.quick-action-btn:hover {
  background: var(--bg-glass-light);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

/* ===== Category Panel ===== */
.category-panel {
  position: absolute;
  inset: 0;
  background: rgba(245, 249, 245, 0.97);
  backdrop-filter: blur(16px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}

.category-panel.open {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.panel-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass-light);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all var(--transition-fast);
}

.panel-close:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.panel-category {
  margin-bottom: 20px;
}

.panel-category-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-faq-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.panel-faq-item {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--gradient-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  text-align: left;
  width: 100%;
}

.panel-faq-item:hover {
  border-color: var(--accent-primary);
  background: var(--bg-glass-light);
}

/* ===== Responsive ===== */
@media (max-width: 560px) {
  body {
    padding: 0;
  }

  .chat-container {
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}

@media (max-height: 640px) {
  .welcome-section {
    padding: 16px 20px;
  }

  .welcome-section .welcome-icon {
    width: 48px;
    height: 48px;
    font-size: 22px;
    margin-bottom: 10px;
  }
}
