/* ============================================================
   Knowledge Hub — Section Page (shared: essentials + recharge)
   Theme is controlled by .khs-theme-violet / .khs-theme-orange
   on the body element.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

.khs-body {
  --khs-hero-bg:         var(--Core-Violet);
  --khs-group-title-clr: var(--Core-Violet);

  margin: 0;
  padding: 0;
  background-color: #f0eef8;
  font-family: 'Poppins', sans-serif;
  color: var(--Core-Base-Black);
  -webkit-font-smoothing: antialiased;
}

.khs-body.khs-theme-orange {
  --khs-hero-bg:         var(--Core-Vivid-Orange);
  --khs-group-title-clr: var(--Core-Vivid-Orange);
}

.khs-body.khs-theme-green {
  --khs-hero-bg:         #2D7A5E;
  --khs-group-title-clr: #2D7A5E;
}

.khs-body.khs-theme-amber {
  --khs-hero-bg:         #7C5514;
  --khs-group-title-clr: #D97706;
}

.khs-container {
  max-width: clamp(760px, 72vw, 1200px);
  margin: 0 auto;
  padding: 0 40px;
}

@media (max-width: 1000px) {
  .khs-container { max-width: 100%; }
}

/* ============================================================
   BACK NAV
   ============================================================ */
.khs-nav { padding: 20px 0 0; }

.khs-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--Core-Violet);
  text-decoration: none;
  transition: opacity 0.2s;
}
.khs-back:hover { opacity: 0.7; }
.khs-back svg { flex-shrink: 0; }

/* ============================================================
   HERO
   ============================================================ */
.khs-hero { padding: 20px 0 28px; }

.khs-hero__card {
  background: var(--khs-hero-bg);
  border-radius: 16px;
  padding: 40px 48px;
}

.khs-hero__title {
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 700;
  color: #fff;
  margin: 0 0 12px;
  line-height: 1.2;
}

.khs-hero__desc {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.6;
  margin: 0;
  max-width: 680px;
}

/* ============================================================
   MAIN
   ============================================================ */
.khs-main { padding-bottom: 60px; }

/* ============================================================
   ACCORDION
   ============================================================ */
.khs-accordion {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e8e4f2;
  margin-bottom: 12px;
}

.khs-accordion__btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.khs-accordion__btn:hover {
  background: #faf9fd;
  border-radius: 14px;
}

.khs-accordion__icon-wrap { flex-shrink: 0; }

.khs-accordion__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: contain;
  display: block;
}

.khs-accordion__meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.khs-accordion__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--Core-Dark-Violet);
  line-height: 1.3;
}

.khs-accordion__subtitle {
  font-size: 13px;
  color: var(--Core-Blue-Gray);
  line-height: 1.4;
}

.khs-accordion__chevron {
  flex-shrink: 0;
  color: var(--Core-Dark-Violet);
  display: flex;
  align-items: center;
  transition: transform 0.25s ease;
}

.khs-accordion.is-open .khs-accordion__chevron { transform: rotate(180deg); }
.khs-accordion.is-open .khs-accordion__btn { border-bottom: 1px solid #ede9f8; }

.khs-accordion__body { transition: height 0.28s ease; }
.khs-accordion__body[hidden] { display: none !important; }

.khs-accordion__content { padding: 0 24px 24px; }

/* ============================================================
   GROUPS
   ============================================================ */
.khs-group { margin-top: 24px; }

.khs-group__title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--khs-group-title-clr);
  text-transform: uppercase;
  margin: 0 0 4px;
  padding: 0 0 8px;
}

/* Extra articles (8th onward) animate in/out on toggle */
.khs-group .khs-article-wrap:nth-of-type(n+8) {
  overflow: hidden;
  max-height: 120px;
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.25s ease 0.05s, transform 0.25s ease, background 0.15s;
}
.khs-group.is-collapsed .khs-article-wrap:nth-of-type(n+8) {
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: max-height 0.3s ease, opacity 0.2s ease, transform 0.2s ease;
}

.khs-group__viewall {
  margin-top: 10px;
  background: none;
  border: none;
  padding: 4px 0;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--khs-group-title-clr);
  cursor: pointer;
}
.khs-group__viewall:hover { text-decoration: underline; }

/* ============================================================
   ARTICLE ROWS
   ============================================================ */
