/* =========================================
   CATEGORY PAGE — FORCE VISUAL ORDER (GRID)
   HTML:
   <main>
     <h1>
     <div.term-description>
     <div.woocommerce>
   </main>
========================================= */

/* 1. Робимо main grid-контейнером */
main.site-main {
  display: grid !important;
  grid-template-columns: 1fr !important;

  /* Порядок ВІЗУАЛЬНИЙ */
  grid-template-areas:
    "title"
    "products"
    "description" !important;
}

/* 2. H1 */
main.site-main > h1 {
  grid-area: title !important;
}

/* 3. ТОВАРИ */
main.site-main > .woocommerce {
  grid-area: products !important;
}

/* 4. ОПИС */
main.site-main > .term-description {
  grid-area: description !important;

  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid #e5e5e5;
}
/* =========================================
   HIDE DEFAULT WOOCOMMERCE SORTING
========================================= */

.woocommerce-ordering,
.woocommerce-result-count {
  display: none !important;
}
/* =========================================
   CORRECT SINGLE H1 POSITION (SEO SAFE)
========================================= */

/* Grid вже є — просто міняємо порядок */
main.site-main {
  grid-template-areas:
    "products"
    "title"
    "description" !important;
}

/* H1 тепер ПІСЛЯ товарів */
main.site-main > h1 {
  grid-area: title !important;
  margin-top: 40px;
}
/* =========================================
   REMOVE H1 INSIDE TERM DESCRIPTION
========================================= */

.term-description h1 {
  display: none !important;
}
/* =========================================
   FIX WOOCOMMERCE PAGINATION LAYOUT
========================================= */

/* Контейнер пагінації */
.woocommerce-pagination {
  display: flex;
  justify-content: center;
  margin: 40px 0 0;
}

/* Список сторінок — В РЯД */
.woocommerce-pagination .page-numbers {
  display: flex !important;
  flex-direction: row !important;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

/* Кожен елемент */
.woocommerce-pagination .page-numbers li {
  display: inline-flex;
}

/* Посилання та поточна сторінка */
.woocommerce-pagination .page-numbers a,
.woocommerce-pagination .page-numbers span {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 40px;
  height: 40px;
  padding: 0 10px;

  border: 1px solid #e0e0e0;
  border-radius: 6px;

  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  color: #333;

  transition: all 0.2s ease;
}

/* Hover */
.woocommerce-pagination .page-numbers a:hover {
  background: #f5f5f5;
}

/* Поточна сторінка */
.woocommerce-pagination .page-numbers .current {
  background: #8DAC99;
  color: #fff;
  border-color: #8DAC99;
}

/* Стрілка "далі" */
.woocommerce-pagination .page-numbers .next {
  font-weight: 600;
}
/* =========================================
   CATEGORY DESCRIPTION — CLEAN TYPOGRAPHY
========================================= */

.term-description {
  max-width: 900px;              /* читабельна ширина */
  margin: 0 auto;                /* центр */
  font-size: 16px;
  line-height: 1.7;
  color: #333;
}

/* Абзаци */
.term-description p {
  margin-bottom: 18px;
}

/* Зображення */
.term-description img {
  display: block;                /* прибирає inline-зсув */
  margin: 30px auto;             /* ЦЕНТР */
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

/* Заголовки всередині опису */
.term-description h2,
.term-description h3 {
  margin: 40px 0 20px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
}

/* Якщо залишився старий aligncenter */
.term-description .aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Мобільна адаптація */
@media (max-width: 768px) {
  .term-description {
    padding: 0 16px;
    font-size: 15px;
  }

  .term-description img {
    margin: 24px auto;
  }
}
/* =========================================
   CATEGORY MAIN TITLE — CENTERED
========================================= */

main.site-main > h1 {
  text-align: center;
  max-width: 900px;
  margin: 40px auto 30px;
  line-height: 1.3;
}
/* =========================================
   CATEGORY FAQ BLOCK
========================================= */

.category-faq {
  max-width: 900px;
  margin: 0 auto 40px;
  padding: 24px 28px;
  background: #f9f9f9;
  border-radius: 12px;
}

.category-faq h3 {
  margin: 24px 0 8px;
  font-size: 18px;
}

.category-faq p {
  margin: 0 0 12px;
  line-height: 1.6;
}


/* ===============================
   CATEGORY FAQ — ACCORDION
================================ */

.category-faq {
  max-width: 900px;
  margin: 60px auto 40px;
  border-top: 1px solid #ddd;
}

.category-faq h3 {
  margin: 0;
  padding: 18px 50px 18px 20px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  background: #f6f6f6;
  border-bottom: 1px solid #ddd;
  position: relative;
}

.category-faq h3::after {
  content: "+";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  transition: transform 0.2s ease;
}

.category-faq h3.is-open::after {
  content: "–";
}

.category-faq .faq-content {
  display: none;
  padding: 18px 20px;
  line-height: 1.7;
  background: #fff;
  border-bottom: 1px solid #ddd;
}

.category-faq .faq-content p:last-child {
  margin-bottom: 0;
}
