/* ================== Container ================== */
.news-section {
  max-width: 1600px;
  margin: 30px auto;
  padding: 0 20px;
  font-family: 'Kanit', sans-serif;
}

/* ================== Header ================== */
.news-section h1 {
  font-weight: 700;
  font-size: 2.4rem;
  text-align: center;
  padding: 25px 0 15px;
  background: linear-gradient(90deg, #2e7d32, #c0a040);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  user-select: none;
  letter-spacing: 0.03em;
}

/* ================== Controls ================== */
.controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  font-family: 'Kanit', sans-serif;
}
#searchInput {
  width: 300px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  font-family: 'Kanit', sans-serif;
  transition: border-color 0.3s;
}
#searchInput:focus {
  outline: none;
  border-color: #2e7d32;
}
#sortSelect {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 1rem;
  cursor: pointer;
  font-family: 'Kanit', sans-serif;
}

/* ================== Tabs ================== */
.news-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 28px;
  border-bottom: 2px solid #eee;
  margin-bottom: 32px;
  font-family: 'Kanit', sans-serif;
}
.tab-btn {
  font-family: 'Kanit', sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
  padding: 14px 22px;
  background: none;
  border: none;
  color: #888;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.tab-btn:hover {
  color: #2e7d32;
}
.tab-btn.active {
  color: #c0a040;
  border-bottom-color: #c0a040;
}

/* ================== Slider ================== */
.slider {
  display: flex;
  overflow-x: auto;
  gap: 20px;
  padding-bottom: 12px;
  scroll-behavior: smooth;
  min-height: 300px;
}
.slider::-webkit-scrollbar {
  height: 10px;
}
.slider::-webkit-scrollbar-thumb {
  background-color: rgba(46, 125, 50, 0.45);
  border-radius: 5px;
}
.slider::-webkit-scrollbar-track {
  background: transparent;
}

/* ================== News Card ================== */
.news-card {
  background-color: #fff;
  border-radius: 0;
  box-shadow: 0 8px 24px rgba(46, 125, 50, 0.1);
  width: 400px;
  padding: 20px 20px 24px;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-break: break-word;
  transition: box-shadow 0.3s ease;
  font-family: 'Kanit', sans-serif;
}
.news-card:hover {
  box-shadow: 0 14px 36px rgba(192, 160, 64, 0.2);
}
.news-card a {
  text-decoration: none;
  color: inherit;
}
.news-card a:hover,
.news-card a:focus {
  text-decoration: underline;
}

/* News Card Image */
.news-card img {
  width: 100%;
  height: 220px;
  border-radius: 0;
  object-fit: cover;
  user-select: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* News Card Title */
.news-card h3 {
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.4;
  max-height: 4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  color: #2e7d32;
}

/* News Date */
.news-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: #c0a040;
}
.news-date .icon-calendar {
  width: 16px;
  height: 16px;
}

/* News Description Paragraph */
.news-card p {
  line-height: 1.4rem;
  max-height: 4.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

/* News Key Info */
.news-key-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: #555;
  font-family: 'Kanit', sans-serif;
}
.news-key-info > div {
  display: flex;
  justify-content: space-between;
}
.news-key-info > div > strong {
  font-weight: 600;
  position: relative;
  padding-right: 10px;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  border-radius: 12px;
  margin-left: 8px;
  vertical-align: middle;
  font-family: 'Kanit', sans-serif;
  user-select: none;
  letter-spacing: 0.03em;
}
.badge.featured {
  background: #2e7d32;
}
.badge.general {
  background: #c0a040;
}
.badge.maintenance {
  background: #2e7d32;
}
.badge.announcement {
  background: #c0a040;
}
.badge.calendar {
  background: #2e7d32;
}

/* ================== SDGs List ================== */
.news-sdgs-readmore {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.news-sdgs-readmore .sdgs-list ul {
  display: flex;
  gap: 6px;
  padding-left: 0;
  margin: 0;
  list-style: none;
}
.news-sdgs-readmore .sdgs-list ul li {
  border-radius: 0;
  width: 32px;
  height: 32px;
  overflow: hidden;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
}
.news-sdgs-readmore .sdgs-list ul li img {
  width: 100%;
  height: 100%;
  border-radius: 0;
  object-fit: cover;
  background-color: transparent;
  display: block;
}

/* ================== Footer ================== */
.news-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #eee;
  padding: 8px 0 0 0;
  font-size: 0.85rem;
  color: #666;
  gap: 8px;
  flex-wrap: nowrap;
  min-height: 32px;
}
.author-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
  min-width: 0;
}
.author-avatar {
  width: 24px;
  height: 24px;
  background-color: #2e7d32;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white;
  font-size: 16px;
  user-select: none;
}
.author-name {
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}
.post-date {
  font-size: 0.7rem;
  color: #999;
  margin: 0;
  white-space: nowrap;
}
.footer-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  justify-content: flex-end;
  min-width: 50px;
}
.footer-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  padding: 3px;
  border-radius: 6px;
  transition: background-color 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}
.footer-actions button:hover {
  color: #2e7d32;
  background-color: rgba(46, 125, 50, 0.1);
}
.footer-actions button.bookmarked {
  color: #c0a040;
  background-color: rgba(192, 160, 64, 0.1);
}
.footer-actions button.bookmarked:hover {
  background-color: rgba(192, 160, 64, 0.2);
}