.khs-article-wrap {
  display: flex;
  flex-direction: row;
  align-items: center;
  position: relative;
  border-radius: 8px;
  margin: 0 -10px;
  padding: 0 10px;
  transition: background 0.15s;
}
.khs-article-wrap:hover { background: #f0ebfd; }

.khs-article {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  text-decoration: none;
  min-height: 38px;
  flex: 1;
  min-width: 0;
}

.khs-article__chevron {
  flex-shrink: 0;
  color: var(--Core-Violet);
  display: flex;
  align-items: center;
  margin-top: 1px;
}

.khs-article__title {
  flex: 1;
  font-size: 14px;
  font-weight: 400;
  color: var(--Core-Dark-Violet);
  line-height: 1.4;
}

/* ============================================================
   RECHARGE BADGE + TOOLTIP  (violet theme only)
   ============================================================ */
.khs-recharge {
  position: relative;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 12px;
}

.khs-recharge__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px 3px 8px;
  border: 1.5px solid #2D7A5E;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #2D7A5E;
  background: #EAF5F0;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s;
  font-family: 'Poppins', sans-serif;
}
.khs-recharge:hover .khs-recharge__badge { background: #d8ede6; }

.khs-recharge__tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 260px;
  background: var(--Core-Dark-Violet);
  border-radius: 12px;
  padding: 14px 16px 16px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(40, 23, 82, 0.35);
}
.khs-recharge__tooltip.is-open { display: block; }

.khs-recharge__tooltip-arrow {
  position: absolute;
  bottom: -7px;
  right: 22px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 7px solid var(--Core-Dark-Violet);
}

.khs-recharge__tooltip-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #4CAF8A;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.khs-recharge__tooltip-text {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  line-height: 1.4;
  margin-bottom: 10px;
}

.khs-recharge__tooltip-link {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #4CAF8A;
  text-decoration: none;
  pointer-events: all;
  transition: opacity 0.15s;
}
.khs-recharge__tooltip-link:hover { opacity: 0.8; }

/* ============================================================
   RELATED SECTION  (violet theme only)
   ============================================================ */
.khs-related {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 28px;
  padding: 16px 20px;
  background: #f0faf6;
  border: 1px solid #b8ddd1;
  border-radius: 10px;
}

.khs-related__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  margin-top: 2px;
}

.khs-related__body { flex: 1; }

.khs-related__title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #2D7A5E;
  text-decoration: none;
  margin-bottom: 4px;
  transition: opacity 0.2s;
}
.khs-related__title:hover { opacity: 0.8; }

.khs-related__desc {
  font-size: 13px;
  color: var(--Core-Blue-Gray);
  margin: 0;
  line-height: 1.5;
}

/* ============================================================
   TOOLS CARD GRID
   ============================================================ */
.khs-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding-bottom: 60px;
}

.khs-tool-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e8e4f2;
  padding: 40px 28px 32px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.khs-tool-card:hover {
  border-color: var(--Core-Vivid-Orange);
  box-shadow: 0 4px 20px rgba(237, 110, 68, 0.1);
}

.khs-tool-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  margin-bottom: 20px;
  object-fit: contain;
}

.khs-tool-card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--Core-Dark-Violet);
  margin: 0 0 8px;
  line-height: 1.3;
}

.khs-tool-card__desc {
  font-size: 13px;
  color: var(--Core-Blue-Gray);
  margin: 0;
  line-height: 1.5;
}

/* ============================================================
   PULSE — SHARED CARD
   ============================================================ */
.khs-pulse-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 60px;
}

.khs-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e8e4f2;
  padding: 28px 28px 32px;
}

.khs-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.khs-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
}

.khs-card__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--Core-Dark-Violet);
  flex: 1;
}

.khs-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
  font-family: 'Poppins', sans-serif;
}

.khs-badge--amber {
  background: #FEF3C7;
  color: #D97706;
}

.khs-badge--purple {
  background: #EDE9FE;
  color: #7C3AED;
}

/* ============================================================
   PULSE — POLL
   ============================================================ */
.khs-poll__question {
  font-size: 15px;
  font-weight: 600;
  color: var(--Core-Dark-Violet);
  margin: 0 0 16px;
  line-height: 1.4;
}

.khs-poll__options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.khs-poll__option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border: 1px solid #e8e4f2;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  overflow: hidden;
}

.khs-poll__option:hover:not(.is-voted) {
  border-color: #D97706;
  background: #FFFBEB;
}

.khs-poll__option.is-selected {
  border-color: #D97706;
  background: #FFFBEB;
}

.khs-poll__option-letter {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  background: #FEF3C7;
  color: #D97706;
  z-index: 1;
}

.khs-poll__option-text {
  flex: 1;
  font-size: 14px;
  color: var(--Core-Dark-Violet);
  line-height: 1.4;
  z-index: 1;
}

.khs-poll__option-pct {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  color: #D97706;
  min-width: 36px;
  text-align: right;
  display: none;
  z-index: 1;
}

.khs-poll__bar {
  position: absolute;
  inset: 0;
  background: #FEF9EC;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.6s ease;
  display: none;
  border-radius: 10px;
}

/* After voting */
.khs-poll__options.has-voted .khs-poll__option {
  cursor: default;
  pointer-events: none;
}

