/* ==========================================================================
   Sunme — News filter (G7, theo mau DIWE — o tim kiem + tab chuyen muc).
   Tone DO SUNME chu dao (khong xanh la DIWE, khong tone Videmi).
   Tab chuyen muc TU DONG tu get_categories() — khong hardcode:
   chuyen muc moi them trong wp-admin se tu hien (loai "Tin tuc" vi trung
   voi "Tat ca", loai "Uncategorized"). Ban that: moi tab la link toi
   archive cua chuyen muc do (tot cho SEO, chia se duoc URL).
   Hieu ung hover nhu mau DIWE (chu doi mau + gach chan hien dan).
   ========================================================================== */

.sunme-news-filter {
  margin-bottom: var(--space-40);
}


/* --- O tim kiem: kieu DIWE (nen nhat + nut dac), doi sang do Sunme --- */
.sunme-news-search {
  display: flex;
  align-items: center;
  gap: var(--space-16);
  max-width: 1100px;
  margin: 0 auto;
  padding: 6px 6px 6px 20px;
  background-color: var(--red-soft);
  border: 1px solid var(--red-line);
  border-radius: 12px;
  transition: border-color var(--transition-base),
    box-shadow var(--transition-base);
}

/* Focus vao o nhap: vien do dam + bong nhe. */
.sunme-news-search:focus-within {
  border-color: var(--red-mid);
  box-shadow: 0 0 0 4px rgba(192, 5, 17, 0.08);
}

.sunme-news-search-icon {
  flex: none;
  display: flex;
  color: var(--red-mid);
}

.sunme-news-search-div {
  flex: none;
  width: 1px;
  height: 24px;
  background-color: var(--red-line);
}

.sunme-news-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 17px;
  color: var(--ink-heading);
  padding: 10px 0;
}

/* G7-fix (28/11): bỏ vòng focus đỏ RIÊNG của ô nhập.
   base.css có quy tắc :focus-visible toàn cục (box-shadow
   var(--shadow-focus), vòng đỏ 4px) — trình duyệt áp nó cho ô nhập
   text ngay cả khi bấm chuột (ô nhập text luôn :focus-visible khi
   focus). Kết hợp với :focus-within của cả thanh (viền đỏ + bóng)
   sẽ thành HAI khung đỏ lồng nhau, trông như ô bị lỗi. Thanh tìm
   kiếm đã có :focus-within làm dấu hiệu focus nên ô nhập không cần
   vòng riêng nữa. */
.sunme-news-search input:focus-visible {
  box-shadow: none;
}

.sunme-news-search input::placeholder {
  color: var(--ink-muted);
}

/* An nut xoa mac dinh cua input search (WebKit) de gon nhu mau. */
.sunme-news-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.sunme-news-search-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  background: var(--grad-btn);
  border-radius: 8px;
  padding: 14px 28px;
  transition: filter var(--transition-base),
    transform var(--transition-base),
    box-shadow var(--transition-base);
}

.sunme-news-search-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}

.sunme-news-search-btn:active {
  transform: translateY(0);
}

/* --- Tab chuyen muc: kieu DIWE (chu xam, tab dang chon do + gach chan) --- */
.sunme-news-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 36px;
  margin-top: var(--space-32);
  border-bottom: 1px solid var(--line);
}

.sunme-news-cat-tab {
  position: relative;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  color: var(--ink-muted);
  padding: 0 2px 14px;
  transition: color var(--transition-base);
}

/* Gach chan cua tab: nam de len duong ke duoi (bottom -1px). */
.sunme-news-cat-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background-color: transparent;
  transition: background-color var(--transition-base);
}

/* Hover nhu mau DIWE: chu doi sang do + gach chan nhat hien ra. */
.sunme-news-cat-tab:hover {
  color: var(--red-mid);
}

.sunme-news-cat-tab:hover::after {
  background-color: var(--red-line);
}

/* Tab dang chon: chu do dam + gach chan do. */
.sunme-news-cat-tab.is-active {
  color: var(--red-mid);
  font-weight: 700;
}

.sunme-news-cat-tab.is-active::after {
  background-color: var(--red-mid);
}

.sunme-news-cat-tab.is-active:hover::after {
  background-color: var(--red-mid);
}

.sunme-news-cat-tab:focus-visible {
  outline: 2px solid var(--red-mid);
  outline-offset: 4px;
  border-radius: 4px;
}

/* --- Dong dem so bai (phu, giup thay loc dang chay) --- */
.sunme-news-count {
  margin: var(--space-16) 0 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.sunme-news-empty {
  text-align: center;
  color: var(--ink-muted);
  font-size: 17px;
  padding: var(--space-40) 0;
}

/* --- Mobile --- */
@media (max-width: 767px) {
  .sunme-news-search {
    gap: var(--space-12);
    padding: 5px 5px 5px 14px;
    border-radius: 10px;
  }

  .sunme-news-search input {
    font-size: 16px;
  }

  .sunme-news-search-btn {
    font-size: 15px;
    padding: 12px 18px;
  }

  /* Tab cuon ngang nhu mau DIWE tren mobile (khong xuong dong). */
  .sunme-news-cats {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px 28px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .sunme-news-cats::-webkit-scrollbar {
    display: none;
  }

  .sunme-news-cat-tab {
    flex: none;
    font-size: 16px;
    padding-bottom: 12px;
  }
}
