/* ============================================================
   ENCG FAQ bot — chat-style widget (rule-based, no AI, no backend)
   ============================================================ */

.faqbot-toggle {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 900;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary, #870B22);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 30px -8px rgba(61, 5, 15, 0.5);
  transition: transform 0.15s ease, background 0.15s ease;
}
.faqbot-toggle:hover { background: var(--color-primary-dark, #3D050F); transform: scale(1.05); }
.faqbot-toggle svg { width: 26px; height: 26px; }

.faqbot-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 901;
  width: 384px;
  max-width: calc(100vw - 32px);
  height: min(600px, calc(100vh - 120px));
  background: #ffffff;
  border: 1px solid #EBD8DC;
  border-radius: 14px;
  box-shadow: 0 30px 70px -20px rgba(61, 5, 15, 0.35);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-sans, 'Instrument Sans', sans-serif);
}
.faqbot-panel.is-open { display: flex; }

.faqbot-head {
  background: var(--color-primary, #870B22);
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}
.faqbot-head strong { font-size: 15.5px; font-weight: 700; }
.faqbot-head span { display: block; font-size: 12px; opacity: 0.85; font-weight: 400; margin-top: 2px; }
.faqbot-close { background: none; border: none; color: #fff; cursor: pointer; padding: 6px; border-radius: 6px; }
.faqbot-close:hover { background: rgba(255,255,255,0.15); }
.faqbot-close svg { width: 18px; height: 18px; display: block; }

/* Chat area ---------------------------------------------------------- */
.faqbot-chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #FBF7F7;
}

.faqbot-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
}
.faqbot-msg.bot {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #EFDFE3;
  border-bottom-left-radius: 4px;
  color: #3a2b2f;
}
.faqbot-msg.user {
  align-self: flex-end;
  background: var(--color-primary, #870B22);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}
.faqbot-msg.bot p { margin: 0 0 8px; }
.faqbot-msg.bot p:last-child { margin-bottom: 0; }
.faqbot-msg.bot a { color: var(--color-primary, #870B22); font-weight: 600; text-decoration: underline; }
.faqbot-msg.bot ul { margin: 0 0 8px; padding-left: 18px; }
.faqbot-msg.bot li { list-style: disc; margin-bottom: 3px; }

/* Quick-reply chips --------------------------------------------------- */
.faqbot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: flex-start;
  max-width: 95%;
}
.faqbot-chip {
  background: #ffffff;
  border: 1px solid var(--color-primary, #870B22);
  color: var(--color-primary, #870B22);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.faqbot-chip:hover { background: var(--color-primary, #870B22); color: #ffffff; }

/* Input bar ----------------------------------------------------------- */
.faqbot-inputbar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #EFDFE3;
  background: #ffffff;
  flex-shrink: 0;
}
.faqbot-inputbar input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid #E3CDD2;
  border-radius: 999px;
  font-size: 14px;
  font-family: inherit;
}
.faqbot-inputbar input:focus { outline: 2px solid var(--color-primary, #870B22); border-color: transparent; }
.faqbot-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary, #870B22);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.faqbot-send:hover { background: var(--color-primary-dark, #3D050F); }
.faqbot-send svg { width: 18px; height: 18px; }

@media (max-width: 560px) {
  .faqbot-panel { right: 8px; left: 8px; width: auto; bottom: 84px; }
  .faqbot-toggle { right: 16px; bottom: 16px; }
}

/* NORA identity */
.faqbot-toggle::after {
  content: "✦";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--color-primary, #870B22);
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(61, 5, 15, 0.25);
}
.faqbot-toggle { position: fixed; }
.faqbot-head strong::after { content: " ✦"; font-size: 13px; opacity: 0.9; }

/* Teaser bubble */
.faqbot-teaser {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 899;
  max-width: 260px;
  background: #ffffff;
  border: 1px solid #EBD8DC;
  border-radius: 14px 14px 4px 14px;
  box-shadow: 0 18px 50px -18px rgba(61, 5, 15, 0.4);
  padding: 14px 18px;
  font-family: var(--font-sans, 'Instrument Sans', sans-serif);
  font-size: 13.5px;
  line-height: 1.5;
  color: #3a2b2f;
  cursor: pointer;
  animation: noraIn 0.3s ease;
}
@keyframes noraIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.faqbot-teaser strong { color: var(--color-primary-dark, #3D050F); }
.faqbot-teaser-cta {
  display: block;
  margin-top: 8px;
  font-weight: 700;
  color: var(--color-primary, #870B22);
}
.faqbot-teaser-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  font-size: 16px;
  color: #9a8a8e;
  cursor: pointer;
  padding: 2px 6px;
}
.faqbot-teaser-close:hover { color: var(--color-primary, #870B22); }

/* NORA avatar photo */
.faqbot-face {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.faqbot-toggle { overflow: visible; padding: 0; border: 2px solid #ffffff; }
.faqbot-toggle .faqbot-face { width: 54px; height: 54px; }
.faqbot-face-head {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.6);
}
.faqbot-head { justify-content: flex-start; }
.faqbot-head .faqbot-close { margin-left: auto; }
.faqbot-head-titles { min-width: 0; }
.faqbot-face-teaser {
  width: 34px;
  height: 34px;
  float: left;
  margin: 2px 10px 4px 0;
  border: 1px solid #EBD8DC;
}

/* NORA's photo next to each bot message */
.faqbot-msg.bot,
.faqbot-chips {
  margin-left: 34px;
}
.faqbot-msg.bot { position: relative; }
.faqbot-msg.bot::before {
  content: "";
  position: absolute;
  left: -34px;
  bottom: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: url("../assets/images/nora-avatar.jpg") center / cover no-repeat;
  border: 1px solid #EBD8DC;
}
/* consecutive bot bubbles: photo only on the last one of the run */
.faqbot-msg.bot:has(+ .faqbot-msg.bot)::before { display: none; }
