/**
 * Bolete Key - Stylesheet
 * PNW Bolete Identification Tool
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
  /* Colors */
  --bolete-primary: #8b4513;
  --bolete-primary-dark: #6b3410;
  --bolete-secondary: #d2691e;
  --bolete-accent: #228b22;
  --bolete-bg: #f8f6f3;
  --bolete-card-bg: #ffffff;
  --bolete-border: #e0dcd7;
  --bolete-text: #333333;
  --bolete-text-light: #666666;
  --bolete-text-muted: #999999;

  /* Edibility colors */
  --edibility-choice: #228b22;
  --edibility-edible: #4caf50;
  --edibility-caution: #ff9800;
  --edibility-poisonous: #f44336;
  --edibility-inedible: #9e9e9e;
  --edibility-unknown: #607d8b;

  /* Layout */
  --header-height: 60px;
  --footer-height: 80px;
  --sidebar-width: 320px;
  --sidebar-width-collapsed: 0px;

  /* Typography */
  --font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-family-scientific: 'Georgia', 'Times New Roman', serif;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* ============================================
   Reset & Base
   ============================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-family);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--bolete-text);
  background: var(--bolete-bg);
}

a {
  color: var(--bolete-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  font-family: inherit;
}

/* ============================================
   App Container
   ============================================ */
#bolete-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ============================================
   Header
   ============================================ */
.bolete-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--header-height);
  background: var(--bolete-primary);
  color: white;
  box-shadow: var(--shadow-md);
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-brand i {
  font-size: 1.5rem;
}

.header-brand h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.header-subtitle {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
}

.header-search {
  flex: 1;
  max-width: 400px;
  margin: 0 30px;
  position: relative;
}

.header-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--bolete-text-muted);
}

.header-search input {
  width: 100%;
  padding: 10px 40px 10px 40px;
  border: none;
  border-radius: 20px;
  font-size: 0.875rem;
  background: white;
}

.header-search input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.clear-search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--bolete-text-muted);
  padding: 5px;
}

.clear-search-btn:hover {
  color: var(--bolete-text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: white;
  font-size: 0.8125rem;
  transition: background var(--transition-fast);
}

.header-link:hover {
  background: rgba(255, 255, 255, 0.2);
  text-decoration: none;
}

/* Header Login Button */
.header-login-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bolete-accent);
  border: none;
  border-radius: 4px;
  color: white;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast);
}

.header-login-btn:hover {
  background: #1e7a1e;
  transform: translateY(-1px);
}

.header-login-btn i {
  font-size: 0.875rem;
}

/* Hide login button when user is logged in (controlled via JS) */
.header-login-btn.logged-in {
  display: none;
}

/* ============================================
   Main Content Area
   ============================================ */
.bolete-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ============================================
   Filters Sidebar
   ============================================ */
.filters-sidebar {
  width: var(--sidebar-width);
  background: var(--bolete-card-bg);
  border-right: 1px solid var(--bolete-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-normal);
}

.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--bolete-border);
  background: var(--bolete-bg);
}

.filters-header h2 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.filters-header h2 i {
  color: var(--bolete-primary);
}

.reset-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: none;
  border: 1px solid var(--bolete-border);
  border-radius: 4px;
  color: var(--bolete-text-light);
  font-size: 0.75rem;
  transition: all var(--transition-fast);
}

.reset-btn:hover {
  background: var(--bolete-bg);
  color: var(--bolete-text);
}

/* Hide mobile-only elements on desktop */
.mobile-sheet-count {
  display: none;
}

.sheet-expand-indicator {
  display: none;
}

.active-filters-badge {
  display: none !important;
}

.bottom-sheet-overlay {
  display: none;
}

/* Desktop-only elements */
.desktop-only {
  display: flex;
}

.filters-content {
  flex: 1;
  overflow-y: auto;
  padding: 15px 20px;
}

/* Species Count Box */
.species-count-box {
  text-align: center;
  padding: 15px;
  background: var(--bolete-bg);
  border-radius: 8px;
  margin-bottom: 20px;
}

.species-count-box #species-count {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--bolete-primary);
  line-height: 1;
}

.species-count-box .count-label {
  font-size: 0.8125rem;
  color: var(--bolete-text-light);
}

/* Filter Sections */
.filter-section {
  margin-bottom: 20px;
}

.filter-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--bolete-text-light);
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bolete-border);
}

