/*
 * Webber FAQ — Frontend Styles
 * Theme colours: #C9252C (primary red) · #FFDDDE (light pink)
 * ─────────────────────────────────────────────────────────────
 * --wfaq-accent       set inline by PHP (from Settings → Accent Colour)
 * --wfaq-accent-light set inline by PHP (from Settings → Light Colour)
 * --wfaq-speed        set per-wrapper by JS (from Settings → Speed)
 */

/* ═══════════════════════════════════════════════
   CSS custom-property defaults
   ═══════════════════════════════════════════════ */
:root {
  --wfaq-accent:        #C9252C;
  --wfaq-accent-hover:  #a51e24;
  --wfaq-accent-light:  #D8D8D8;
  --wfaq-text-on-accent:#ffffff;
  --wfaq-border:        #e2e2e2;
  --wfaq-bg:            #ffffff;
  --wfaq-text:          #2d2d2d;
  --wfaq-answer-text:   #4a4a4a;
  --wfaq-radius:        4px;
  --wfaq-gap:           8px;
  --wfaq-speed:         300ms;
}

/* ═══════════════════════════════════════════════
   Wrapper
   ═══════════════════════════════════════════════ */
.wfaq-wrapper {
  /*max-width: 900px;*/
  margin: 0 auto;
  font-family: inherit;
}

/* ═══════════════════════════════════════════════
   Search bar
   ═══════════════════════════════════════════════ */
.wfaq-search-wrap {
  margin-bottom: 20px;
}

.wfaq-search-inner {
  position: relative;
  display: flex;
  align-items: center;
}

.wfaq-search-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  /* left padding = space for the search icon, right padding = space for the clear button */
  padding: 11px 42px 11px 42px;
  font-size: 0.95rem;
  border: 2px solid var(--wfaq-border);
  border-radius: var(--wfaq-radius);
  background: var(--wfaq-bg);
  color: var(--wfaq-text);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.wfaq-search-input:focus {
  border-color: var(--wfaq-accent);
}

.wfaq-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

/* Search glass — LEFT side */
.wfaq-search-icon-svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
  pointer-events: none;
  line-height: 0;
  transition: color 0.2s;
}

.wfaq-search-inner:focus-within .wfaq-search-icon-svg {
  color: var(--wfaq-accent);
}

/* Clear × — RIGHT side, never overlaps the glass */
.wfaq-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  font-size: 1rem;
  padding: 4px 6px;
  line-height: 1;
  border-radius: 50%;
  transition: color 0.2s, background 0.2s;
}

.wfaq-search-clear:hover {
  color: var(--wfaq-accent);
  background: var(--wfaq-accent-light);
}

.wfaq-no-match {
  font-size: 0.88rem;
  color: #888;
  margin-top: 8px;
  font-style: italic;
}

/* ═══════════════════════════════════════════════
   FAQ Set title  (show_set_title="1")
   ═══════════════════════════════════════════════ */
.wfaq-set-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--wfaq-accent);
  margin: 20px 0 8px;
  padding: 8px 14px;
  background: var(--wfaq-accent-light);
  border-left: 4px solid var(--wfaq-accent);
  border-radius: var(--wfaq-radius);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ═══════════════════════════════════════════════
   FAQ List
   ═══════════════════════════════════════════════ */
.wfaq-list {
  display: flex;
  flex-direction: column;
  gap: var(--wfaq-gap);
}

/* ═══════════════════════════════════════════════
   FAQ Item
   ═══════════════════════════════════════════════ */
