/* =========================
   Sidebar + Page Grid
========================= */

/* Two-column page layout */
.page-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 36px;
  align-items: start;
}

.page-content {
  min-width: 0; /* prevent overflow in grid */
}

/* Reset inner wrappers — layout handled by grid */
.page-content .articleWrap,
.page-content .categoryWrap {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Sticky sidebar */
.page-sidebar {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---- Sidebar card (base) ---- */
.sb-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.sb-card__head {
  padding: 14px 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sb-card__title {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- Ad banner ---- */
.sb-ad {
  display: block;
  width: 100%;
  min-height: 0;
}

/* ---- Search ---- */
.sb-search {
  padding: 14px 16px 16px;
}

.sb-search form {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--navPillBg);
}

.sb-search input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: none;
  background: transparent;
  color: var(--search-text);
  font-size: 13px;
  font-family: var(--font-base);
  outline: none;
}

.sb-search input::placeholder { color: var(--muted); }

.sb-search button {
  flex: 0 0 auto;
  height: 38px;
  width: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--searchBtnBg);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}
.sb-search button:hover { opacity: 0.85; }

/* ---- Categories ---- */
.sb-cats {
  padding: 0 0 8px;
}

.sb-cats__list {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
}

.sb-cats__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.sb-cats__item:last-child { border-bottom: none; }
.sb-cats__item:hover { background: rgba(0,0,0,0.04); }

.sb-cats__link {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  flex: 1;
}
.sb-cats__link:hover { text-decoration: underline; }

.sb-cats__count {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: 999px;
  padding: 2px 8px;
  min-width: 28px;
  text-align: center;
}

/* ---- Recent posts ---- */
.sb-recent {
  padding: 0 0 8px;
}

.sb-recent__list {
  padding: 8px 0 0;
  display: flex;
  flex-direction: column;
}

.sb-recent__item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}
.sb-recent__item:last-child { border-bottom: none; }
.sb-recent__item:hover { background: rgba(0,0,0,0.04); text-decoration: none; }

.sb-recent__thumb {
  flex: 0 0 60px;
  width: 60px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--border);
}

.sb-recent__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sb-recent__body {
  flex: 1 1 auto;
  min-width: 0;
}

.sb-recent__title {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sb-recent__cat {
  display: inline-block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- Facebook community card ---- */
.sb-fb-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: #1877F2;
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: #fff;
  transition: filter 0.15s;
}
.sb-fb-card:hover { filter: brightness(1.08); text-decoration: none; }

.sb-fb-card__icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.18);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sb-fb-card__icon svg {
  width: 22px;
  height: 22px;
}

.sb-fb-card__body {
  flex: 1 1 auto;
  min-width: 0;
}

.sb-fb-card__name {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.sb-fb-card__sub {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 2px;
  font-weight: 600;
}

.sb-fb-card__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .page-grid {
    grid-template-columns: 1fr;
  }

  .page-sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  /* On tablet: hide ad only */
  .sb-ad { display: none; }
}

@media (max-width: 640px) {
  .page-sidebar {
    grid-template-columns: 1fr;
  }
}