.filter-section-title.expandable {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-section-title.expandable i {
  transition: transform var(--transition-fast);
}

.filter-section.collapsed .filter-section-title.expandable i {
  transform: rotate(-90deg);
}

.filter-section.collapsed .filter-section-content {
  display: none;
}

/* Filter Groups */
.filter-group {
  margin-bottom: 18px;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--bolete-text);
  margin-bottom: 8px;
}

.filter-help {
  color: var(--bolete-text-muted);
  cursor: help;
}

.filter-help:hover {
  color: var(--bolete-primary);
}

/* Warning icon for taste filter */
.filter-help.filter-warning {
  color: #e67e22;
}

.filter-help.filter-warning:hover {
  color: #d35400;
}

/* Toggle Button Groups */
.toggle-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.toggle-btn {
  flex: 1;
  min-width: 50px;
  padding: 8px 12px;
  background: var(--bolete-bg);
  border: 1px solid var(--bolete-border);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--bolete-text-light);
  transition: all var(--transition-fast);
}

.toggle-btn:hover {
  background: #f0ece7;
}

.toggle-btn.active {
  background: var(--bolete-primary);
  border-color: var(--bolete-primary);
  color: white;
}

/* Single Slider */
.single-slider-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-value-display {
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bolete-primary);
  padding: 4px 0;
}

.single-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bolete-border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.single-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--bolete-primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-fast);
}

.single-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.single-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--bolete-primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--bolete-text-muted);
}

/* Checkbox Styles */
.filter-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.filter-checkbox input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--bolete-primary);
}

.checkbox-label {
  font-size: 0.8125rem;
  font-weight: 500;
}

.checkbox-sublabel {
  display: block;
  font-size: 0.6875rem;
  color: var(--bolete-text-muted);
  font-weight: normal;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.filter-checkbox-item input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: var(--bolete-primary);
}

/* Edibility Badges */
.edibility-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
}

.edibility-badge.choice {
  background: var(--edibility-choice);
  color: white;
}

.edibility-badge.edible {
  background: var(--edibility-edible);
  color: white;
}

.edibility-badge.caution {
  background: var(--edibility-caution);
  color: white;
}

.edibility-badge.poisonous {
  background: var(--edibility-poisonous);
  color: white;
}

.edibility-badge.inedible {
  background: var(--edibility-inedible);
  color: white;
}

.edibility-badge.unknown {
  background: var(--edibility-unknown);
  color: white;
}

/* Select Dropdown */
.filter-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--bolete-border);
  border-radius: 4px;
  font-size: 0.8125rem;
  background: white;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--bolete-primary);
}

/* Color Checkbox Group (for cap color, pore color) */
.color-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bolete-bg);
  border: 1px solid var(--bolete-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.75rem;
}

.color-checkbox-item:hover {
  background: #f0ece7;
  border-color: var(--bolete-primary);
}

.color-checkbox-item:has(input:checked) {
  background: var(--bolete-primary);
  border-color: var(--bolete-primary);
  color: white;
}

.color-checkbox-item:has(input:checked) .color-swatch {
  box-shadow: 0 0 0 2px white;
}

.color-checkbox-item input[type='checkbox'] {
  display: none;
}

.color-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.color-label {
  font-weight: 500;
}

/* Filter Chips Container */
.filter-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bolete-bg);
  border-bottom: 1px solid var(--bolete-border);
  align-items: center;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 12px;
  background: var(--bolete-card-bg);
  border: 1px solid var(--bolete-border);
  border-radius: 20px;
  font-size: 0.75rem;
}

.filter-chip-label {
  color: var(--bolete-text-light);
  font-weight: 500;
}

.filter-chip-value {
  color: var(--bolete-primary);
  font-weight: 600;
  text-transform: capitalize;
}

.filter-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  background: var(--bolete-bg);
  border: none;
  border-radius: 50%;
  color: var(--bolete-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chip-remove:hover {
  background: var(--bolete-primary);
  color: white;
}

.filter-chip-remove i {
  font-size: 0.625rem;
}

.filter-chips-clear-all {
  padding: 5px 12px;
  background: transparent;
  border: 1px dashed var(--bolete-border);
  border-radius: 20px;
  color: var(--bolete-text-light);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-chips-clear-all:hover {
  background: var(--bolete-primary);
  border-color: var(--bolete-primary);
  border-style: solid;
  color: white;
}

/* Trait Checkbox Group (boolean filters) */
.trait-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.trait-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bolete-bg);
  border: 1px solid var(--bolete-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.trait-checkbox:hover {
  background: #f0ece7;
  border-color: var(--bolete-primary);
}

.trait-checkbox:has(input:checked) {
  background: var(--bolete-primary);
  border-color: var(--bolete-primary);
  color: white;
}

.trait-checkbox input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--bolete-primary);
  cursor: pointer;
}

