/**
 * News Archive Module Styles
 * 
 * Styles for the news archive module (grid, filters, buttons)
 * Card styles are in shared/card-component.css
 */

/* CSS Variables */
:root {
  --dropdown-arrow-white: url('data:image/svg+xml;charset=UTF-8,%3csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3e%3cpolyline points="6 9 12 15 18 9"%3e%3c/polyline%3e%3c/svg%3e');
  --dropdown-arrow-black: url('data:image/svg+xml;charset=UTF-8,%3csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3e%3cpolyline points="6 9 12 15 18 9"%3e%3c/polyline%3e%3c/svg%3e');
}

/* News Archive Container */
.news-archive-container {
  width: 100%;
  margin: 0 auto;
  padding: 0;
}

/* Filter Row */
.news-filter-row {
  margin-bottom: 28px;
  background-color: #ffffff;
  padding: 0 20px;
}

.news-filter-inner {
  width: 100%;
  max-width: 485px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
}

.news-filter-heading {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto 26px;
  padding: 0 20px;
  font-size: 32px;
  font-weight: 700;
  color: var(--secondary-color);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.news-filter-prefix {
  display: none;
}

/* Dropdown */
.news-filter-dropdown {
  display: block;
  width: 100%;
  max-width: 400px;
  position: relative;
}

.news-filter-dropdown::before {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  width: 1em;
  height: 1em;
  background-color: #ffffff;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  z-index: 1;
  pointer-events: none;
}

.news-filter-select {
  width: 100%;
  padding: 16px 20px 14px;
  background-color: var(--primary-color);
  border: 2px solid var(--primary-color);
  color: #ffffff;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
  border-radius: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: var(--dropdown-arrow-white);
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px;
}

.news-filter-select:focus,
.news-filter-select:active {
  border-color: var(--tertiary-color);
  background-color: var(--primary-color);
  color: #ffffff;
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* News Grid */
.news-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 200px;
}

/* Archive Card Title Overrides (font-size, line-height) */
.news-archive-container .archive-card-title {
  font-size: 18px;
  line-height: 1.2;
}

@media screen and (min-width: 768px) {
  .news-archive-container .archive-card-title {
    font-size: 20px;
  }
}

/* Loading Indicator */
.news-loading {
  display: none;
  position: relative;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto 20px;
  padding: 0 20px;
  text-align: center;
}

.news-loading.active {
  display: block;
}

.news-loading::after {
  content: '';
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--secondary-color);
  border-top-color: transparent;
  border-radius: 50%;
  animation: news-spinner 0.8s linear infinite;
}

@keyframes news-spinner {
  to {
    transform: rotate(360deg);
  }
}

/* Visually Hidden (for screen readers) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Status Messages */
.news-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.news-no-results,
.news-error {
  text-align: center;
  padding: 40px 20px;
  font-size: 18px;
  color: var(--secondary-color);
  grid-column: 1 / -1;
}

.news-error {
  color: #d32f2f;
}

/* Load More Button */
.news-load-more-container {
  display: flex;
  justify-content: center;
  margin-top: 40px;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 20px;
}

.news-load-more-btn {
  width: 100%;
  max-width: 400px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  position: relative;
  display: inline-flex;
  align-items: center;
}

.news-load-more-btn::after {
  font-family: var(--font-etmodules);
  content: '\4c' !important;
  position: absolute;
  right: 1em;
  top: 50%;
  transform: translateY(-50%);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.news-load-more-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.news-load-more-btn.hidden {
  display: none;
}

/* Tablet: 2 columns */
@media screen and (min-width: 768px) {
  .news-filter-row {
    background-color: var(--secondary-color);
    margin-bottom: 130px;
    padding: 0 38px;
  }

  .news-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
  }

  .news-filter-dropdown::before {
    display: none;
  }

  .news-filter-inner {
    padding: 0;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    font-size: 26px;
    max-height: 80px;
  }

  .news-filter-heading {
    margin: 0 auto 80px;
    padding: 0 50px;
  }

  .news-filter-prefix {
    display: flex;
    align-items: center;
    gap: 1em;
    padding: 23px 30px 22px;
  }

  .news-filter-icon {
    display: block;
    height: 1.75em;
    width: auto;
    flex-shrink: 0;
  }

  .news-filter-label {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
  }

  /* Desktop: Show Dropdown */
  .news-filter-dropdown {
    display: block;
    flex: 1;
    max-width: none;
  }

  .news-filter-select {
    height: 100%;
    width: 100%;
    background-color: var(--secondary-color);
    border: none;
    color: #ffffff;
    font-size: 26px;
    font-weight: 400;
    padding: 23px 40px 22px 20px;
    cursor: pointer;
    transition:
      background-color 0.3s ease,
      background-image 0.3s ease;
    border-radius: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: var(--dropdown-arrow-white);
    background-repeat: no-repeat;
    background-position: right 20px center;
    background-size: 28px;
  }

  .news-filter-select:hover,
  .news-filter-select:focus {
    background-color: var(--tertiary-color);
    color: var(--secondary-color);
    background-image: var(--dropdown-arrow-black);
    outline: 2px solid var(--tertiary-color);
    outline-offset: 2px;
  }

  .news-filter-select option {
    background-color: var(--secondary-color);
    color: #ffffff;
    font-size: 16px;
  }
}

@media screen and (min-width: 980px) and (max-width: 1199px) {
  .news-filter-label {
    font-size: 20px;
  }
}

/* Desktop: 3 columns */
@media screen and (min-width: 980px) {
  .news-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1em;
  }
  .news-grid .archive-card.news-card {
    height: 485px;
  }
}

/* Large Desktop: 4 columns */
@media screen and (min-width: 1100px) {
  .news-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .news-loading::after,
  .news-filter-select,
  .news-load-more-btn {
    animation: none;
    transition: none;
  }
}
