/* Scoped to bbPress: does not affect the rest of KLEO or BuddyPress. */
#epi-forum-ad {
  max-width: 1200px;
  margin: 8px auto 28px;
  overflow: hidden;
  border-radius: 16px;
  background: #f6f2ff;
}
#epi-forum-ad .epi-forum-ad-widget { margin: 0; padding: 0; }
#epi-forum-ad img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
#epi-forum-ad iframe { max-width: 100%; }
#epi-forum-ad p { margin: 0; }
#epi-forum-ad .epi-forum-ad-title { padding: 8px 14px; font-size: 13px; color: #756b89; }

body.epi-has-forum #bbpress-forums { color: #342e49; font-size: 15px; }
body.epi-has-forum #bbpress-forums .bbp-breadcrumb { color: #756d88; margin-bottom: 18px; }
body.epi-has-forum #bbpress-forums .bbp-forums,
body.epi-has-forum #bbpress-forums .bbp-topics,
body.epi-has-forum #bbpress-forums .bbp-replies {
  border: 1px solid #e9e2f6;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 26px rgba(76, 55, 124, .045);
}
body.epi-has-forum #bbpress-forums li.bbp-header,
body.epi-has-forum #bbpress-forums li.bbp-footer {
  background: #f4f0ff;
  color: #54476d;
  border-color: #e9e2f6;
}
body.epi-has-forum #bbpress-forums li.bbp-body ul.forum,
body.epi-has-forum #bbpress-forums li.bbp-body ul.topic {
  background: #fff;
  border-color: #eee9f7;
  transition: background .2s ease;
}
body.epi-has-forum #bbpress-forums li.bbp-body ul.forum:hover,
body.epi-has-forum #bbpress-forums li.bbp-body ul.topic:hover { background: #faf8ff; }
body.epi-has-forum #bbpress-forums a { color: #7057ca; }
body.epi-has-forum #bbpress-forums a:hover { color: #5136ac; }
body.epi-has-forum #bbpress-forums .bbp-forum-title,
body.epi-has-forum #bbpress-forums .bbp-topic-permalink { font-weight: 700; }
body.epi-has-forum #bbpress-forums .bbp-search-form {
  float: none;
  max-width: 640px;
  margin: 0 0 24px;
}
body.epi-has-forum #bbpress-forums #bbp-search-form .input-group { display: flex; width: 100%; }
body.epi-has-forum #bbpress-forums #bbp-search-form #bbp_search {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  border: 1px solid #ddd4f2;
  border-radius: 10px 0 0 10px;
  padding: 10px 14px;
  background: #fff;
  box-shadow: none;
}
body.epi-has-forum #bbpress-forums #bbp-search-form .input-group-btn { display: flex; }
body.epi-has-forum #bbpress-forums #bbp-search-form #bbp_search_submit {
  height: 44px;
  border: 0;
  border-radius: 0 10px 10px 0;
  padding: 0 20px;
  background: #806de5;
  color: #fff;
  cursor: pointer;
}
@media (max-width: 767px) {
  #epi-forum-ad { margin-bottom: 20px; border-radius: 12px; }
  body.epi-has-forum #bbpress-forums .bbp-forums,
  body.epi-has-forum #bbpress-forums .bbp-topics,
  body.epi-has-forum #bbpress-forums .bbp-replies { border-radius: 12px; }
}

