/**
 * News Sidebar Filters - 2026 Best Practices
 * Modern filtering system with categories, dates, and search
 */

/* ===== SIDEBAR LAYOUT ===== */
.news-content-wrapper {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

@media (max-width: 1024px) {
  .news-content-wrapper {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ===== SIDEBAR ===== */
.news-sidebar {
  position: relative; /* Changed from sticky to allow full scroll */
  top: 0;
  align-self: start;
  max-height: none;
  overflow: visible;
}

@media (max-width: 1024px) {
  .news-sidebar {
    position: relative;
    top: 0;
    max-height: none;
    overflow: visible;
  }
}

/* Scrollbar styling for sidebar */
.news-sidebar::-webkit-scrollbar {
  width: 6px;
}

.news-sidebar::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 3px;
}

.news-sidebar::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.news-sidebar::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* ===== FILTER SECTIONS ===== */
.filter-section {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  position: relative;
  z-index: 1;
}

.filter-section__title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-section__title svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

/* ===== SEARCH FILTER ===== */
.sidebar-search {
  position: relative;
}

.sidebar-search__input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.9375rem;
  transition: all 0.2s;
  background: white;
}

.sidebar-search__input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.sidebar-search__icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
}

.sidebar-search__clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.sidebar-search__input:not(:placeholder-shown) ~ .sidebar-search__clear {
  opacity: 1;
  pointer-events: all;
}

.sidebar-search__clear:hover {
  background: #dc2626;
}

/* ===== CATEGORY FILTERS ===== */
.category-filters {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.category-filter {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #f9fafb;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #374151;
  text-align: left;
  width: 100%;
  position: relative;
}

.category-filter:hover {
  background: #f3f4f6;
  transform: translateX(2px);
}

.category-filter.is-active {
  background: white;
  border-color: var(--filter-color, #3b82f6);
  color: var(--filter-color, #3b82f6);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.category-filter__indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--filter-color, #9ca3af);
  flex-shrink: 0;
  transition: transform 0.2s;
}

.category-filter.is-active .category-filter__indicator {
  transform: scale(1.3);
}

.category-filter__label {
  flex: 1;
}

.category-filter__count {
  font-size: 0.8125rem;
  color: #9ca3af;
  font-weight: 600;
  background: #f3f4f6;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.category-filter.is-active .category-filter__count {
  background: var(--filter-color, #3b82f6);
  color: white;
}

/* Category-specific colors */
.category-filter[data-category="all"] {
  --filter-color: #6b7280;
}
.category-filter[data-category="diary"] {
  --filter-color: #4A90E2;
}
.category-filter[data-category="reflection"] {
  --filter-color: #8B5CF6;
}
.category-filter[data-category="concert"] {
  --filter-color: #D4AF37;
}
.category-filter[data-category="msc"] {
  --filter-color: #E74C3C;
}
.category-filter[data-category="archive"] {
  --filter-color: #6B7280;
}

/* ===== DATE FILTERS ===== */
.date-filters {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.date-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.date-filter-group__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.date-filter-group__select {
  width: 100%;
  padding: 0.625rem 2rem 0.625rem 0.875rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.9375rem;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  position: relative;
  z-index: 10; /* Ensure dropdowns appear above other content */
}

.date-filter-group__select:hover {
  border-color: #d1d5db;
}

.date-filter-group__select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== ACTIVE FILTERS SUMMARY ===== */
.active-filters {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.active-filters__title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #1e40af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.75rem 0;
}

.active-filters__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: white;
  border: 1px solid #3b82f6;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #1e40af;
}

.active-filter-tag__remove {
  background: none;
  border: none;
  color: #3b82f6;
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 1;
  font-size: 14px;
  transition: color 0.2s;
}

.active-filter-tag__remove:hover {
  color: #ef4444;
}

.clear-all-filters {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  margin-top: 0.75rem;
  transition: all 0.2s;
}

.clear-all-filters:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: #fef2f2;
}

/* ===== MOBILE TOGGLE ===== */
.sidebar-toggle {
  display: none;
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.sidebar-toggle svg {
  transition: transform 0.3s;
}

.sidebar-toggle.is-open svg {
  transform: rotate(180deg);
}

@media (max-width: 1024px) {
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
  }

  .news-sidebar {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
  }

  .news-sidebar.is-open {
    max-height: 2000px;
    transition: max-height 0.5s ease-in;
  }
}

/* ===== RESULTS COUNT ===== */
.results-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e5e7eb;
}

.results-count {
  font-size: 0.9375rem;
  color: #6b7280;
}

.results-count strong {
  color: #111827;
  font-weight: 700;
}

.view-toggle {
  display: flex;
  gap: 0.5rem;
  background: #f3f4f6;
  padding: 0.25rem;
  border-radius: 8px;
}

.view-toggle__btn {
  padding: 0.5rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.2s;
}

.view-toggle__btn:hover {
  background: white;
  color: #374151;
}

.view-toggle__btn.is-active {
  background: white;
  color: #3b82f6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
