/*
 * Pali Online v2.4.24
 * Loaded after every legacy stylesheet so no yellow/cream rule can win.
 */
/*
 * The outer background of the "10 บทเรียนยอดนิยมในช่วง" block is white.
 * Keep the purple palette on its title, tabs, cards and action buttons.
 */
body:not(.wp-admin) .pali-home-wrap .pali-popular-white-zone {
  position: relative !important;
  left: 50% !important;
  width: 100vw !important;
  max-width: 100vw !important;
  margin-left: -50vw !important;
  margin-right: -50vw !important;
  background: #ffffff !important;
  overflow: hidden !important;
}

/*
 * The page canvas around the popular block must also be white.  This removes
 * the pale-purple strips above and below the block while retaining the
 * intentionally purple member zone and controls below.
 */
body:not(.wp-admin):has(.pali-home-wrap),
body:not(.wp-admin) .pali-home-wrap {
  background: #ffffff !important;
  border-top-color: #ffffff !important;
  border-bottom-color: #ffffff !important;
}

body:not(.wp-admin) .pali-home-wrap .pali-popular-tabs {
  background: #ffffff !important;
}

body:not(.wp-admin) .pali-home-wrap .pali-popular-white-zone > .pali-popular-tabs {
  margin-bottom: 0 !important;
  padding-bottom: 44px !important;
}

body:not(.wp-admin) .pali-home-wrap .pali-member-zone {
  background: #f2eafa !important;
  border-top-color: #d9c8eb !important;
  border-bottom-color: #d9c8eb !important;
}

body:not(.wp-admin) .pali-home-wrap .pali-member-zone .pali-section-title {
  color: #67419f !important;
  border-left-color: #8e68c3 !important;
}

body:not(.wp-admin) .pali-home-wrap .pali-popular-tab:hover,
body:not(.wp-admin) .pali-home-wrap .pali-popular-tab:focus-visible,
body:not(.wp-admin) .pali-home-wrap .pali-search-suggest a:hover,
body:not(.wp-admin) .pali-home-wrap .pali-search-suggest a:focus {
  background: #eadff7 !important;
  border-color: #cdb6e7 !important;
  color: #513477 !important;
}

body:not(.wp-admin) .pali-home-wrap .pali-popular-tab.is-active {
  background: #8e68c3 !important;
  border-color: #8e68c3 !important;
  color: #ffffff !important;
}

@media (max-width: 1023px) {
  body:not(.wp-admin) .elementor-nav-menu--dropdown a:hover,
  body:not(.wp-admin) .elementor-nav-menu--dropdown a:focus,
  body:not(.wp-admin) .elementor-nav-menu--dropdown .elementor-item-active,
  body:not(.wp-admin) .ae-nav-menu__dropdown a:hover,
  body:not(.wp-admin) .ae-nav-menu__menu a:hover,
  body:not(.wp-admin) .atomic-nav-menu__dropdown a:hover,
  body:not(.wp-admin) .atomic-nav-menu__menu a:hover {
    background: #f2eafa !important;
    color: #513477 !important;
  }
}

/*
 * Search field: neutral light-grey bar and outline.
 * Keep the yellow submit button unchanged.
 */
body:not(.wp-admin) .pali-search-box .pali-search-form {
  background: #f5f6f7 !important;
  border-color: #d1d5db !important;
  box-shadow: none !important;
}

body:not(.wp-admin) .pali-search-box .pali-search-form:focus-within {
  background: #f5f6f7 !important;
  border-color: #b8bec6 !important;
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.12) !important;
}

body:not(.wp-admin) .pali-search-box .pali-search-input {
  background: transparent !important;
  color: #374151 !important;
}

body:not(.wp-admin) .pali-search-box .pali-search-input::placeholder,
body:not(.wp-admin) .pali-search-box .pali-search-icon {
  color: #9ca3af !important;
}

/* ==========================================================
   v2.4.26 — Home bottom: two videos + up to five sliding news cards
   ========================================================== */
body:not(.wp-admin) .pali-bottom-section,
body:not(.wp-admin) .pali-bottom-section * {
  box-sizing: border-box;
}

body:not(.wp-admin) .pali-bottom-section {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 34px 24px 42px;
  background: #ffffff !important;
  border: 0 !important;
  color: #34264b;
  font-family: "Sarabun", sans-serif;
}

body:not(.wp-admin) .pali-bottom-heading {
  margin: 0 0 24px;
  color: #513477 !important;
  font-size: clamp(24px, 2.2vw, 34px);
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
}

body:not(.wp-admin) .pali-bottom-row {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  align-items: stretch;
  gap: 22px !important;
  width: 100%;
  margin: 0 !important;
}

body:not(.wp-admin) .pali-bottom-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

