/* =============================================================================
   NEWS PAGE — THG (Tallinna Humanitaargümnaasium)
   Card grid layout for /news page. All classes prefixed np-.
   ============================================================================= */

/* ── SECTION WRAPPER ─────────────────────────────────────────────────────────── */

.np-news-page {
  padding: 60px 0 80px;
}

/* ── PAGE HEADER ─────────────────────────────────────────────────────────────── */

.np-page-header {
  text-align: center;
  padding-bottom: 50px;
}

.np-page-header h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--thg-green-forest);
  position: relative;
  padding-bottom: 1rem;
  margin-bottom: 0.75rem;
}

.np-page-header h2::before {
  content: '';
  position: absolute;
  display: block;
  width: 160px;
  height: 1px;
  background: #ddd;
  bottom: 0;
  left: calc(50% - 80px);
}

.np-page-header h2::after {
  content: '';
  position: absolute;
  display: block;
  width: 48px;
  height: 3px;
  background: var(--thg-orange);
  border-radius: 2px;
  bottom: 0;
  left: calc(50% - 24px);
}

/* ── NEWS CARD ───────────────────────────────────────────────────────────────── */

.np-card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.np-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

/* Image */
.np-card__image {
  overflow: hidden;
}

.np-card__image a {
  display: block;
}

.np-card__image img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.np-card:hover .np-card__image img {
  transform: scale(1.05);
}

/* Content area */
.np-card__content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Tags */
.np-card__tags {
  margin-bottom: 10px;
}

.np-card__tags a,
.np-card__tags span {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(45, 90, 48, 0.1);
  color: var(--thg-green-forest);
  text-decoration: none;
  margin-right: 4px;
  margin-bottom: 4px;
  transition: background 0.2s ease, color 0.2s ease;
}

.np-card__tags a:hover {
  background: rgba(232, 114, 12, 0.1);
  color: var(--thg-orange);
}

/* Title */
.np-card__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--thg-green-forest);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.np-card__title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.np-card__title a:hover {
  color: var(--thg-orange);
}

/* Excerpt */
.np-card__excerpt {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.6;
  margin-bottom: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Meta (date) — pushed to bottom */
.np-card__meta {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #f0f0f0;
}

.np-card__date {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  color: #999;
}

.np-card__date i {
  margin-right: 6px;
  font-size: 0.85rem;
  color: var(--thg-orange);
}

/* ── PAGINATION ──────────────────────────────────────────────────────────────── */

.np-pagination {
  margin-top: 40px;
  text-align: center;
}

.np-pagination .pager__items {
  display: flex;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 6px;
}

.np-pagination .pager__item a,
.np-pagination .pager__item span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #ddd;
  color: #333;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.np-pagination .pager__item a:hover {
  background: rgba(232, 114, 12, 0.1);
  border-color: rgba(232, 114, 12, 0.3);
  color: var(--thg-orange);
}

.np-pagination .pager__item--active a,
.np-pagination .pager__item--active span,
.np-pagination .pager__item.is-active a,
.np-pagination .pager__item.is-active span {
  background: var(--thg-orange);
  border-color: var(--thg-orange);
  color: white;
}

/* ── EMPTY STATE ─────────────────────────────────────────────────────────────── */

.np-empty {
  text-align: center;
  padding: 60px 20px;
  color: #888;
  font-size: 1.05rem;
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
  .np-news-page {
    padding: 40px 0 60px;
  }

  .np-page-header {
    padding-bottom: 30px;
  }

  .np-page-header h2 {
    font-size: 1.6rem;
  }

  .np-card__image img {
    height: 180px;
  }
}

/* ── DARK MODE ───────────────────────────────────────────────────────────────── */

[data-bs-theme="dark"] .np-page-header h2 {
  color: #a8d5aa;
}

[data-bs-theme="dark"] .np-page-header h2::before {
  background: #2a3a2c;
}

/* Card */
[data-bs-theme="dark"] .np-card {
  background: #1c2b1e;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .np-card__title {
  color: #a8d5aa;
}

[data-bs-theme="dark"] .np-card__title a:hover {
  color: var(--thg-orange);
}

[data-bs-theme="dark"] .np-card__excerpt {
  color: #9ab09b;
}

[data-bs-theme="dark"] .np-card__meta {
  border-top-color: #243024;
}

[data-bs-theme="dark"] .np-card__date {
  color: #6b8b6d;
}

/* Tags — dark mode */
[data-bs-theme="dark"] .np-card__tags a,
[data-bs-theme="dark"] .np-card__tags span {
  background: rgba(45, 90, 48, 0.25);
  color: #8bc98e;
}

[data-bs-theme="dark"] .np-card__tags a:hover {
  background: rgba(232, 114, 12, 0.2);
  color: var(--thg-orange);
}

/* Pagination — dark mode */
[data-bs-theme="dark"] .np-pagination .pager__item a,
[data-bs-theme="dark"] .np-pagination .pager__item span {
  border-color: #2a3a2c;
  color: #9ab09b;
}

[data-bs-theme="dark"] .np-pagination .pager__item a:hover {
  background: rgba(232, 114, 12, 0.15);
  border-color: rgba(232, 114, 12, 0.3);
  color: var(--thg-orange);
}

[data-bs-theme="dark"] .np-empty {
  color: #6b8b6d;
}

/* =============================================================================
   SIDEBAR — News page (np-sidebar-*)
   Search, categories, sidebar logos. Adapted from events ep-sidebar-* pattern.
   ============================================================================= */

