/* Custom Post Grid Styles */
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");

.custom-post-grid-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: "Roboto", sans-serif;
}

/* Filters */
.post-grid-filters {
  margin-bottom: 30px;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
}

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input,
.tag-filter,
.sort-filter {
  flex: 1;
  min-width: 200px;
  padding: 12px 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  line-height: 1.5;
  box-sizing: border-box;
}

/* Fix: high-specificity override to beat theme styles on select elements */
.custom-post-grid-wrapper select.tag-filter,
.custom-post-grid-wrapper select.sort-filter {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  overflow: visible !important;
  height: auto !important;
  max-height: none !important;
  line-height: normal;
  padding: 12px 36px 12px 15px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='14' height='14'%3E%3Cpath fill='%23666' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.filter-button,
.reset-button {
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-family: "Roboto", sans-serif;
  text-decoration: none;
  display: inline-block;
  line-height: 1.5;
}

.filter-button {
  background: #5724d0;
  color: white;
}

.filter-button:hover {
  background: #3d18a8;
}

.reset-button {
  background: #ddd;
  color: #333;
}

.reset-button:hover {
  background: #ccc;
}

/* Grid Layout */
.post-grid {
  display: grid;
  gap: 30px;
  margin-bottom: 30px;
}

.post-grid[data-columns="2"] {
  grid-template-columns: repeat(2, 1fr);
}

.post-grid[data-columns="3"] {
  grid-template-columns: repeat(3, 1fr);
}

.post-grid[data-columns="4"] {
  grid-template-columns: repeat(4, 1fr);
}

/* Responsive */
@media (max-width: 768px) {
  .post-grid {
    grid-template-columns: 1fr !important;
  }

  .filter-row {
    flex-direction: column;
  }

  .search-input,
  .tag-filter,
  .sort-filter {
    width: 100%;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .post-grid[data-columns="3"],
  .post-grid[data-columns="4"] {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Post Card */
.post-grid-item {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.post-grid-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.post-thumbnail {
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-content {
  padding: 20px;
}

.post-title {
  margin: 0 0 10px 0;
  font-size: 20px;
  line-height: 1.4;
}

.post-title a {
  color: #333;
  text-decoration: none;
}

.post-title a:hover {
  color: #5724d0;
}

.post-meta {
  color: #666;
  font-size: 13px;
  margin-bottom: 10px;
}

.post-excerpt {
  color: #555;
  line-height: 1.6;
  margin-bottom: 15px;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 15px;
}

.post-tags .tag {
  background: #f0f0f0;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: #666;
}

.read-more {
  color: #5724d0;
  text-decoration: none;
  font-weight: 500;
}

.read-more:hover {
  color: #3d18a8;
  text-decoration: underline;
}

/* No posts message */
.no-posts {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 16px;
}

/* Pagination */
.post-grid-pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}

.page-number {
  padding: 8px 15px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
}

.page-number:hover {
  background: #f0f0f0;
}

.page-number.current {
  background: #5724d0;
  color: white;
  border-color: #5724d0;
}