.trait-checkbox:has(input:checked) input[type='checkbox'] {
  accent-color: white;
}

.trait-checkbox .checkbox-label {
  font-size: 0.8125rem;
  font-weight: 500;
}

.trait-checkbox .filter-count {
  margin-left: 8px;
  margin-right: 8px;
}

.trait-checkbox:has(input:checked) .filter-count {
  background: rgba(255, 255, 255, 0.25);
}

/* Trait Help Icon with Tooltip */
.trait-help-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-left: auto;
  color: var(--bolete-text-muted);
  cursor: help;
  flex-shrink: 0;
  z-index: 1;
}

.trait-help-icon i {
  font-size: 0.875rem;
  transition: color var(--transition-fast);
}

.trait-help-icon:hover i,
.trait-help-icon:focus i {
  color: var(--bolete-primary);
}

.trait-checkbox:has(input:checked) .trait-help-icon {
  color: rgba(255, 255, 255, 0.7);
}

.trait-checkbox:has(input:checked) .trait-help-icon:hover i,
.trait-checkbox:has(input:checked) .trait-help-icon:focus i {
  color: white;
}

/* Tooltip styling */
.trait-help-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 250px;
  padding: 10px 14px;
  background: #333;
  color: white;
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.4;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--transition-fast),
    visibility var(--transition-fast);
  pointer-events: none;
  z-index: 1000;
  white-space: normal;
  text-align: left;
}

/* Tooltip arrow */
.trait-help-icon::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #333;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--transition-fast),
    visibility var(--transition-fast);
  pointer-events: none;
  z-index: 1001;
}

/* Show tooltip on hover and focus */
.trait-help-icon:hover::after,
.trait-help-icon:hover::before,
.trait-help-icon:focus::after,
.trait-help-icon:focus::before {
  opacity: 1;
  visibility: visible;
}

/* Adjust tooltip position on right side to prevent overflow */
.trait-help-icon::after {
  left: auto;
  right: -10px;
  transform: none;
}

.trait-help-icon::before {
  left: auto;
  right: 4px;
  transform: none;
}

/* Filter Count Badges */
.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  margin-left: 4px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 9px;
  font-size: 0.625rem;
  font-weight: 600;
  color: inherit;
  opacity: 0.7;
}

.toggle-btn.active .filter-count {
  background: rgba(255, 255, 255, 0.25);
}

.color-checkbox-item .filter-count {
  margin-left: auto;
}

.color-checkbox-item:has(input:checked) .filter-count {
  background: rgba(255, 255, 255, 0.25);
}

.filter-checkbox-item .filter-count {
  margin-left: auto;
  background: var(--bolete-border);
  color: var(--bolete-text-muted);
}

/* Mobile Filter Toggle */
.mobile-filter-toggle {
  display: none;
  position: fixed;
  bottom: 100px;
  right: 20px;
  padding: 12px 20px;
  background: var(--bolete-accent);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 25px;
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow:
    var(--shadow-lg),
    0 0 0 3px rgba(34, 139, 34, 0.2);
  z-index: 50;
  transition:
    background var(--transition-fast),
    transform var(--transition-fast);
}

.mobile-filter-toggle:hover,
.mobile-filter-toggle:active {
  background: #1e7a1e;
  transform: scale(1.05);
}

.mobile-filter-toggle i {
  margin-right: 6px;
}

/* ============================================
   Results Area
   ============================================ */
.results-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0; /* Prevent flex item from overflowing */
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bolete-card-bg);
  border-bottom: 1px solid var(--bolete-border);
}

.results-sort {
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-sort label {
  font-size: 0.8125rem;
  color: var(--bolete-text-light);
}

.sort-select {
  padding: 6px 12px;
  border: 1px solid var(--bolete-border);
  border-radius: 4px;
  font-size: 0.8125rem;
  background: white;
}

.results-view {
  display: flex;
  gap: 4px;
}

.view-btn {
  padding: 8px 12px;
  background: var(--bolete-bg);
  border: 1px solid var(--bolete-border);
  border-radius: 4px;
  color: var(--bolete-text-light);
  transition: all var(--transition-fast);
}

.view-btn:hover {
  background: #f0ece7;
}

.view-btn.active {
  background: var(--bolete-primary);
  border-color: var(--bolete-primary);
  color: white;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--bolete-text-light);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bolete-border);
  border-top-color: var(--bolete-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* No Results State */
.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--bolete-text-light);
}