.wfaq-item {
  /*border: 1px solid var(--wfaq-border);*/
  /*border-radius: var(--wfaq-radius);*/
  /*overflow: hidden;*/
  background: var(--wfaq-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}

.wfaq-item.is-open {
  border-color: var(--wfaq-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  border-radius: 0 0 var(--wfaq-radius) var(--wfaq-radius);
}

.wfaq-item.wfaq-hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════
   Question button — CLOSED (pink background)
   ═══════════════════════════════════════════════ */
.wfaq-question {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 12px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--wfaq-text);
  background: var(--wfaq-accent-light);
  border: none;
  cursor: pointer;
  line-height: 1.45;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  outline: none;
  transition: background-color 0.2s, color 0.2s;
  border-radius: var(--wfaq-radius);
}

.wfaq-question:hover {
  color: var(--wfaq-text-on-accent);
  background: var(--wfaq-accent);
  /*border-radius: var(--wfaq-radius);*/
}

.wfaq-question:focus-visible {
  outline: 2px solid var(--wfaq-accent);
  outline-offset: -2px;
  /*border-radius: var(--wfaq-radius);*/
}

/* ═══════════════════════════════════════════════
   Question button — OPEN (red background)
   ═══════════════════════════════════════════════ */
.wfaq-item.is-open .wfaq-question {
  background: var(--wfaq-accent);
  color: var(--wfaq-text-on-accent);
  border-radius: var(--wfaq-radius) var(--wfaq-radius) 0 0;
}

.wfaq-question-text {
  flex: 1;
}

/* Per-item left icon */
.wfaq-item-icon {
  font-size: 1em;
  color: var(--wfaq-accent);
  flex-shrink: 0;
  transition: color 0.2s;
}

.wfaq-item.is-open .wfaq-item-icon {
  color: var(--wfaq-text-on-accent);
}

/* ═══════════════════════════════════════════════
   Toggle icon (+/−)
   Right-aligned, CSS-only, no images
   ═══════════════════════════════════════════════ */
.wfaq-toggle-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  position: absolute;
  left: -14px;
  background-color: var(--wfaq-accent);
  border-radius: 13px;
  border: 2px solid #FFFFFF;
}

.wfaq-item.is-open .wfaq-toggle-icon {
  background-color: var(--wfaq-accent-light);
}

  /* ── Plus / Minus ─────────────────────────────── */
[data-icon="plus"] .wfaq-toggle-icon::before,
[data-icon="plus"] .wfaq-toggle-icon::after {
  content: '';
  position: absolute;
  background-color:  var(--wfaq-text-on-accent);
  border-radius: 1px;
  transition: transform var(--wfaq-speed) ease, opacity 0.2s ease, background-color 0.2s;
}

/* Horizontal bar */
[data-icon="plus"] .wfaq-toggle-icon::before {
  width: 10px;
  height: 2px;
}

/* Vertical bar — disappears to create the minus */
[data-icon="plus"] .wfaq-toggle-icon::after {
  width: 2px;
  height: 10px;
}

/* Open: turn both bars white, collapse vertical */
[data-icon="plus"] .wfaq-item.is-open .wfaq-toggle-icon::before,
[data-icon="plus"] .wfaq-item.is-open .wfaq-toggle-icon::after {
  background-color: var(--wfaq-accent);
}

[data-icon="plus"] .wfaq-item.is-open .wfaq-toggle-icon::after {
  opacity: 0;
  transform: scaleY(0);
}

/* ── Arrow ────────────────────────────────────── */
[data-icon="arrow"] .wfaq-toggle-icon::before {
  content: '';
  display: block;
  width: 9px;
  height: 9px;
  border-right: 2.5px solid var(--wfaq-accent);
  border-bottom: 2.5px solid var(--wfaq-accent);
  transform: rotate(45deg) translate(-3px, -1px);
  transition: transform var(--wfaq-speed) ease, border-color 0.2s;
}

[data-icon="arrow"] .wfaq-item.is-open .wfaq-toggle-icon::before {
  border-color: var(--wfaq-text-on-accent);
  transform: rotate(-135deg) translate(-3px, -1px);
}

/* ── Chevron ──────────────────────────────────── */
[data-icon="chevron"] .wfaq-toggle-icon::before {
  content: '';
  display: block;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--wfaq-accent);
  border-bottom: 2px solid var(--wfaq-accent);
  border-radius: 1px;
  transform: rotate(45deg) translate(-3px, -1px);
  transition: transform var(--wfaq-speed) ease, border-color 0.2s;
}