/* ── Sidebar item (shared card style) ─────────────────────────────────────── */

.np-sidebar-item {
  background: white;
  padding: 24px;
  border-radius: 10px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.06);
  margin-bottom: 24px;
}

.np-sidebar-item h4 {
  margin-bottom: 18px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--thg-green-forest);
  position: relative;
  padding-bottom: 12px;
}

.np-sidebar-item h4::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: var(--thg-orange);
  border-radius: 2px;
}

/* ── Sidebar: Search ──────────────────────────────────────────────────────── */

.np-search-input-group {
  position: relative;
}

.np-search-input-group .form-control {
  border-radius: 50px;
  padding-right: 52px;
  height: 48px;
  border: 1px solid #ddd;
  font-size: 0.9rem;
  transition: border-color 0.3s ease;
}

.np-search-input-group .form-control:focus {
  box-shadow: none;
  border-color: rgba(232, 114, 12, 0.5);
}

.np-search-btn {
  position: absolute;
  right: 0;
  top: 0;
  height: 48px;
  width: 48px;
  z-index: 5;
  border-radius: 50%;
  background: var(--thg-orange);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.3s ease;
}

.np-search-btn:hover {
  background: var(--thg-green-forest);
}

/* Clear search button (X icon) */
.np-search-clear {
  position: absolute;
  right: 52px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #ddd;
  color: #555;
  text-decoration: none;
  font-size: 0.75rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.np-search-clear:hover {
  background: #c00;
  color: white;
}

.np-search-input-group .form-control:has(~ .np-search-clear) {
  padding-right: 88px;
}

/* ── Sidebar: Categories ──────────────────────────────────────────────────── */

.np-sidebar-categories ul {
  margin: 0;
  padding: 0;
}

.np-sidebar-categories li {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.np-sidebar-categories li:last-child {
  border-bottom: none;
}

.np-sidebar-categories a {
  display: block;
  color: #333;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.np-sidebar-categories a:hover,
.np-sidebar-categories a.active {
  color: var(--thg-orange);
  font-weight: 600;
}

/* ── Sidebar: Logos ────────────────────────────────────────────────────────── */

.np-sidebar-logos__edit {
  font-size: 0.8rem;
  margin-left: 8px;
  color: #999;
  text-decoration: none;
}

.np-sidebar-logos__edit:hover {
  color: var(--thg-orange);
}

.np-sidebar-logos__item {
  text-align: center;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.np-sidebar-logos__item:last-child {
  border-bottom: none;
}

.np-sidebar-logos__item img {
  max-width: 100%;
  height: auto;
  object-fit: contain;
  filter: grayscale(30%);
  opacity: 0.85;
  transition: filter 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
  vertical-align: middle;
}

.np-sidebar-logos__item a:hover img,
.np-sidebar-logos__item img:hover {
  filter: grayscale(0%);
  opacity: 1;
  transform: scale(1.05);
}

/* Link reset — override style.css animated-underline selectors */
.np-sidebar-logos a,
.np-sidebar-logos__item a {
  background-image: none !important;
  background-size: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: none !important;
  color: inherit !important;
  text-decoration: none !important;
  display: inline-block;
}

.np-sidebar-logos a:hover,
.np-sidebar-logos__item a:hover {
  background-image: none !important;
  background-size: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: none !important;
  text-decoration: none !important;
}

/* ── SIDEBAR — Dark mode ──────────────────────────────────────────────────── */

[data-bs-theme="dark"] .np-sidebar-item {
  background: #1c2b1e;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .np-sidebar-item h4 {
  color: #a8d5aa;
}

[data-bs-theme="dark"] .np-search-input-group .form-control {
  background: #141f16;
  border-color: #2a3a2c;
  color: #c8d8c9;
}

[data-bs-theme="dark"] .np-search-input-group .form-control::placeholder {
  color: #6b8b6d;
}

[data-bs-theme="dark"] .np-sidebar-categories li {
  border-bottom-color: #243024;
}

[data-bs-theme="dark"] .np-sidebar-categories a {
  color: #9ab09b;
}

[data-bs-theme="dark"] .np-sidebar-categories a:hover,
[data-bs-theme="dark"] .np-sidebar-categories a.active {
  color: var(--thg-orange);
}

[data-bs-theme="dark"] .np-sidebar-logos__item {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="dark"] .np-sidebar-logos__item img {
  filter: grayscale(30%) brightness(0.9);
  opacity: 0.8;
}

[data-bs-theme="dark"] .np-sidebar-logos__item a:hover img,
[data-bs-theme="dark"] .np-sidebar-logos__item img:hover {
  filter: grayscale(0%) brightness(1);
  opacity: 1;
}

[data-bs-theme="dark"] .np-sidebar-logos a,
[data-bs-theme="dark"] .np-sidebar-logos__item a {
  background-image: none !important;
  background-size: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: none !important;
  color: inherit !important;
  text-decoration: none !important;
}

[data-bs-theme="dark"] .np-sidebar-logos__edit {
  color: #6b8b6d;
}

/* ── SIDEBAR — Responsive ─────────────────────────────────────────────────── */

@media (max-width: 991.98px) {
  .np-sidebar {
    margin-top: 40px;
  }

  .np-sidebar-logos__list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 1.5rem;
  }

  .np-sidebar-logos__item {
    border-bottom: none;
    padding: 0.5rem;
  }

  .np-sidebar-logos__item img {
    max-width: 120px;
    max-height: 60px;
  }
}