.no-results i {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.5;
}

.no-results h3 {
  font-size: 1.125rem;
  margin-bottom: 10px;
  color: var(--bolete-text);
}

.link-btn {
  background: none;
  border: none;
  color: var(--bolete-primary);
  text-decoration: underline;
  cursor: pointer;
}

/* ============================================
   Species Grid
   ============================================ */
.species-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0; /* Allow grid to scroll within flex container */
}

/* Species Card */
.species-card {
  display: flex;
  flex-direction: column;
  background: var(--bolete-card-bg);
  border-radius: 8px;
  overflow: visible;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  cursor: pointer;
}

.species-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.species-card-image {
  position: relative;
  aspect-ratio: 16 / 10;
  flex-shrink: 0;
  background: var(--bolete-bg);
  overflow: hidden;
  border-radius: 8px 8px 0 0;
}

.species-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.species-card-image .no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--bolete-text-muted);
}

.species-card-image .no-image i {
  font-size: 3rem;
  opacity: 0.3;
}

.species-card-edibility {
  position: absolute;
  top: 10px;
  right: 10px;
}

.species-card-attribution {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  padding: 15px 8px 6px;
  color: #fff;
  font-size: 0.625rem;
  text-align: right;
}

.species-card-attribution small {
  opacity: 0.85;
}

.species-card-content {
  padding: 15px;
}

.species-card-name {
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 600;
  color: var(--bolete-text);
  margin-bottom: 4px;
}

.species-card-scientific {
  font-family: var(--font-family-scientific);
  font-size: 0.8125rem;
  color: var(--bolete-text-light);
  margin-bottom: 8px;
}

.species-card-common {
  font-size: 0.8125rem;
  color: var(--bolete-text-light);
  margin-bottom: 10px;
}

.species-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--bolete-text-muted);
  margin-bottom: 12px;
}

.species-card-genus {
  font-weight: 500;
  color: var(--bolete-primary);
}

.species-card-observations {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Abundance Badges */
.species-card-abundance {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.6875rem;
  font-weight: 500;
}

.abundance-very-common {
  background: #e8f5e9;
  color: #2e7d32;
}

.abundance-common {
  background: #e3f2fd;
  color: #1565c0;
}

.abundance-uncommon {
  background: #fff3e0;
  color: #e65100;
}

.abundance-rare {
  background: #fce4ec;
  color: #c2185b;
}

/* Modal abundance styling */
.modal-abundance {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.modal-abundance i {
  font-size: 0.6875rem;
}

/* List view abundance */
.species-list-abundance span {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.6875rem;
  font-weight: 500;
}

.species-card-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.trait-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--bolete-bg);
  border-radius: 4px;
  font-size: 0.6875rem;
  color: var(--bolete-text-light);
}

.trait-tag i {
  font-size: 0.625rem;
}

.trait-tag.trait-yes {
  background: #e8f5e9;
  color: var(--edibility-choice);
}

.trait-tag.trait-no {
  background: #ffebee;
  color: var(--edibility-poisonous);
}

.trait-tag.trait-weak {
  background: #fff3e0;
  color: var(--edibility-caution);
}

/* ============================================
   Species List View
   ============================================ */
.species-list {
  overflow-y: auto;
}

.species-list-header {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1fr 100px 1fr;
  gap: 15px;
  padding: 12px 20px;
  background: var(--bolete-bg);
  border-bottom: 1px solid var(--bolete-border);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--bolete-text-light);
}

.species-list-row {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1fr 100px 1fr;
  gap: 15px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--bolete-border);
  align-items: center;
  transition: background var(--transition-fast);
  cursor: pointer;
}

.species-list-row:hover {
  background: var(--bolete-bg);
}

.species-list-name {
  display: flex;
  flex-direction: column;
}

.species-list-scientific {
  font-family: var(--font-family-scientific);
  font-style: italic;
  font-weight: 500;
}

.species-list-common {
  font-size: 0.75rem;
  color: var(--bolete-text-light);
}

.species-list-genus {
  color: var(--bolete-primary);
  font-weight: 500;
}

.species-list-observations {
  text-align: right;
}

/* ============================================
   Footer
   ============================================ */