[data-icon="chevron"] .wfaq-item.is-open .wfaq-toggle-icon::before {
  border-color: var(--wfaq-text-on-accent);
  transform: rotate(-135deg) translate(-3px, -1px);
}

/* ── None ─────────────────────────────────────── */
[data-icon="none"] .wfaq-toggle-icon {
  display: none;
}

/* ── Custom HTML ──────────────────────────────── */
[data-icon="custom"] .wfaq-toggle-icon {
  color: var(--wfaq-accent);
  transition: color 0.2s;
}

[data-icon="custom"] .wfaq-item.is-open .wfaq-toggle-icon {
  color: var(--wfaq-text-on-accent);
}

/* ═══════════════════════════════════════════════
   Answer panel
   JS controls display:none / display:block and
   inline height / opacity transitions.
   The [hidden] rule is the no-JS / SSR fallback.
   ═══════════════════════════════════════════════ */
.wfaq-answer[hidden] {
  display: none !important;
}

/* ═══════════════════════════════════════════════
   Answer content area
   ═══════════════════════════════════════════════ */
.wfaq-answer-inner {
  padding: 16px 20px 20px;
  background: var(--wfaq-bg);
  /*border-top: 2px solid var(--wfaq-accent-light);*/
  color: var(--wfaq-answer-text);
  font-size: 0.93rem;
  line-height: 1.75;
  border-radius: 0 0 var(--wfaq-radius) var(--wfaq-radius);
}

.wfaq-answer-inner > *:first-child { margin-top: 0; }
.wfaq-answer-inner > *:last-child  { margin-bottom: 0; }

/* ── Lists (ul / ol / li) ─────────────────────── */
.wfaq-answer-inner ul,
.wfaq-answer-inner ol {
  padding-left: 1.5em;
  margin: 8px 0;
}

.wfaq-answer-inner ul {
  list-style-type: disc;
}

.wfaq-answer-inner ol {
  list-style-type: decimal;
}

.wfaq-answer-inner li {
  margin-bottom: 6px;
  padding-left: 2px;
}

.wfaq-answer-inner li:last-child {
  margin-bottom: 0;
}

/* Nested lists */
.wfaq-answer-inner ul ul,
.wfaq-answer-inner ol ol,
.wfaq-answer-inner ul ol,
.wfaq-answer-inner ol ul {
  margin: 4px 0 4px 1em;
}

/* ── Typography ───────────────────────────────── */
.wfaq-answer-inner a {
  color: var(--wfaq-accent);
  text-decoration: underline;
}

.wfaq-answer-inner a:hover {
  color: var(--wfaq-accent-hover);
}

.wfaq-answer-inner strong,
.wfaq-answer-inner b {
  color: var(--wfaq-text);
  font-weight: 700;
}

.wfaq-answer-inner img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 10px auto;
}

.wfaq-answer-inner center {
  display: block;
  text-align: center;
}

/* ═══════════════════════════════════════════════
   No-results message
   ═══════════════════════════════════════════════ */
.wfaq-no-results {
  text-align: center;
  color: #888;
  padding: 32px;
  background: var(--wfaq-bg);
  border: 1px dashed var(--wfaq-border);
  border-radius: var(--wfaq-radius);
}

/* ═══════════════════════════════════════════════
   Accessibility — reduce motion
   JS reads --wfaq-speed:0ms to skip animations
   ═══════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .wfaq-wrapper {
    --wfaq-speed: 0ms;
  }
  .wfaq-toggle-icon::before,
  .wfaq-toggle-icon::after,
  .wfaq-item,
  .wfaq-question {
    transition: none !important;
  }
}

/* ═══════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════ */
@media (max-width: 600px) {
  .wfaq_question {
    padding: 12px 14px;
    font-size: 0.84rem;
  }

  .wfaq-answer-inner {
    padding: 12px 14px 16px;
    font-size: 0.9rem;
  }

  .wfaq-answer-inner ul,
  .wfaq-answer-inner ol {
    padding-left: 1.2em;
  }
}
