/*
  Fauna & Species Page Styles
  Grid layout with filtering and search
*/

.page-fauna {
  background: var(--color-off-white);
}

/* ========================================
   SEARCH & FILTER CONTROLS - COMPACT STICKY BAR
   ======================================== */
.fauna-controls {
  background: var(--color-white);
  padding: 20px 0; /* Compact vertical padding */
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 81px; /* Below nav */
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.fauna-controls .container {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: nowrap;
}

/* Search Bar - Compact */
.search-wrapper {
  position: relative;
  flex-shrink: 0;
  width: 280px;
}

.search-input {
  width: 100%;
  padding: 10px var(--space-sm) 10px 40px; /* Height ~40px */
  font-size: 14px;
  border: 2px solid var(--color-border);
  border-radius: 24px;
  background: var(--color-off-white);
  transition: all var(--transition-base);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-accent-primary);
  background: var(--color-white);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.5;
  pointer-events: none;
}

/* Filter Tags - Horizontal with scroll */
.filter-tags {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-xs);
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  min-width: 0; /* Allow flex shrinking */
  padding: 2px 0; /* Breathing room for focus outlines */

  /* Hide scrollbar but keep functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.filter-tags::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Opera */
}

.filter-tag {
  padding: 8px 18px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 2px solid var(--color-border);
  border-radius: 20px;
  background: transparent;
  color: var(--color-charcoal);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-tag:hover {
  border-color: var(--color-accent-primary);
  color: var(--color-accent-primary);
  transform: translateY(-1px);
}

.filter-tag.active {
  background: var(--color-accent-primary);
  border-color: var(--color-accent-primary);
  color: white;
}

/* Results Count - Compact inline */
.results-count {
  text-align: right;
  font-size: 13px;
  color: var(--color-grey);
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 110px;
}

.results-count span {
  font-weight: 700;
  color: var(--color-accent-primary);
  font-size: 15px;
}

/* ========================================
   SPECIES GRID
   ======================================== */
.fauna-grid-section {
  padding: var(--space-xxl) 0;
}

.fauna-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-md); /* Reduced from lg to md (half) */
}

/* Species Card */
.species-card {
  background: var(--color-white);
  border-radius: 8px;
  overflow: hidden;
  transition: all var(--transition-base);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.species-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.species-card.hidden {
  display: none;
}

.species-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* Species Image */
.species-image {
  position: relative;
  width: 100%;
  height: 240px;
  overflow: hidden;
  background: var(--color-light-grey);
}

.species-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.species-card:hover .species-image img {
  transform: scale(1.05);
}

/* Extinction Badge */
.extinction-badge {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: rgba(220, 53, 69, 0.9);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Species Content */
.species-content {
  padding: var(--space-md); /* Reduced from lg to md (24px to 16px) */
}

/* Species Tags */
.species-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 10px;
  background: var(--color-light-grey);
  color: var(--color-charcoal);
}

.tag-fish {
  background: rgba(90, 124, 142, 0.15);
  color: var(--color-water);
}

.tag-birds {
  background: rgba(168, 188, 199, 0.15);
  color: var(--color-sky);
}

.tag-mammals {
  background: rgba(107, 93, 82, 0.15);
  color: var(--color-earth);
}

.tag-aquatic {
  background: rgba(90, 124, 142, 0.15);
  color: var(--color-accent-primary);
}

.tag-reptiles {
  background: rgba(184, 168, 136, 0.15);
  color: var(--color-reed);
}

.tag-extinct {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

/* Species Name */
.species-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-charcoal);
  margin-bottom: var(--space-xs);
  line-height: 1.3;
}

.species-latin {
  font-size: 14px;
  font-style: italic;
  color: var(--color-grey);
  margin-bottom: var(--space-md);
}

.species-description {
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-charcoal);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .fauna-controls {
    padding: var(--space-sm) 0; /* Even more compact on mobile */
    top: 60px; /* Adjusted for mobile nav */
  }

  .fauna-controls .container {
    flex-direction: column;
    gap: var(--space-sm);
    align-items: stretch;
  }

  .search-wrapper {
    width: 100%;
  }

  .filter-tags {
    width: 100%;
    overflow-x: auto;
    padding: 4px 0;
    justify-content: flex-start;

    /* Subtle gradient to indicate scroll */
    mask-image: linear-gradient(
      to right,
      black calc(100% - 40px),
      transparent 100%
    );
    -webkit-mask-image: linear-gradient(
      to right,
      black calc(100% - 40px),
      transparent 100%
    );
  }

  .filter-tag {
    padding: 7px 14px;
    font-size: 10px;
  }

  .results-count {
    text-align: center;
    min-width: auto;
    width: 100%;
    font-size: 12px;
  }

  .fauna-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
  .search-wrapper {
    width: 240px;
  }

  .filter-tag {
    padding: 7px 14px;
    font-size: 10px;
  }

  .results-count {
    min-width: 90px;
    font-size: 12px;
  }

  .fauna-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1400px) {
  .fauna-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
