/**
 * People Content Filter Styles
 * Responsive CSS for the people-based content filtering shortcode
 */

/* For reference only, already set in theme customizer: 
:root {
  --theme-font-family: 'Libre Franklin', Sans-Serif;
  --theme-font-weight: 400;
  --theme-text-transform: none;
  --theme-text-decoration: none;
  --theme-font-size: 1.1rem;
  --theme-line-height: 1.65;
  --theme-letter-spacing: 0em;
  --theme-button-font-weight: 500;
  --theme-button-font-size: 1.2rem;
  --has-classic-forms: var(--true);
  --has-modern-forms: var(--false);
  --theme-form-field-background-initial-color: #ffffffde;
  --theme-form-field-background-focus-color: var(--theme-palette-color-8);
  --theme-form-field-border-initial-color: var(--theme-border-color);
  --theme-form-field-border-focus-color: var(--theme-palette-color-1);
  --theme-form-selection-field-initial-color: var(--theme-border-color);
  --theme-form-selection-field-active-color: var(--theme-palette-color-1);
  --theme-palette-color-1: #bf5700;
  --theme-palette-color-2: #a04400;
  --theme-palette-color-3: #00a9b7;
  --theme-palette-color-4: #333f48;
  --theme-palette-color-5: #9cadb7;
  --theme-palette-color-6: #d6d2c4;
  --theme-palette-color-7: #e9e8e0;
  --theme-palette-color-8: #fff;
  --theme-text-color: var(--theme-palette-color-4);
  --theme-link-initial-color: var(--theme-palette-color-2);
  --theme-link-hover-color: var(--theme-palette-color-1);
  --theme-selection-text-color: #fff;
  --theme-selection-background-color: var(--theme-palette-color-2);
  --theme-border-color: var(--theme-palette-color-6);
  --theme-headings-color: var(--theme-palette-color-4);
  --theme-content-spacing: 1.5em;
  --theme-button-min-height: 40px;
  --theme-button-shadow: none;
  --theme-button-transform: none;
  --theme-button-text-initial-color: #fff;
  --theme-button-text-hover-color: #fff;
  --theme-button-background-initial-color: var(--theme-palette-color-2);
  --theme-button-background-hover-color: var(--theme-palette-color-1);
  --theme-button-border: none;
  --theme-button-border-radius: 0.5rem;
  --theme-button-padding: 0.5rem 1.25rem;
  --theme-normal-container-max-width: 1290px;
  --theme-content-vertical-spacing: 5vh;
  --theme-container-edge-spacing: 90vw;
  --theme-narrow-container-max-width: 750px;
  --theme-wide-offset: 130px;
}
*/

/* Main Container */
.people-content-filter {
  margin: var(--theme-content-spacing) 0;
  font-family: var(
    --theme-font-family,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif
  );
}

/* Filter Controls */
.filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: var(--theme-content-spacing);
}

.filter-controls > div {
  flex: 1;
  min-width: 200px;
}

.filter-controls label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--theme-headings-color);
  font-size: 0.875rem;
}

/* Form Controls */
.filter-controls input[type="search"],
.filter-controls select {
  width: 100%;
  border: 1px solid var(--theme-form-field-border-initial-color);
  border-radius: var(--theme-button-border-radius, 4px);
  font-size: var(--theme-font-size);
  line-height: var(--theme-line-height);
  background-color: var(--theme-form-field-background-initial-color);
  color: var(--theme-text-color);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.filter-controls input[type="search"]:focus,
.filter-controls select:focus {
  border-color: var(--theme-form-field-border-focus-color);
  outline: 0;
  background-color: var(--theme-form-field-background-focus-color);
  box-shadow: 0 0 0 0.2rem rgba(191, 87, 0, 0.25);
}

.filter-controls input[type="search"]:disabled,
.filter-controls select:disabled {
  background-color: var(--theme-palette-color-7);
  opacity: 0.65;
  cursor: not-allowed;
}

/* Search Input Specific */
.search-control input[type="search"] {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23777' viewBox='0 0 16 16'%3e%3cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'%3e%3c/path%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 16px;
  padding-right: 2.75rem;
}

/* Results Container */
.results-container {
  position: relative;
  min-height: 200px;
}

/* Loading Indicator */
.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--theme-button-border-radius, 4px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: 10;
  font-weight: 600;
  color: var(--theme-palette-color-5);
}

.loading-indicator::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 0.5rem;
  border: 2px solid var(--theme-palette-color-7);
  border-top: 2px solid var(--theme-palette-color-1);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Results Message */
