/* ── Ghurio FAQ Widget — Chatbot UI ──────────────────────────────────────── */

:root {
  --faq-g1:        #1d4ed8;
  --faq-g2:        #6d28d9;
  --faq-accent:    #f59e0b;
  --faq-wa:        #25d366;
  --faq-wa-dark:   #1aa057;

  --faq-surface:   #ffffff;
  --faq-bg:        #f1f5f9;
  --faq-border:    #e2e8f0;

  --faq-txt-1:     #0f172a;
  --faq-txt-2:     #475569;
  --faq-txt-3:     #94a3b8;

  --faq-sh-sm:     0 1px 2px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.05);
  --faq-sh-md:     0 4px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
  --faq-sh-lg:     0 12px 32px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.08);
  --faq-sh-bubble: 0 8px 24px rgba(29,78,216,0.45),
                   0 2px 8px  rgba(109,40,217,0.25),
                   inset 0 1px 0 rgba(255,255,255,0.2);

  --faq-r-sm:  8px;
  --faq-r-md:  14px;
  --faq-r-lg:  18px;
  --faq-z:     9000;
}

/* ── Bubble ─────────────────────────────────────────────────────────────── */

.faq-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: var(--faq-z);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--faq-g1) 0%, var(--faq-g2) 100%);
  box-shadow: var(--faq-sh-bubble);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1),
              box-shadow 0.22s ease;
  outline: none;
}
.faq-bubble::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(29,78,216,0.25), rgba(109,40,217,0.25));
  z-index: -1;
  animation: faq-pulse 2.8s ease-in-out infinite;
}
.faq-bubble:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 14px 32px rgba(29,78,216,0.5),
              0 4px 12px rgba(109,40,217,0.3),
              inset 0 1px 0 rgba(255,255,255,0.25);
}
.faq-bubble:active { transform: scale(0.96) translateY(0); }
.faq-bubble img {
  width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
  display: block;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.9);
}

@keyframes faq-pulse {
  0%, 100% { transform: scale(1);    opacity: 0.6; }
  50%       { transform: scale(1.35); opacity: 0; }
}

/* ── Backdrop ────────────────────────────────────────────────────────────── */

.faq-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(2px);
  z-index: calc(var(--faq-z) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.faq-overlay.is-open { opacity: 1; pointer-events: auto; }

/* ── Panel shell ─────────────────────────────────────────────────────────── */

.faq-panel {
  position: fixed;
  z-index: var(--faq-z);
  background: var(--faq-surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--faq-sh-lg), 0 0 0 1px rgba(0,0,0,0.04);

  bottom: 100px;
  right: 28px;
  width: 380px;
  max-height: 560px;
  border-radius: var(--faq-r-lg);

  transform: translateY(16px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.26s cubic-bezier(0.34,1.2,0.64,1), opacity 0.22s ease;
  transform-origin: bottom right;
}
.faq-panel.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 601px) and (max-width: 1024px) {
  .faq-overlay { display: block; }
  .faq-panel {
    top: 50%; left: 50%;
    right: auto; bottom: auto;
    width: min(540px, 90vw);
    max-height: 74vh;
    border-radius: var(--faq-r-lg);
    transform: translate(-50%, -45%) scale(0.96);
    transform-origin: center;
  }
  .faq-panel.is-open { transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 767px) {
  /* Lift FAB above the 60px bottom nav bar */
  .faq-bubble { bottom: 80px; right: 20px; touch-action: none; }
  /* Scale feedback while dragging */
  .faq-bubble--dragging {
    transform: scale(1.1) !important;
    transition: transform 0.1s ease !important;
    cursor: grabbing;
  }
}

@media (max-width: 600px) {
  .faq-overlay { display: block; }
  .faq-bubble  { bottom: 80px; right: 20px; }
  .faq-panel {
    bottom: 60px; left: 0; right: 0;
    width: 100%;
    max-height: calc(92dvh - 60px);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transform-origin: bottom center;
  }
  .faq-panel.is-open { transform: translateY(0); opacity: 1; }
}

/* ── Drag handle ─────────────────────────────────────────────────────────── */

.faq-handle {
  display: none;
  width: 36px; height: 4px;
  background: var(--faq-border);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}
@media (max-width: 600px) { .faq-handle { display: block; } }

/* ── Header ─────────────────────────────────────────────────────────────── */

.faq-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px 14px;
  background: linear-gradient(135deg, var(--faq-g1) 0%, var(--faq-g2) 100%);
  position: relative;
  overflow: hidden;
}
.faq-header::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
}
.faq-header::before {
  content: '';
  position: absolute;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  right: -30px; top: -50px;
  pointer-events: none;
}