body:not(.wp-admin) .pali-bottom-col-title {
  min-height: 48px;
  margin: 0 0 10px !important;
  color: #513477 !important;
  font-family: "Sarabun", sans-serif;
  font-size: 18px !important;
  font-weight: 600 !important;
  line-height: 1.45;
  text-align: center;
}

body:not(.wp-admin) .pali-prep-video,
body:not(.wp-admin) .pali-home-news-card {
  flex: 1;
  min-height: 230px;
  overflow: hidden;
  background: #ffffff !important;
  border: 2px solid #9575cd !important;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(81, 52, 119, .10);
}

body:not(.wp-admin) .pali-prep-video iframe,
body:not(.wp-admin) .pali-prep-video video,
body:not(.wp-admin) .pali-home-media-placeholder {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 230px;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 10px;
  object-fit: cover;
}

body:not(.wp-admin) .pali-home-media-placeholder,
body:not(.wp-admin) .pali-home-news-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(145deg, #ffffff, #f5effc) !important;
  color: #9575cd !important;
  font-size: 22px;
}

body:not(.wp-admin) .pali-home-media-placeholder .dashicons,
body:not(.wp-admin) .pali-home-news-empty .dashicons {
  width: auto;
  height: auto;
  color: #9575cd !important;
  font-size: 54px;
}

body:not(.wp-admin) .pali-home-news-card {
  display: flex;
  flex-direction: column;
  padding: 12px;
}

body:not(.wp-admin) .pali-bottom-news-col {
  padding-top: 58px;
}

body:not(.wp-admin) .pali-home-news-slider {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 8px;
}

body:not(.wp-admin) .pali-home-news-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform .4s ease;
}

body:not(.wp-admin) .pali-home-news-slide {
  display: block;
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  height: 100%;
  color: #34264b !important;
  text-decoration: none !important;
}

body:not(.wp-admin) .pali-home-news-media,
body:not(.wp-admin) .pali-home-news-empty {
  width: 100%;
  min-height: 145px;
  overflow: hidden;
  border-radius: 8px;
  background: #f5effc;
}

body:not(.wp-admin) .pali-home-news-media {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

body:not(.wp-admin) .pali-home-news-media img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 145px;
  object-fit: cover;
}

body:not(.wp-admin) .pali-home-news-media .dashicons {
  width: auto;
  height: auto;
  color: #9575cd;
  font-size: 60px;
}

body:not(.wp-admin) .pali-news-arrow {
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 38px;
  height: 38px;
  padding: 0;
  transform: translateY(-50%);
  border: 1px solid rgba(255,255,255,.9) !important;
  border-radius: 50%;
  background: rgba(81,52,119,.82) !important;
  color: #ffffff !important;
  font-size: 21px;
  line-height: 36px;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0,0,0,.2);
}

body:not(.wp-admin) .pali-news-prev { left: 10px; }
body:not(.wp-admin) .pali-news-next { right: 10px; }

body:not(.wp-admin) .pali-news-dots {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 9px;
  left: 0;
  display: flex;
  justify-content: center;
  gap: 7px;
}

body:not(.wp-admin) .pali-news-dots button {
  width: 9px;
  height: 9px;
  min-width: 9px;
  min-height: 9px;
  margin: 0;
  padding: 0;
  border: 1px solid #ffffff !important;
  border-radius: 50%;
  background: rgba(255,255,255,.55) !important;
  cursor: pointer;
}

body:not(.wp-admin) .pali-news-dots button.is-active {
  background: #9575cd !important;
}

body:not(.wp-admin) .pali-home-news-all {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: auto;
  padding: 9px 14px;
  border: 1px solid #9575cd;
  border-radius: 7px;
  background: #9575cd !important;
  color: #ffffff !important;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none !important;
  transition: .2s ease;
}

body:not(.wp-admin) .pali-home-news-all:hover,
body:not(.wp-admin) .pali-home-news-all:focus {
  border-color: #9575cd;
  background: #d7c3f4 !important;
  color: #4a326f !important;
}

@media (max-width: 1023px) {
  body:not(.wp-admin) .pali-bottom-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body:not(.wp-admin) .pali-bottom-news-col {
    grid-column: 1 / -1;
    width: min(100%, 570px);
    margin: 0 auto;
    padding-top: 0;
  }
}

@media (max-width: 767px) {
  body:not(.wp-admin) .pali-bottom-section {
    padding: 28px 14px 34px;
  }

  body:not(.wp-admin) .pali-bottom-heading {
    font-size: 25px;
    text-align: center;
  }

  body:not(.wp-admin) .pali-bottom-row {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 24px !important;
  }

  body:not(.wp-admin) .pali-bottom-news-col {
    grid-column: auto;
    width: 100%;
    padding-top: 0;
  }

  body:not(.wp-admin) .pali-bottom-col-title {
    min-height: 0;
  }
}