.bolete-footer {
  padding: 15px 20px;
  background: var(--bolete-card-bg);
  border-top: 1px solid var(--bolete-border);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.disclaimer {
  font-size: 0.75rem;
  color: var(--bolete-text);
  margin-bottom: 8px;
  padding: 10px 15px;
  background: #fff3cd;
  border-radius: 4px;
  border-left: 3px solid #ffc107;
}

.disclaimer i {
  color: #856404;
  margin-right: 6px;
}

.credits {
  font-size: 0.6875rem;
  color: var(--bolete-text-muted);
  text-align: center;
}

/* ============================================
   Modal
   ============================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  background: var(--bolete-card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 36px;
  height: 36px;
  background: var(--bolete-bg);
  border: none;
  border-radius: 50%;
  font-size: 1.125rem;
  color: var(--bolete-text-light);
  z-index: 10;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--bolete-border);
  color: var(--bolete-text);
}

.modal-body {
  max-height: 90vh;
  overflow-y: auto;
}

/* Modal Species Detail */
.modal-species-image {
  aspect-ratio: 16 / 10;
  background: var(--bolete-bg);
  overflow: hidden;
  position: relative;
}

.modal-species-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.photo-attribution {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  padding: 20px 10px 8px;
  color: #fff;
  font-size: 0.6875rem;
}

.photo-attribution small {
  opacity: 0.9;
}

/* Gallery Thumbnails - separate section below image */
.gallery-thumbnails {
  display: flex;
  gap: 10px;
  padding: 12px 15px;
  background: #f0f0f0;
  border-bottom: 1px solid var(--bolete-border, #ddd);
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.gallery-thumbnails::-webkit-scrollbar {
  height: 6px;
}

.gallery-thumbnails::-webkit-scrollbar-track {
  background: transparent;
}

.gallery-thumbnails::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.gallery-thumb {
  flex-shrink: 0;
  width: 70px;
  height: 44px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  opacity: 0.7;
  transition:
    opacity 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.gallery-thumb:hover {
  opacity: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.gallery-thumb.active {
  border-color: var(--bolete-primary, #5a8f5a);
  opacity: 1;
  box-shadow: 0 0 0 2px rgba(90, 143, 90, 0.3);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Gallery Navigation Arrows */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    background-color 0.2s ease;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-species-image.has-gallery:hover .gallery-nav {
  opacity: 1;
}

.gallery-nav:hover {
  background: rgba(0, 0, 0, 0.75);
}

.gallery-nav-prev {
  left: 10px;
}

.gallery-nav-next {
  right: 10px;
}

/* Always show arrows on touch devices */
@media (hover: none) {
  .gallery-nav {
    opacity: 0.8;
  }
}

.modal-species-content {
  padding: 25px;
}

.modal-species-header {
  margin-bottom: 20px;
}

.modal-species-name {
  font-family: var(--font-family-scientific);
  font-size: 1.75rem;
  font-style: italic;
  font-weight: 600;
  margin-bottom: 5px;
}

.modal-species-common {
  font-size: 1rem;
  color: var(--bolete-text-light);
  margin-bottom: 10px;
}

.modal-species-taxonomy {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 0.8125rem;
  color: var(--bolete-text-muted);
}

.modal-species-section {
  margin-bottom: 20px;
}

.modal-species-section h4 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--bolete-text-light);
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--bolete-border);
}

.modal-species-description {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--bolete-text);
}

.modal-species-traits {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.modal-trait-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bolete-bg);
  border-radius: 4px;
  font-size: 0.8125rem;
}

.modal-trait-label {
  color: var(--bolete-text-light);
}

.modal-trait-value {
  font-weight: 500;
}

.modal-species-links {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--bolete-bg);
  border: 1px solid var(--bolete-border);
  border-radius: 6px;
  color: var(--bolete-text);
  font-size: 0.8125rem;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.modal-link-btn:hover {
  background: var(--bolete-border);
  text-decoration: none;
}

.modal-link-btn.primary {
  background: var(--bolete-primary);
  border-color: var(--bolete-primary);
  color: white;
}

.modal-link-btn.primary:hover {
  background: var(--bolete-primary-dark);
}

/* Key Features List */
.modal-species-section.key-features {
  background: #f0f7f0;
  border-radius: 8px;
  padding: 15px 20px;
  margin-bottom: 20px;
}

.modal-species-section.key-features h4 {
  color: var(--edibility-choice);
  border-bottom-color: #c8e6c9;
  margin-bottom: 12px;
}

.key-features-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.key-features-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 8px;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--bolete-text);
}

.key-features-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--edibility-choice);
  font-weight: bold;
  font-size: 1rem;
}

.key-features-list li:last-child {
  margin-bottom: 0;
}

/* Similar Species List */
.modal-species-section.similar-species h4 {
  color: var(--bolete-secondary);
}