/* EpiStatus v1.1 — visual fixes. Scoped to pages containing bbPress. */
body.epi-has-forum #bbpress-forums { max-width: 1200px; margin-left: auto; margin-right: auto; }
body.epi-has-forum #bbpress-forums li.bbp-header,
body.epi-has-forum #bbpress-forums li.bbp-footer,
body.epi-has-forum #bbpress-forums li.bbp-header *,
body.epi-has-forum #bbpress-forums li.bbp-footer * { color: #51416f !important; }
body.epi-has-forum #bbpress-forums li.bbp-header { background: #f0eafa !important; }
body.epi-has-forum #bbpress-forums li.bbp-footer { background: #faf8fd !important; }
body.epi-has-forum #bbpress-forums li.bbp-body ul.forum,
body.epi-has-forum #bbpress-forums li.bbp-body ul.topic { padding-top: 15px !important; padding-bottom: 15px !important; }
body.epi-has-forum #bbpress-forums .bbp-forum-content,
body.epi-has-forum #bbpress-forums .bbp-forum-content p { line-height: 1.5 !important; margin-bottom: 0 !important; }
/* Search sometimes sits outside #bbpress-forums in KLEO. */
body.epi-has-forum .bbp-search-form { float: none !important; clear: both; max-width: 620px !important; width: 100%; margin: 0 0 22px !important; padding: 0 !important; background: transparent !important; box-shadow: none !important; }
body.epi-has-forum .bbp-search-form form,
body.epi-has-forum .bbp-search-form .input-group { display: flex !important; width: 100% !important; align-items: stretch; padding: 0 !important; margin: 0 !important; background: transparent !important; box-shadow: none !important; }
body.epi-has-forum .bbp-search-form .input-group > input[type=text],
body.epi-has-forum .bbp-search-form #bbp_search { flex: 1 1 0% !important; width: 1% !important; min-width: 0 !important; height: 46px !important; margin: 0 !important; padding: 0 16px !important; border: 1px solid #ddd4f2 !important; border-radius: 11px 0 0 11px !important; box-shadow: none !important; }
body.epi-has-forum .bbp-search-form .input-group-btn { display: flex !important; position: static !important; flex: 0 0 auto !important; width: auto !important; margin: 0 !important; }
body.epi-has-forum .bbp-search-form #bbp_search_submit { position: static !important; width: auto !important; height: 46px !important; margin: 0 !important; padding: 0 23px !important; border: 0 !important; border-radius: 0 11px 11px 0 !important; background: #806de5 !important; color: #fff !important; line-height: 46px !important; }
/* Remove KLEO's large white search box only when detected by the script. */
body.epi-has-forum .epi-search-shell { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; margin-bottom: 18px !important; width: 100% !important; max-width: 1200px !important; min-height: 0 !important; }
body.epi-has-forum .epi-search-shell .bbp-search-form { margin-bottom: 0 !important; }
#epi-forum-ad { margin-bottom: 22px !important; }
@media(max-width: 640px) { body.epi-has-forum .bbp-search-form { max-width: 100% !important; } body.epi-has-forum .bbp-search-form #bbp_search_submit { padding: 0 12px !important; font-size: 13px !important; } }

/* v1.2: grid is scoped to the forum content only; never alter KLEO header. */
body.epi-has-forum .epi-forum-layout { width: min(100%, 1280px); margin: 0 auto 36px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(170px, 21%); column-gap: 24px; align-items: start; }
body.epi-has-forum .epi-forum-main { min-width: 0; grid-column: 1; }
body.epi-has-forum .epi-forum-main > #bbpress-forums { width: 100%; max-width: none; margin: 0; }
body.epi-has-forum .epi-forum-main > .bbp-search-form, body.epi-has-forum .epi-forum-main > .epi-search-shell { max-width: 100% !important; width: 100% !important; }
body.epi-has-forum .epi-forum-layout #epi-forum-ad { grid-column: 2; grid-row: 1; width: 100%; max-width: none; margin: 0 !important; padding: 0; background: transparent; border-radius: 14px; overflow: hidden; }
body.epi-has-forum .epi-forum-layout #epi-forum-ad img { display: block; width: 100%; height: auto; object-fit: contain; }
body.epi-has-forum .epi-forum-layout #epi-forum-ad iframe { width: 100%; max-width: 100%; }
body.epi-has-forum .epi-forum-layout #epi-forum-ad .epi-forum-ad-widget { width: 100%; }
body.epi-has-forum .epi-forum-layout #epi-forum-ad .epi-forum-ad-widget > a { display: block; }
body.epi-has-forum .epi-forum-layout #epi-forum-ad .epi-forum-ad-widget img { aspect-ratio: 9 / 16; object-fit: cover; }
body.epi-has-forum .epi-forum-main #bbpress-forums li.bbp-header { font-size: 13px; }
@media(max-width: 850px) {
 body.epi-has-forum .epi-forum-layout { grid-template-columns: minmax(0, 1fr); row-gap: 22px; }
 body.epi-has-forum .epi-forum-layout #epi-forum-ad { grid-column: 1; grid-row: 2; max-width: 260px; justify-self: center; }
}

/* v1.3: keep the forum/ad layout centered in the viewport, not KLEO's offset content column. */
body.epi-has-forum .epi-forum-layout {
  width: min(1200px, calc(100vw - 40px)) !important;
  max-width: none !important;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 19%) !important;
  gap: 24px !important;
}
@media (max-width: 850px) {
  body.epi-has-forum .epi-forum-layout {
    width: min(100%, calc(100vw - 24px)) !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }
}


/* v1.4.1 — scoped finishing touches; do not recolor KLEO page/footer containers. */
body.epi-has-forum .epi-forum-surface { background-color: #fff !important; }
body.epi-has-forum .epi-forum-layout { background: #fff !important; }
body.epi-has-forum #bbpress-forums li.bbp-body ul.forum,
body.epi-has-forum #bbpress-forums li.bbp-body ul.topic {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}
body.epi-has-forum #bbpress-forums .bbp-forum-content,
body.epi-has-forum #bbpress-forums .bbp-forum-content p {
  line-height: 1.42 !important;
}
/* Keep 9:16 advertising image responsive, without changing column dimensions. */
body.epi-has-forum .epi-forum-layout #epi-forum-ad { background: #f5efff; }
body.epi-has-forum .epi-forum-layout #epi-forum-ad img { border-radius: 14px; }
