:root {
  --faq-green: #1a4527;
  --faq-orange: #ec7d31;
  --faq-orange-dark: #d46a22;
  --faq-white: #ffffff;
  --faq-text: #1b1b1b;
  --faq-muted: #8a8a8a;
}

#faq-widget,
#faq-widget * {
  box-sizing: border-box;
  font-family: "Lato", Arial, sans-serif;
}

#faq-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

/* ---------- Icon (headset smiley) ---------- */
.faq-icon {
  display: inline-block;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 16v-2a10 10 0 0 1 20 0v2'/%3E%3Crect x='3' y='15' width='4' height='7' rx='2' fill='white'/%3E%3Crect x='25' y='15' width='4' height='7' rx='2' fill='white'/%3E%3Cpath d='M10 12h12a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2h-4l-2 3-2-3h-4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2z' fill='white' stroke='none'/%3E%3Ccircle cx='13' cy='16.5' r='1.3' fill='%231a4527' stroke='none'/%3E%3Ccircle cx='19' cy='16.5' r='1.3' fill='%231a4527' stroke='none'/%3E%3Cpath d='M13 19.5q3 2 6 0' stroke='%231a4527' stroke-width='1.4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Launcher button ---------- */
.faq-toggle {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 220px;
  padding: 10px 40px 10px 44px;
  border: none;
  border-radius: 14px;
  background: var(--faq-green);
  color: var(--faq-white);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}

.faq-toggle:hover {
  transform: translateY(-2px);
}

/* ---------- Panel ---------- */
.faq-panel {
  display: none;
  flex-direction: column;
  width: 33.333vw;          /* one third of the screen */
  min-width: 360px;         /* stays readable on small screens */
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 110px);
  background: var(--faq-green);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.faq-panel.is-open {
  display: flex;
}

.faq-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px 10px;
  color: var(--faq-white);
}

.faq-title {
  flex: 1;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.faq-head-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--faq-orange);
  border-radius: 8px;
  background: transparent;
  color: var(--faq-orange);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.faq-head-btn:hover:not(:disabled) {
  background: rgba(236, 125, 49, 0.15);
}

.faq-head-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.faq-close {
  border: none;
  background: transparent;
  color: var(--faq-white);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- Messages ---------- */
.faq-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-bubble {
  max-width: 85%;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-line;
}

.faq-bubble.bot {
  align-self: flex-start;
  background: var(--faq-white);
  color: var(--faq-text);
  border: 1px solid #444;
  text-transform: uppercase;
  font-weight: 700;
}

.faq-bubble.bot.answer {
  text-transform: none;
  font-weight: 400;
}

.faq-bubble.user {
  align-self: flex-end;
  background: var(--faq-orange);
  color: var(--faq-white);
  font-weight: 700;
  text-transform: uppercase;
}

.faq-bubble a {
  color: var(--faq-green);
  font-weight: 700;
  text-decoration: underline;
  word-break: break-all;
}

.faq-bubble a:hover {
  color: var(--faq-orange-dark);
}

/* ---------- Option buttons ---------- */
.faq-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.faq-option {
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid #3a2a1a;
  border-radius: 8px;
  background: var(--faq-orange);
  color: var(--faq-white);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease;
}

.faq-option:hover {
  background: var(--faq-orange-dark);
}

.faq-option.faq-nav {
  background: transparent;
  border-color: var(--faq-orange);
  color: var(--faq-orange);
}

.faq-option.faq-nav:hover {
  background: rgba(236, 125, 49, 0.15);
}

.faq-options.is-used .faq-option {
  opacity: 0.5;
  pointer-events: none;
}

/* ---------- Input bar ---------- */
.faq-input {
  display: flex;
  height: 62px;
  background: var(--faq-white);
  border-radius: 22px 0 0 0;
}

.faq-input input {
  flex: 1;
  min-width: 0;
  padding: 0 22px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--faq-text);
}

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

.faq-send {
  width: 115px;
  border: none;
  border-radius: 10px 0 0 0;
  background: var(--faq-orange);
  color: var(--faq-white);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.faq-send:hover {
  background: var(--faq-orange-dark);
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  .faq-panel {
    height: 560px;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
  #faq-widget {
    right: 16px;
    bottom: 16px;
    left: 16px;
  }

  .faq-panel {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: calc(100vh - 100px);
    height: calc(100dvh - 100px);
    border-radius: 18px;
  }

  .faq-header {
    padding: 16px 16px 8px;
    gap: 10px;
  }

  .faq-title {
    font-size: 16px;
  }

  .faq-option {
    font-size: 12px;
  }

  .faq-input {
    height: 54px;
  }

  .faq-input input {
    padding: 0 16px;
    font-size: 16px;        /* prevents iOS zoom on focus */
  }

  .faq-send {
    width: 90px;
    font-size: 14px;
  }

  .faq-toggle {
    min-width: 0;
    gap: 10px;
    padding: 10px 24px;
    font-size: 16px;
  }
}

/* ---------- Short screens (phone landscape) ---------- */
@media (max-height: 500px) {
  .faq-panel {
    height: calc(100vh - 90px);
    height: calc(100dvh - 90px);
    max-height: none;
  }
}

/* ---------- Site integration ---------- */
/* The widget box can span the full width on mobile; let clicks pass
   through its empty area to the page underneath. */
#faq-widget {
  pointer-events: none;
}

#faq-widget .faq-panel,
#faq-widget .faq-toggle {
  pointer-events: auto;
}

/* Lift the theme's scroll-to-top button above the chat launcher. */
.scroll__top.open {
  bottom: 100px;
}

@media (max-width: 767.98px) {
  .scroll__top.open {
    bottom: 84px;
  }
}