.results-message {
  margin-bottom: 1rem;
  text-align: center;

  &:empty {
    display: none;
  }
}

/* Grid Layout */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--theme-content-spacing);
  margin-bottom: var(--theme-content-spacing);
}

/* List Layout */
.results-list {
  display: flex;
  flex-direction: column;
  gap: var(--theme-content-spacing);
  margin-bottom: var(--theme-content-spacing);
}

/* Year Grouped Layout - no grid/flex styling, let year groups handle it */
.results-year-grouped {
  margin-bottom: var(--theme-content-spacing);
}

/* Result Items */
/* CONTAINER: Removed the transition from here */
.result-item.grid-item {
  background: var(--theme-palette-color-8);
  border-radius: var(--theme-button-border-radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  /* Add a transition for the box-shadow change */
  transition: box-shadow 0.5s ease-in-out;
}

.result-item.grid-item:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* IMAGE: Add the transition here */
.result-item.grid-item img {
  width: 100%;
  display: block;
  /* This is the key: The transition now targets the transform on the image */
  transition: transform 0.5s ease-in-out;
}

.result-item.list-item img {
  transition: transform 0.5s ease-in-out;
}
/* Apply the transform on hover, which will now be animated */
.result-item:hover img {
  transform: scale(1.05);
}

/* List Item Specific */
.list-item {
  display: flex;
  align-items: center;
}

.list-item .item-thumbnail {
  flex-shrink: 0;
  width: 75px;
  height: 97px;
  margin-right: 1.5rem;
  overflow: hidden;
  border-radius: 4px;
}

.list-item .item-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Item Content */
.item-content {
  padding: 1.5rem;
  flex: 1;
}

.list-item .item-content {
  padding: 0;
}

.item-title {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

.item-title a {
  color: var(--theme-headings-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.item-title a:hover {
  color: var(--theme-link-hover-color);
}

/* Meta Information */
.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  align-items: center;
}

div:empty {
  display: none !important;
}

/* .item-meta > span {
  padding: 0.25rem 0.5rem;
  background: var(--theme-palette-color-7);
  border-radius: 3px;
  color: var(--theme-palette-color-5);
  font-weight: 500;
} */

/* .item-date {
  background: #e7f3ff !important;
  color: #0066cc !important;
} */

.item-category {
  background: #f0f8f0 !important;
  color: #006600 !important;
}

.project-status {
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  font-weight: 500;
}
.project-status.current {
  background-color: var(--theme-palette-color-6);
  color: var(--theme-palette-color-4);
}

.project-status.past {
  background-color: var(--theme-palette-color-6);
  color: var(--theme-palette-color-4);
}

.featured-badge {
  background: #fff3cd !important;
  color: #856404 !important;
  font-weight: 600;
}

/* Authors and People */
.item-authors,
.item-people {
  margin-bottom: 1rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.authors-label,
.people-label {
  font-weight: 600;
  color: var(--theme-headings-color);
  margin-right: 0.5rem;
}

.item-authors a,
.item-people a {
  color: var(--theme-link-initial-color);
  text-decoration: none;
}

.item-authors a:hover,
.item-people a:hover {
  color: var(--theme-link-hover-color);
  text-decoration: underline;
}

.person-role {
  font-size: 0.8em;
  color: var(--theme-palette-color-5);
  font-style: italic;
}

.more-people {
  color: var(--theme-palette-color-5);
  font-style: italic;
  font-size: 0.875rem;
}

/* Excerpt */
.item-excerpt {
  color: var(--theme-palette-color-5);
  line-height: var(--theme-line-height);
  margin-bottom: 0;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--theme-palette-color-5);
  font-size: 1.125rem;
  background: var(--theme-palette-color-7);
  border-radius: var(--theme-button-border-radius);
  border: 2px dashed var(--theme-border-color);
}

/* Filter Error */
.filter-error {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--theme-palette-color-2);
  background: var(--theme-palette-color-7);
  border-radius: var(--theme-button-border-radius);
  border: 1px solid var(--theme-border-color);
}

/* Loading State */
.people-content-filter.is-loading .filter-controls {
  pointer-events: none;
}

.people-content-filter.is-loading .results-grid,
.people-content-filter.is-loading .results-list,
.people-content-filter.is-loading .results-year-grouped {
  transition: opacity 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
  .filter-controls {
    flex-direction: column;
    gap: 1rem;
  }

  .filter-controls > div {
    min-width: auto;
  }

  .results-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .list-item {
    flex-direction: column;
  }

  .list-item .item-thumbnail {
    width: 100%;
    height: auto;
    margin-right: 0;
    margin-bottom: 1rem;
  }

  .list-item .item-content {
    padding: 0 1.5rem 1.5rem;
  }
}

@media (max-width: 480px) {
  .people-content-filter {
    margin: 1rem 0;
  }

  .filter-controls {
    padding: 1rem;
    margin-bottom: 1.5rem;
  }

  .results-grid {
    gap: 1rem;
  }

  .item-content {
    padding: 1rem;
  }

  .item-title {
    font-size: 1.125rem;
  }

  .item-meta {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Print Styles */
@media print {
  .filter-controls,
  .loading-indicator {
    display: none !important;
  }

  .result-item {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
    margin-bottom: 1rem;
  }

  .item-title a {
    color: var(--theme-palette-color-4) !important;
    text-decoration: none !important;
  }
}

/* Accessibility Enhancements */
.filter-controls input:focus,
.filter-controls select:focus {
  outline: 2px solid var(--theme-palette-color-1);
  outline-offset: 2px;
}

.result-item:focus-within {
  outline: 2px solid var(--theme-palette-color-1);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .filter-controls {
    border-color: var(--theme-palette-color-4);
  }

  .result-item {
    border: 2px solid var(--theme-palette-color-4);
  }

  .item-meta > span {
    border: 1px solid var(--theme-palette-color-4);
  }
}

/* Pagination Styles */
.pagination-wrapper {
  margin: 30px 0;
  text-align: center;
}

.pagination-info {
  margin-bottom: 15px;
  font-size: 14px;
  color: var(--theme-palette-color-5);
  font-weight: 500;
}

.pagination-nav {
  display: inline-block;
}

.pagination-list {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pagination-item {
  margin: 0;
}

.pagination-btn {
  display: inline-block;
  padding: 8px 12px;
  min-width: var(--theme-button-min-height);
  text-align: center;
  text-decoration: none;
  border: 1px solid var(--theme-border-color);
  border-radius: var(--theme-button-border-radius);
  background: var(--theme-palette-color-8);
  color: var(--theme-text-color);
  font-weight: 500;
  font-family: var(--theme-font-family, inherit);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-btn:hover {
  background: var(--theme-palette-color-7);
  border-color: var(--theme-palette-color-5);
  color: var(--theme-headings-color);
}

.pagination-btn.pagination-current {
  background: var(--theme-palette-color-1);
  border-color: var(--theme-palette-color-1);
  color: var(--theme-button-text-initial-color);
  cursor: default;
}

.pagination-btn.pagination-current:hover {
  background: var(--theme-palette-color-1);
  border-color: var(--theme-palette-color-1);
  color: var(--theme-button-text-initial-color);
}

.pagination-btn.pagination-prev,
.pagination-btn.pagination-next {
  font-weight: 600;
  padding: 8px 16px;
}

.pagination-ellipsis span {
  display: inline-block;
  padding: 8px 12px;
  color: var(--theme-palette-color-5);
  cursor: default;
  background: none;
  border: none;
}

/* Mobile responsive pagination */
@media (max-width: 768px) {
  .pagination-list {
    gap: 4px;
  }

  .pagination-btn {
    padding: 6px 8px;
    min-width: 32px;
    font-size: 12px;
  }

  .pagination-btn.pagination-prev,
  .pagination-btn.pagination-next {
    padding: 6px 12px;
  }

  .pagination-info {
    font-size: 12px;
    margin-bottom: 10px;
  }
}

/* Year Grouping Styles */
.txicfw-year-section {
  margin-bottom: 2rem;
}

.txicfw-year-section:last-child {
  margin-bottom: 0;
}

.txicfw-year-header {
  color: var(--theme-palette-color-1);
  margin: 2rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--theme-palette-color-6, #d6d2c4);
}

.txicfw-year-header:first-child {
  margin-top: 0;
}

.txicfw-year-group {
  margin-bottom: 0;
}

/* Year groups should inherit the same layout as main results */
.txicfw-year-group.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--theme-content-spacing);
  margin-bottom: var(--theme-content-spacing);
}

.txicfw-year-group.results-list {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin-bottom: var(--theme-content-spacing);
}

/* Media query adjustments for year headers */
@media (max-width: 768px) {
  .txicfw-year-section {
    margin-bottom: 1.5rem;
  }

  .txicfw-year-header {
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem 0;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .result-item,
  .item-thumbnail img,
  .filter-controls input,
  .filter-controls select {
    transition: none;
  }

  .loading-indicator::after {
    animation: none;
  }

  .pagination-btn {
    transition: none;
  }
}
