.news-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 15px;
  margin-top: 20px;
  align-items: start;
}

.news-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  padding: 15px 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  height: 600px;
  max-height: 600px;
}

.news-image img {
  width: 100%;
  min-height: 200px;
  display: block;
  object-fit: cover;
  border-radius: 10px;
  max-height: 250px;
}

.news-image {
  margin-bottom: 15px;
  height: 200px;
  overflow: hidden;
  border-radius: 8px;
}

.news-card:hover .news-image img {
  transition: transform 0.4s ease-in-out;
  transform: scale(1.03);
}

.news-card:hover {
  background: rgba(0, 0, 200, 0.1);
}

.news-card h2 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  font-weight: bold;
  word-wrap: break-word;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.news-card a {
  display: inline-block;
  margin-top: 10px;
  color: blue;
  font-weight: bold;
  text-decoration: none;
}

.news-card a:hover {
  color: darkblue;
}

.post-content {
  flex-grow: 1;
  margin-bottom: 15px;
  overflow: visible;
  display: block;
}

.news-meta {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.header-search-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0 0.5rem;
}

.header-search-wrapper h1 {
  font-size: 2rem;
  margin: 0;
  flex: 1 1 auto;
  line-height: 1.2;
}

.search-box {
  flex: 1 1 300px;
  display: flex;
  justify-content: flex-end;
}

.search-form {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 0;
}

.search-input-group {
  display: flex;
  flex-grow: 1;
  position: relative;
  width: 100%;
}

.search-input {
  flex-grow: 1;
  padding: 12px 20px;
  border: 1px solid #ddd;
  border-radius: 30px;
  font-size: 1rem;
  font-family: 'Custom', sans-serif;
  transition: all 0.3s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  width: 100%;
}

.search-input:focus {
  outline: none;
  border-color: blue;
  box-shadow: 0 2px 10px rgba(58, 123, 213, 0.2);
}

.search-button {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: blue;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.search-button:hover {
  background: darkblue;
  transform: translateY(-50%) scale(1.05);
}

.cancel-search {
  margin-left: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: all 0.3s;
}

.cancel-search:hover {
  color: #333;
  transform: scale(1.1);
}

.search-filter-section {
  margin-bottom: 2rem;
}

.filter-box {
  padding: 1rem 1.5rem;
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 2rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.95rem;
}

.date-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.date-input {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-family: 'Custom', sans-serif;
}

.date-separator {
  color: #555;
}

.sort-select {
  height: 33px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-family: 'Custom', sans-serif;
}

.filter-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
  width: auto;
}

.apply-filters {
  padding: 8px 16px;
  background: blue;
  color: white;
  border: none;
  border-radius: 5px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Custom', sans-serif;
  transition: all 0.3s;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
    height: 40px;
}

.apply-filters:hover {
  background: darkblue;
}

.reset-filters {
  display: inline-block;
  padding: 8px 16px;
  background: white;
  color: blue;
  text-align: center;
  border: 1px solid blue;
  border-radius: 5px;
  font-weight: 500;
  font-family: 'Custom', sans-serif;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  transition: background 0.3s, color 0.3s;
    height: 40px;
}

.reset-filters:hover {
  background: #e6f0ff;
  color: darkblue;
}

.invalid-date {
  border: 2px solid red !important;
  background-color: #ffe6e6;
}

.smart-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 30px 0;
  font-size: 16px;
}

.page-arrow, .page-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 4px;
  text-decoration: none;
}

.page-arrow {
  color: blue;
  font-weight: bold;
}

.page-arrow.disabled {
  color: #ccc;
  cursor: default;
}

.page-number {
  color: #333;
  border: 1px solid #e0e0e0;
}

.page-number.current {
  background: blue;
  color: white;
  border-color: blue;
}

.page-number:hover:not(.current) {
  background: #f5f5f5;
}

.page-dots {
  padding: 0 5px;
}

@media (max-width: 768px) {
  .news-grid {
    grid-template-columns: 1fr;
  }

  .news-card {
    height: 500px;
    max-height: 500px;
  }

  .news-image {
    height: 150px;
  }

  .header-search-wrapper {
    flex-direction: column;
    align-items: stretch;
    margin: 0.5rem 0 0.5rem;
    gap: 0.5rem;
  }

  .search-box {
      display: block;
      width: 100%;
      margin-top: 5px;
      margin-bottom: 0;
      justify-content: flex-start;
      flex: none;
  }

  .search-input,
  .search-input-group {
    width: 100%;
  }

  .filter-form {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-buttons {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  .apply-filters,
  .reset-filters {
    width: 100%;
  }
}

@media (width: 820px) {
    .date-input, .sort-select {
        font-size: 0.70rem;
    }
    .apply-filters,
    .reset-filters {
        width: 60%;
    }
}

@media (max-width: 450px) {
    .date-input, .sort-select {
        font-size: 0.65rem;
    }
}

@media (max-width: 360px) {
    .date-input, .sort-select {
        font-size: 0.60rem;
    }
}