.similar-species-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.similar-species-list li {
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bolete-bg);
  border-radius: 6px;
  border-left: 3px solid var(--bolete-secondary);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.similar-species-list li:last-child {
  margin-bottom: 0;
}

.similar-species-list li strong {
  color: var(--bolete-primary);
  font-style: italic;
}

/* Summary styling */
.modal-species-description.summary {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--bolete-text);
  font-weight: 400;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Tablet: 769px to 1024px - sidebar becomes left overlay with FAB toggle */
@media (max-width: 1024px) and (min-width: 769px) {
  .filters-sidebar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
  }

  .filters-sidebar.open {
    transform: translateX(0);
  }

  /* Show filter toggle button for tablet - positioned below sort controls */
  .mobile-filter-toggle {
    display: flex !important;
    align-items: center;
    position: fixed;
    top: calc(var(--header-height) + 60px);
    left: 15px;
    right: auto;
    bottom: auto;
    z-index: 60;
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow:
      0 4px 12px rgba(34, 139, 34, 0.3),
      0 2px 6px rgba(0, 0, 0, 0.1);
    background: var(--bolete-accent);
    border: 2px solid rgba(255, 255, 255, 0.25);
  }

  .species-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* ============================================
   Mobile Bottom Sheet (768px and below)
   ============================================ */
