/* All Posts Section */
.all-posts {
  padding: 15px 30px;
  max-width: 1200px;
  margin: 0 auto;
}

.all-posts h2 {
  font-size: 28px;
  color: var(--main-title-color);
  margin-bottom: 20px;
}

/* Filters Section */
.filters {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 30px;
  justify-content: center;
}

.filter-for-title {
  color: var(--main-title-color);
  font-style: var(--main-font-family);
  font-weight: bold;
}

.filter-for-categories {
  color: var(--main-title-color);
  font-style: var(--main-font-family);
  font-weight: bold;
}

.filter-dropdown {
  position: relative;
  border: 1px solid;
  text-align: center;
  border-radius: 27px;
  padding: 1px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  color: var(--main-green-color);
  cursor: pointer;
  background-color: transparent;
}

.filter-dropdown:focus {
  outline: none;
}

.search-articles-container {
  display: flex;
  flex-wrap: nowrap;
  flex-direction: row-reverse;
  border-radius: 25.1678px;
  border: 1px solid var(--main-title-color);
}

.search-posts-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  border: none;
  background: none;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 5px;
  transition: background-color 0.3s;
}

.search-posts-button:disabled {
  cursor: not-allowed;
}

#keyword-filter,
#search-button {
  padding: 8px;
  border: none;
  border-radius: 25.1678px;
}

#keyword-filter:focus {
  outline: none;
}

.posts-grid-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Grid Layout for Posts */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  width: 100%;
}

.post-item {
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-evenly;

  flex: 1 1 calc(33.33% - 20px); /* Adjust to ensure three cards per row, with some gap */

  border-radius: 8px;

  height: 100%; /* Ensure card takes up full height */
}

.post-item img {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.post-item h4 {
  font-size: 18px;
  margin-top: 15px;
  color: #333;
}

.post-item p {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
}

.read-more {
  color: #00873c;
  text-decoration: none;
  font-weight: bold;
}

/* Load More Button */
.load-more-btn {
  /* padding: 10px 20px; */
  margin-top: 20px;
  color: var(--main-green-color);
  border: solid 2px var(--main-green-color);
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  background-color: white;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.load-more-btn::after {
  content: "";
  display: inline-block;
  margin-left: 0.5rem;
  width: 1rem; /* Adjust size */
  height: 1rem;
  background-image: url("../assets/greenArrow.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  transition: transform 0.3s ease;
}

.load-more-btn:hover {
  background-color: #0269c9;
}

/* Spinner animation */
button.loading .button-text {
  visibility: hidden; /* Hide the button text */
}

button.loading::after {
  content: "";
  position: absolute;
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--main-green-color);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Keyframes for spin animation */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .filters {
    display: flex;
    flex-direction: column;
  }
  .all-posts h2 {
    text-align: center;
  }
}
