html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#posts-container {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.page-container {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}
.content-wrapper {
  grid-column: span 2;
  width: 100%;
}
.sidebar {
  grid-column: span 1;
  width: 100%;
  padding-left: 0;
}

.bul-post-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 20px !important;
  flex: 1;
  margin-bottom: 20px;
  justify-content: stretch !important;
  align-items: stretch !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
.post-title {
  max-width: 1200px;
  margin: 0 auto;
}

.post-card {
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 5px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
  height: 270px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0 !important;
  max-width: 100% !important;
}
.post-card img {
  width: 100%;
  height: 60%;
  object-fit: cover;
  flex-shrink: 0;
}
.card-content {
  padding: 0;
  margin: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card-title {
  margin-bottom: 5px;
  display: block;
  padding-top: 10px;
  flex: 1;
  overflow: hidden;
}
.card-title a {
  text-decoration: none;
  color: #7a7a7a;
  font-size: 18px;
  font-family: Inter, Sans-serif;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  line-height: 1.2;
}
.card-date {
  font-family: Inter, Sans-serif;
  color: #7a7a7a;
  align-self: flex-end;
  font-size: 14px;
  margin-bottom: 0px;
  flex-shrink: 0;
  max-width: 100%;
}
.card-image {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
  display: block;
}

/*
.pagination {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
}
.pagination a,
.pagination .current {
  padding: 5px 10px;
  text-decoration: none;
  color: #333;
  background: #f5f5f5;
  border-radius: 5px;
}
.pagination .current {
  background: #007bff;
  color: white;
}
*/

.pagination {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
  justify-content: center;
  margin-top: 40px;
}

.pagination .page-link {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
}

.pagination .page-link.current {
  background: #007bff;
  color: #fff;
  font-weight: bold;
}

.pagination .page-ellipsis {
  padding: 6px 10px;
  color: #666;
}
.pagination a:hover {
  background: #e0e0e0;
}

/* === SEARCH BOX — VISIBLE & STYLED === */
.search-wrapper {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px 10px;
  height: 70px;
  margin-bottom: 20px;
}
.search-form form {
  display: flex;
  margin-bottom: 20px;
}
.search-form input {
  flex: 1;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 5px 0 0 5px;
}
.search-form button {
  width: 90px;
  padding: 5px 10px;
  background: #2c85dd;
  color: #fff;
  border: 1px solid #007bff;
  border-radius: 0 5px 5px 0;
  cursor: pointer;
}

.page-container .sidebar.ready .search-wrapper {
  margin-top: 105px;
}

.sidebar-title {
  font-size: 1.1em;
  margin-bottom: 10px;
  color: #333;
  margin-left: 10px;
  margin-top: 10px;
}
.sidebar-categories-wrapper,
.sidebar-tags-wrapper {
  border: 1px solid #ddd;
  border-radius: 8px;
}

.category-list,
.tags-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.category-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
}
.category-link,
.tags-link {
  display: block;
  padding: 8px 12px;
  color: #7a7a7a;
  text-decoration: none;
  font-family: Inter, sans-serif;
  font-size: 13px;
}
.category-link.active {
  color: #2c85dd;
  font-weight: bold;
}
.category-link:hover {
  color: #2c85dd;
  text-decoration: underline;
}

.tags-link.active {
  color: #fff;
  background-color: #2c85dd;
  font-weight: bold;
}
.tags-link:hover {
  color: #fff;
  background-color: #2c85dd;
  text-decoration: underline;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}
.tags-link {
  white-space: nowrap;
  padding: 6px 12px;
  border: 1px solid #ededed;
  border-radius: 3px;
  background: #fff;
  line-height: 1.4;
  text-align: center;
  transition: all 0.2s ease;
  margin-left: 10px;
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .page-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 10px;
  }

  .content-wrapper {
    order: 1;
    width: 100%;
  }

  .bul-post-grid {
    grid-template-columns: 1fr !important;
  }

  .post-card {
    height: auto;
  }

  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
  }

  .pagination a,
  .pagination .current {
    font-size: 14px;
    padding: 4px 8px;
  }

  .sidebar {
    order: 2;
    width: 100%;
  }
  .sidebar-title {
    padding-left: 10px !important;
    padding-top: 10px !important;
  }

  .post-comments {
    order: 3;
    width: 100%;
    margin-top: 20px;
  }

  .search-wrapper {
    margin-top: 0px !important;
    height: 150px;
  }

  .search-form form {
    flex-direction: column !important;
    gap: 10px;
  }

  .search-form input[type="search"] {
    width: 100% !important;
    border-radius: 8px !important;
    border: 1px solid #ddd !important;
  }

  .search-form button {
    width: 100% !important;
    border-radius: 8px !important;
    padding: 12px !important;
    font-weight: 600;
  }

  .category-list {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .category-link {
    padding: 10px 8px !important;
    font-size: 14px !important;
    text-align: left;
  }
}

/* === FIX BREADCRUMBS LEFT-ALIGNED WITH POSTS ON ALL SCREENS === */
#div_breadcrumbs {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.header_breadcrumbs {
  margin: 0 !important;
  padding: 0 !important;
  text-align: left !important;
}

/* Mobile: Adjust padding to match posts' mobile padding */
@media (max-width: 768px) {
  #div_breadcrumbs {
    padding: 0 10px !important;
  }
}

@media (max-width: 768px) {
  #posts-container {
    grid-template-columns: 1fr;
  }
}

/* === ENFORCE GRID LAYOUT ON ALL BLOG ROUTES === */
body[class*="blog"] .page-container {
  display: grid !important;
  grid-template-columns: 2fr 1fr !important;
  gap: 40px !important;
  align-items: start !important;
  max-width: 1200px !important;
  margin: 0 auto !important;
  padding: 20px !important;
}

/* Ensure sidebar doesn't stretch full width */
body[class*="blog"] .content-wrapper {
  grid-column: 1 / 2 !important;
}
body[class*="blog"] .sidebar {
  grid-column: 2 / 3 !important;
  width: 100% !important;
}

/* ======================= */
/*    latest posts   */
.sidebar-latest-wrapper {
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-top: 20px;
  padding-bottom: 10px;
}

.sidebar-latest-posts-wrapper {
  margin-top: 20px;
  padding: 0;
  background: transparent;
  border: none;
}

.bul-latest-posts {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: Inter, sans-serif;
}

.bul-post-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  transition: background 0.2s;
  padding-left: 10px;
  padding-right: 10px;
}

.bul-post-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.load-single-post {
  display: inline-flex;
}

.bul-post-thumb-wrapper {
  flex-shrink: 0;
  width: 70px;
  height: 70px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.bul-post-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bul-post-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding-left: 10px;
}

.bul-post-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: #222;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bul-post-title:hover {
  color: #1976d2;
}

.bul-post-date {
  font-size: 13px;
  color: #777;
  font-weight: 400;
}

/* === MOBILE FIX: ONE COLUMN LAYOUT === */
@media (max-width: 768px) {
  body[class*="blog"] .page-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
    padding: 10px !important;
  }

  body[class*="blog"] .content-wrapper {
    order: 1 !important;
    width: 100% !important;
  }

  #posts-container {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .sidebar {
    order: 2 !important;
    width: 100% !important;
  }

  .pagination {
    order: 3 !important;
    justify-content: center !important;
  }
}