@media (max-width: 768px) {
  /* Header adjustments */
  .header-subtitle {
    display: none;
  }

  .header-search {
    max-width: 200px;
    margin: 0 15px;
  }

  .header-link span {
    display: none;
  }

  /* Header login button - show icon only on mobile */
  .header-login-btn span {
    display: none;
  }

  .header-login-btn {
    padding: 8px 12px;
  }

  /* Hide the old mobile FAB toggle */
  .mobile-filter-toggle {
    display: none !important;
  }

  /* Results adjustments */
  .results-header {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .results-sort {
    justify-content: space-between;
  }

  /* Species grid - single column with padding for bottom sheet */
  .species-grid {
    grid-template-columns: 1fr;
    padding: 15px;
    padding-bottom: calc(
      130px + env(safe-area-inset-bottom, 0px)
    ); /* Space for collapsed bottom sheet + iOS safe area */
    gap: 15px;
  }

  /* Constrain card images on mobile to prevent stretching */
  .species-card {
    max-width: 100%;
  }

  .species-card-image {
    aspect-ratio: 16 / 10;
    width: 100%;
    max-height: 200px; /* Cap maximum height on mobile */
  }

  .species-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  /* List view adjustments */
  .species-list-header,
  .species-list-row {
    grid-template-columns: 1fr 80px;
  }

  .species-list-header > *:nth-child(2),
  .species-list-header > *:nth-child(3),
  .species-list-header > *:nth-child(5),
  .species-list-row > *:nth-child(2),
  .species-list-row > *:nth-child(3),
  .species-list-row > *:nth-child(5) {
    display: none;
  }

  /* Modal full screen */
  .modal-content {
    width: 100%;
    max-width: none;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-species-traits {
    grid-template-columns: 1fr;
  }

  .disclaimer {
    font-size: 0.6875rem;
  }

  /* ========== BOTTOM SHEET STYLES ========== */

  /* Transform sidebar into bottom sheet - MUST reset tablet translateX */
  .filters-sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-height: 85vh;
    z-index: 100;
    /* Reset tablet translateX and apply bottom sheet translateY */
    transform: translateX(0) translateY(calc(100% - 120px));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 20px 20px 0 0;
    box-shadow:
      0 -8px 30px rgba(0, 0, 0, 0.25),
      0 -2px 10px rgba(0, 0, 0, 0.1);
    border-right: none;
    border-top: 2px solid var(--bolete-primary);
    background: linear-gradient(to bottom, #ffffff 0%, var(--bolete-bg) 100%);
    /* Add iOS safe area padding at bottom */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .filters-sidebar.open {
    transform: translateX(0) translateY(0);
    box-shadow:
      0 -12px 40px rgba(0, 0, 0, 0.3),
      0 -4px 15px rgba(0, 0, 0, 0.15);
  }

  /* Drag handle */
  .filters-sidebar::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 5px;
    background: var(--bolete-primary);
    border-radius: 3px;
    z-index: 10;
    opacity: 0.6;
  }

  /* Bottom sheet header - always visible */
  .filters-header {
    padding: 26px 20px 16px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    min-height: 90px;
    box-sizing: border-box;
    background: linear-gradient(to bottom, rgba(139, 69, 19, 0.08) 0%, transparent 100%);
    border-bottom: 1px solid rgba(139, 69, 19, 0.1);
    /* Add extra bottom padding for iOS safe area */
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .filters-header h2 {
    font-size: 1.0625rem;
    color: var(--bolete-primary);
  }

  .filters-header h2 i {
    color: var(--bolete-primary);
  }

  /* Species count in bottom sheet header */
  .species-count-box {
    display: none; /* Hide the original count box */
  }

  /* Hide mobile-sheet-count when collapsed - show only when open */
  .mobile-sheet-count {
    display: none;
  }

  .filters-sidebar.open .mobile-sheet-count {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px 12px;
    border-bottom: 1px solid var(--bolete-border);
    margin-bottom: 12px;
  }

  .sheet-expand-indicator {
    display: flex;
  }

  .active-filters-badge {
    display: inline-flex !important;
  }

  /* Hide when no active filters - JS controls this */
  .active-filters-badge[style*='display: none'] {
    display: none !important;
  }

  /* Hide desktop-only elements on mobile */
  .desktop-only {
    display: none !important;
  }

  .mobile-sheet-count .count-display {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--bolete-primary);
  }

  .mobile-sheet-count .count-display span {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--bolete-text-light);
    margin-left: 4px;
  }

  /* Filter content area */
  .filters-content {
    padding: 0 20px 40px;
    max-height: calc(85vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Optimize filter groups for touch */
  .filter-group {
    margin-bottom: 20px;
  }

  .filter-label {
    font-size: 0.875rem;
    margin-bottom: 10px;
  }

  /* Larger touch targets for toggles */
  .toggle-btn {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.8125rem;
  }

  /* Color swatches - larger for touch */
  .color-checkbox-item {
    padding: 10px 12px;
    min-height: 44px;
  }

  .color-swatch {
    width: 20px;
    height: 20px;
  }

  /* Checkbox items - larger touch targets */
  .filter-checkbox-item {
    min-height: 44px;
    padding: 8px 0;
  }

  .filter-checkbox-item input[type='checkbox'] {
    width: 20px;
    height: 20px;
  }

  /* Trait checkboxes - larger touch targets */
  .trait-checkbox {
    min-height: 48px;
    padding: 12px 14px;
  }

  .trait-checkbox input[type='checkbox'] {
    width: 22px;
    height: 22px;
  }

  .trait-checkbox .checkbox-label {
    font-size: 0.875rem;
  }

  /* Edibility badges - larger */
  .edibility-badge {
    padding: 6px 14px;
    font-size: 0.75rem;
  }

  /* Slider - larger thumb for touch */
  .single-slider::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
  }

  .single-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }

  /* More filters section */
  .filter-section.collapsible .filter-section-title {
    padding: 12px 0;
    min-height: 44px;
  }

  /* Select dropdowns */
  .filter-select {
    min-height: 44px;
    font-size: 0.875rem;
  }

  /* Overlay when bottom sheet is expanded */
  .bottom-sheet-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .bottom-sheet-overlay.visible {
    display: block;
    opacity: 1;
  }

  /* Active filters indicator on collapsed sheet */
  .filters-header .active-filters-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--bolete-secondary);
    color: white;
    border-radius: 10px;
    font-size: 0.6875rem;
    font-weight: 600;
    margin-left: 8px;
  }

  /* Expand/collapse indicator */
  .sheet-expand-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--bolete-primary);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 6px 12px;
    background: rgba(139, 69, 19, 0.1);
    border-radius: 16px;
  }

  .sheet-expand-indicator i {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
  }

  .filters-sidebar.open .sheet-expand-indicator i {
    transform: rotate(180deg);
  }

  .filters-sidebar.open .sheet-expand-indicator {
    background: var(--bolete-primary);
    color: white;
  }
}

/* ============================================
   Small phones (480px and below)
   ============================================ */
@media (max-width: 480px) {
  .bolete-header {
    padding: 0 15px;
  }

  .header-brand h1 {
    font-size: 1.125rem;
  }

  .header-search {
    display: none;
  }

  /* Scrollable page layout */
  html,
  body {
    overflow: auto;
    height: auto;
  }

  #bolete-app {
    height: auto;
    min-height: 100vh;
  }

  .bolete-main {
    flex-direction: column;
    overflow: visible;
  }

  .results-area {
    overflow: visible;
    min-height: auto;
  }

  .species-grid {
    overflow: visible;
    min-height: auto;
    padding-bottom: calc(
      140px + env(safe-area-inset-bottom, 0px)
    ); /* More space for bottom sheet + iOS safe area */
  }

  /* Smaller max-height for images on small phones */
  .species-card-image {
    max-height: 180px;
  }

  /* Two-column color swatches on small screens */
  .color-checkbox-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* Stack toggle buttons if too many */
  .toggle-group[data-filter='pore_size'] {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

  /* Footer hidden on mobile - bottom sheet takes that space */
  .bolete-footer {
    display: none;
  }
}