/* ================== Icons ================== */
.icon-share,
.icon-like {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* ================== Tab content ================== */
.tab-content {
  display: none;
  padding-bottom: 20px;
}
.tab-content.active {
  display: block;
}

/* ================== Pagination dots ================== */
.dots {
  display: flex;
  justify-content: center;
  margin-top: 8px;
  gap: 6px;
  padding-bottom: 12px;
}
.dot {
  width: 10px;
  height: 10px;
  background-color: #ddd;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.dot.active {
  background: linear-gradient(90deg, #2e7d32, #c0a040);
}

/* ================== Modal ================== */
.share-modal {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  padding: 20px 24px;
  max-width: 320px;
  width: 100%;
  font-family: 'Kanit', sans-serif;
  z-index: 9999;
  user-select: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  opacity: 0;
  visibility: hidden;
}
.share-modal[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}
.share-modal-content {
  text-align: center;
}
.share-modal-content h2 {
  font-weight: 700;
  font-size: 1.25rem;
  color: #2e7d32;
  margin-bottom: 16px;
}
.share-buttons-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.share-btn {
  background: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #d4d7e3;
  padding: 14px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  color: #505050;
  font-weight: 600;
  font-size: 0.85rem;
  user-select: none;
}
.share-btn:hover {
  background-color: #e4ffe8;
  border-color: #2e7d32;
  color: #2e7d32;
}
.share-btn img {
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
}
.modal-close-btn {
  background: #f4f4f4;
  border-radius: 20px;
  border: none;
  padding: 8px 40px;
  font-weight: 600;
  font-size: 1rem;
  color: #777;
  cursor: pointer;
  display: block;
  margin: 0 auto;
  user-select: none;
  transition: background-color 0.3s ease;
}
.modal-close-btn:hover {
  background-color: #ddd;
}

/* ================== Toast Notification ================== */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #2e7d32;
  color: #fff;
  padding: 12px 20px;
  border-radius: 30px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 10000;
}
.toast.show {
  opacity: 1;
  pointer-events: auto;
}

/* ================== Responsive ================== */
@media (max-width: 920px) {
  .news-card {
    width: 100%;
    margin-right: 0;
    margin-bottom: 18px;
  }
}
@media (max-width: 480px) {
  .news-tabs {
    gap: 16px;
  }
  .tab-btn {
    font-size: 1rem;
    padding: 12px 18px;
  }
  .news-card {
    width: 100%;
    margin-bottom: 22px;
  }
}
/* ================== Dark Mode ================== */
body.dark-mode {
  background: #121212;
  color: #e0e0e0;
}

/* Container */
body.dark-mode .news-section {
  background: transparent;
  color: #ddd;
}

/* Header */
body.dark-mode .news-section h1 {
  background: linear-gradient(90deg, #2e7d32, #c0a040);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Controls */
body.dark-mode #searchInput {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #eee;
}
body.dark-mode #searchInput:focus {
  border-color: #2e7d32;
}
body.dark-mode #sortSelect {
  background: #1a1a1a;
  border: 1px solid #333;
  color: #eee;
}

/* Tabs */
body.dark-mode .news-tabs {
  border-bottom: 2px solid #333;
}
body.dark-mode .tab-btn {
  color: #aaa;
}
body.dark-mode .tab-btn:hover {
  color: #2e7d32;
}
body.dark-mode .tab-btn.active {
  color: #c0a040;
  border-bottom-color: #c0a040;
}

/* Slider */
body.dark-mode .slider::-webkit-scrollbar-thumb {
  background-color: rgba(192, 160, 64, 0.4);
}

/* News Card */
body.dark-mode .news-card {
  background-color: #1a1a1a;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  color: #ddd;
}
body.dark-mode .news-card:hover {
  box-shadow: 0 14px 36px rgba(192, 160, 64, 0.25);
}
body.dark-mode .news-card h3 {
  color: #c0a040;
}
body.dark-mode .news-card p {
  color: #bbb;
}

/* Date */
body.dark-mode .news-date {
  color: #c0a040;
}

/* Key Info */
body.dark-mode .news-key-info {
  color: #aaa;
}

/* Badge */
body.dark-mode .badge.featured,
body.dark-mode .badge.maintenance,
body.dark-mode .badge.calendar {
  background: #2e7d32;
}
body.dark-mode .badge.general,
body.dark-mode .badge.announcement {
  background: #c0a040;
}

/* Footer */
body.dark-mode .news-footer {
  border-top: 1px solid #333;
  color: #aaa;
}
body.dark-mode .author-avatar {
  background: #2e7d32;
  color: #fff;
}
body.dark-mode .post-date {
  color: #777;
}
body.dark-mode .footer-actions button {
  color: #999;
}
body.dark-mode .footer-actions button:hover {
  color: #2e7d32;
  background-color: rgba(46,125,50,0.1);
}
body.dark-mode .footer-actions button.bookmarked {
  color: #c0a040;
  background-color: rgba(192,160,64,0.1);
}
body.dark-mode .footer-actions button.bookmarked:hover {
  background-color: rgba(192,160,64,0.2);
}

/* Pagination Dots */
body.dark-mode .dot {
  background-color: #555;
}
body.dark-mode .dot.active {
  background: linear-gradient(90deg, #2e7d32, #c0a040);
}

/* Modal */
body.dark-mode .share-modal {
  background: #1a1a1a;
  color: #eee;
  border: 1px solid rgba(192,160,64,0.25);
}
body.dark-mode .share-modal-content h2 {
  color: #c0a040;
}
body.dark-mode .share-btn {
  background: #121212;
  border: 1px solid #333;
  color: #ccc;
}
body.dark-mode .share-btn:hover {
  background-color: #1b5e20;
  border-color: #2e7d32;
  color: #fff;
}
body.dark-mode .modal-close-btn {
  background: #222;
  color: #aaa;
}
body.dark-mode .modal-close-btn:hover {
  background-color: #333;
  color: #fff;
}

/* Toast */
body.dark-mode .toast {
  background: #2e7d32;
  color: #fff;
}