.faq-header__avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.faq-header__avatar img {
  width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
  display: block;
}
.faq-header__info  { flex: 1; min-width: 0; }
.faq-header__title { font-size: 14px; font-weight: 700; color: #fff; letter-spacing: 0.01em; font-family: sans-serif; }
.faq-header__sub   { font-size: 11px; color: rgba(255,255,255,0.75); margin-top: 2px; font-family: sans-serif; display: flex; align-items: center; gap: 4px; }
.faq-header__dot   { width: 6px; height: 6px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 6px #4ade80; display: inline-block; }

.faq-btn-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  transition: background 0.15s;
  position: relative; z-index: 1;
}
.faq-btn-icon:hover  { background: rgba(255,255,255,0.28); }
.faq-btn-icon:active { transform: scale(0.93); }

/* ── Chat container ──────────────────────────────────────────────────────── */

.faq-chat {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 16px;
  background: var(--faq-bg);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.faq-chat::-webkit-scrollbar { width: 4px; }
.faq-chat::-webkit-scrollbar-thumb { background: var(--faq-border); border-radius: 2px; }

/* ── Message rows ────────────────────────────────────────────────────────── */

.faq-row {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  max-width: 90%;
  animation: faq-msg-in 0.18s ease;
}
.faq-row--bot  { align-self: flex-start; }
.faq-row--user { align-self: flex-end; flex-direction: row-reverse; }

@keyframes faq-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Avatar ──────────────────────────────────────────────────────────────── */

.faq-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--faq-g1), var(--faq-g2));
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(29,78,216,0.3);
  font-family: sans-serif;
  letter-spacing: 0;
  overflow: hidden;
}
.faq-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Chat bubbles ────────────────────────────────────────────────────────── */

.faq-bubble-bot {
  background: var(--faq-surface);
  color: var(--faq-txt-1);
  border-radius: 16px 16px 16px 4px;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.55;
  box-shadow: var(--faq-sh-sm);
  max-width: 100%;
  word-break: break-word;
  white-space: pre-line;
}

.faq-bubble-user {
  background: linear-gradient(135deg, var(--faq-g1) 0%, var(--faq-g2) 100%);
  color: #fff;
  border-radius: 16px 16px 4px 16px;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.55;
  box-shadow: 0 2px 8px rgba(29,78,216,0.3);
  max-width: 100%;
  word-break: break-word;
}

/* ── Typing indicator ────────────────────────────────────────────────────── */

.faq-typing {
  padding: 12px 14px !important;
  display: flex !important;
  align-items: center;
  gap: 5px;
}
.faq-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--faq-txt-3);
  display: inline-block;
  animation: faq-dot 1.2s ease-in-out infinite;
}
.faq-typing span:nth-child(2) { animation-delay: 0.2s; }
.faq-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes faq-dot {
  0%, 80%, 100% { transform: translateY(0);    opacity: 0.4; }
  40%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Option pills ────────────────────────────────────────────────────────── */

.faq-opts {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 4px 0 4px 33px;
  align-self: flex-start;
  width: 100%;
  animation: faq-msg-in 0.18s ease;
}

.faq-opt {
  padding: 9px 14px;
  border-radius: 20px;
  border: 1.5px solid rgba(29,78,216,0.3);
  background: var(--faq-surface);
  color: var(--faq-g1);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: sans-serif;
  transition: all 0.15s ease;
  box-shadow: var(--faq-sh-sm);
  text-align: left;
  line-height: 1.4;
}
.faq-opt:hover {
  background: linear-gradient(135deg, var(--faq-g1), var(--faq-g2));
  color: #fff;
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(29,78,216,0.28);
}
.faq-opt:active { transform: translateY(0); }

/* ── WhatsApp button ─────────────────────────────────────────────────────── */

.faq-wa-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--faq-wa) 0%, var(--faq-wa-dark) 100%);
  color: #fff;
  border: none;
  border-radius: var(--faq-r-md);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  font-family: sans-serif;
  margin-left: 33px;
  box-shadow: 0 3px 10px rgba(37,211,102,0.3),
              inset 0 1px 0 rgba(255,255,255,0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  align-self: flex-start;
  animation: faq-msg-in 0.18s ease;
}
.faq-wa-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37,211,102,0.4);
}
.faq-wa-btn:active { transform: translateY(0); }
.faq-wa-btn svg { width: 17px; height: 17px; fill: #fff; flex-shrink: 0; }

/* ── Start Over button ───────────────────────────────────────────────────── */

.faq-restart-btn {
  align-self: center;
  margin-top: 6px;
  padding: 8px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--faq-border);
  background: var(--faq-surface);
  color: var(--faq-txt-3);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: sans-serif;
  box-shadow: var(--faq-sh-sm);
  transition: all 0.15s ease;
  animation: faq-msg-in 0.18s ease;
}
.faq-restart-btn:hover {
  border-color: var(--faq-g1);
  color: var(--faq-g1);
  transform: translateY(-1px);
}
.faq-restart-btn:active { transform: translateY(0); }

/* ── Skeleton loader ─────────────────────────────────────────────────────── */

.faq-skel {
  height: 38px;
  border-radius: 16px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: faq-shimmer 1.5s infinite ease-in-out;
  box-shadow: var(--faq-sh-sm);
}
.faq-skel--sm { height: 28px; width: 60%; }

@keyframes faq-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.faq-footer {
  flex-shrink: 0;
  padding: 9px 16px;
  background: var(--faq-surface);
  border-top: 1px solid var(--faq-border);
  text-align: center;
  font-size: 11px;
  color: var(--faq-txt-3);
  font-family: sans-serif;
  letter-spacing: 0.02em;
}