/* ============================================
   Pro Access Control Styles
   ============================================ */

/* Filter Lock Banner */
.filter-lock-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #f8f4e8 0%, #f0e8d8 100%);
  border: 1px solid #d4c4a8;
  border-radius: 8px;
  pointer-events: auto;
}

.filter-lock-banner i.fa-lock {
  font-size: 1.125rem;
  color: #8b7355;
}

.filter-lock-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.filter-lock-text strong {
  font-size: 0.875rem;
  color: #5a4a3a;
}

.filter-lock-text span {
  font-size: 0.75rem;
  color: #8b7355;
}

/* Locked Filters State */
.filters-locked .filters-content {
  position: relative;
}

.filters-locked .filter-section,
.filters-locked .filter-group,
.filters-locked .common-only-wrapper {
  opacity: 0.5;
  pointer-events: none;
}

.filters-locked .search-wrapper {
  opacity: 0.5;
}

.filters-locked .search-wrapper input {
  pointer-events: none;
  cursor: not-allowed;
}

/* Pro Upgrade Button */
.pro-upgrade-btn {
  padding: 8px 16px;
  background: #4a7c59;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s;
  white-space: nowrap;
}

.pro-upgrade-btn:hover {
  background: #3d6a4a;
  transform: translateY(-1px);
}

.pro-upgrade-btn:active {
  transform: translateY(0);
}

/* Modal Pro Locked Sections */
.pro-locked-section {
  position: relative;
  min-height: 120px;
  background: #f8f8f8;
  border-radius: 8px;
  overflow: hidden;
}

.pro-locked-section h4 {
  padding: 16px 16px 0;
  margin: 0;
  color: #999;
}

.pro-locked-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(248, 248, 248, 0.95);
  text-align: center;
}

.pro-locked-overlay i.fa-lock {
  font-size: 1.75rem;
  color: #bbb;
  margin-bottom: 12px;
}

.pro-locked-overlay p {
  margin: 0 0 16px;
  color: #888;
  font-size: 0.875rem;
}

/* Mobile adjustments for lock banner */
@media (max-width: 768px) {
  .filter-lock-banner {
    padding: 10px 12px;
    gap: 10px;
    margin-bottom: 12px;
  }

  .filter-lock-banner i.fa-lock {
    font-size: 1rem;
  }

  .filter-lock-text strong {
    font-size: 0.8125rem;
  }

  .filter-lock-text span {
    font-size: 0.6875rem;
  }

  .pro-upgrade-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
  }

  .pro-locked-section {
    min-height: 100px;
  }

  .pro-locked-overlay i.fa-lock {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }

  .pro-locked-overlay p {
    font-size: 0.8125rem;
    margin-bottom: 12px;
  }
}

/* ============================================
   Lightbox (High-Resolution Zoom)
   ============================================ */

.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.lightbox-overlay.active {
  opacity: 1;
}

.lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
}

.lightbox-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 10;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 10;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

.lightbox-image-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  padding: 60px 80px;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition:
    opacity 0.3s ease,
    transform 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.lightbox-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-loading .loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
}

.lightbox-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 25px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: white;
}

.lightbox-attribution {
  font-size: 0.8125rem;
  opacity: 0.85;
}

.lightbox-counter {
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.9;
}

/* Lightbox mobile adjustments */
@media (max-width: 768px) {
  .lightbox-close {
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    font-size: 1.125rem;
  }

  .lightbox-nav {
    width: 44px;
    height: 44px;
    font-size: 1.125rem;
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }

  .lightbox-image-wrapper {
    padding: 50px 15px 70px;
  }

  .lightbox-footer {
    padding: 12px 15px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .lightbox-attribution {
    font-size: 0.6875rem;
    max-width: 70%;
  }

  .lightbox-counter {
    font-size: 0.75rem;
  }
}

/* Zoom hint on main modal image */
.modal-species-image.has-photo .gallery-main-image {
  cursor: zoom-in;
}

.modal-species-image.has-photo::after {
  content: '';
  position: absolute;
  bottom: 45px;
  right: 10px;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.5)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3Cpath d='M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z'/%3E%3C/svg%3E")
    center/18px no-repeat;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.modal-species-image.has-photo:hover::after {
  opacity: 1;
}