.khs-poll__options.has-voted .khs-poll__option-pct { display: block; }
.khs-poll__options.has-voted .khs-poll__bar { display: block; }

/* Poll skeleton loader */
.khs-poll__skeleton { display: none; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.khs-poll-card.is-loading .khs-poll__skeleton { display: flex; }
.khs-poll-card.is-loading .khs-poll__question,
.khs-poll-card.is-loading .khs-poll__options { display: none; }

@keyframes khs-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.khs-skel {
  border-radius: 10px;
  background: linear-gradient(90deg, #ede9f8 25%, #ddd8f0 50%, #ede9f8 75%);
  background-size: 200% 100%;
  animation: khs-shimmer 1.4s ease-in-out infinite;
}
.khs-skel--question { height: 18px; width: 72%; margin-bottom: 6px; }
.khs-skel--opt      { height: 48px; width: 100%; }

/* ============================================================
   PULSE — DISCUSSION
   ============================================================ */
.khs-discussion__topic {
  font-size: 16px;
  font-weight: 700;
  color: var(--Core-Dark-Violet);
  margin: 0 0 14px;
}

.khs-discussion__question {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #F0EBFD;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--Core-Dark-Violet);
  line-height: 1.5;
  margin-bottom: 20px;
}

.khs-discussion__question svg { flex-shrink: 0; margin-top: 2px; }

.khs-featured-answer {
  background: #EDE8D6;
  border: 1px solid #D4C99A;
  border-left: 3px solid #997037;
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 24px;
}

.khs-featured-answer__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #997037;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.khs-featured-answer__quote {
  font-size: 14px;
  font-style: italic;
  color: var(--Core-Dark-Violet);
  line-height: 1.6;
  margin: 0 0 8px;
}

.khs-featured-answer__author {
  font-size: 13px;
  font-weight: 600;
  color: #997037;
}

/* ============================================================
   PULSE — FORM
   ============================================================ */
.khs-form-section {
  border-top: 1px solid #ede9f8;
  margin-top: 22px;
  padding: 22px 20px 20px;
  background: #F6F4F9;
  border-radius: 12px;
}

.khs-form__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--Core-Dark-Violet);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.khs-form__subtitle {
  font-size: 13px;
  color: var(--Core-Blue-Gray);
  margin: 0 0 18px;
  line-height: 1.6;
}

.khs-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.khs-form textarea {
  width: 100%;
  min-height: 108px;
  padding: 13px 14px;
  border: 1px solid #ddd8f0;
  border-radius: 10px;
  background: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  line-height: 1.6;
  color: var(--Core-Dark-Violet);
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
.khs-form textarea::placeholder { color: #b0a8c8; }
.khs-form textarea:focus { border-color: var(--Core-Violet); }

.khs-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.khs-form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.khs-form__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8b82a7;
}

.khs-form input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #ddd8f0;
  border-radius: 10px;
  background: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  color: var(--Core-Dark-Violet);
  outline: none;
  transition: border-color 0.15s;
}
.khs-form input[type="text"]::placeholder { color: #b0a8c8; }
.khs-form input[type="text"]:focus { border-color: var(--Core-Violet); }

.khs-form__submit {
  align-self: flex-end;
  padding: 11px 26px;
  border-radius: 10px;
  border: none;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  background: var(--Core-Dark-Violet);
  color: #fff;
}

.khs-form__submit:disabled {
  background: #d4cfe6;
  color: #fff;
  cursor: not-allowed;
}

.khs-form__submit:not(:disabled):hover { opacity: 0.85; }

.khs-form__disclaimer {
  font-size: 11px;
  color: #a89fc0;
  margin: 0;
  line-height: 1.6;
}

.khs-form__success {
  display: none;
  padding: 16px;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #166534;
  text-align: center;
}

.khs-form__success.is-visible { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .khs-container { padding: 0 20px; }

  .khs-tools-grid { grid-template-columns: 1fr; }

  .khs-card { padding: 20px 18px 24px; }
  .khs-form__row { grid-template-columns: 1fr; }
  .khs-form__submit { align-self: stretch; }

  .khs-form { display: flex; flex-direction: column; }
  .khs-form textarea { order: 3; }
  .khs-form__row { order: 1; }
  .khs-form__submit { order: 4; }
  .khs-form__disclaimer { order: 5; }

  .khs-hero__card { padding: 28px 24px; border-radius: 12px; }

  .khs-accordion__btn { padding: 16px 18px; gap: 12px; }
  .khs-accordion__content { padding: 0 18px 20px; }
  .khs-accordion__icon { width: 32px; height: 32px; }

  .khs-recharge__tooltip {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
  }
  .khs-recharge__tooltip-arrow {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (max-width: 420px) {
  .khs-recharge__badge { font-size: 9px; padding: 2px 8px 2px 6px; }
}
