/* WoC Species Profile — CSS
   Shared layout from distribution + species-specific styles */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { max-width: 100%; overflow-x: hidden; width: 100%; height: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-image: linear-gradient(rgba(82, 139, 184, 0.35), rgba(42, 106, 148, 0.35)), url("/images/wallpaper.jpg");
  background-size: cover; background-position: center top;
  background-attachment: fixed; background-repeat: no-repeat;
  color: #1a1a2e;
}

/* App.css */
.App { display: flex; height: 100vh; width: 100%; overflow: hidden; }
.app-content { flex: 1; height: 100vh; overflow: auto; display: flex; flex-direction: column; position: relative; }
.app-routes { flex: 1; }
.dashboard.right-side { padding: 0; background-image: linear-gradient(rgba(82, 139, 184, 0.35), rgba(42, 106, 148, 0.35)), url('/images/wallpaper.jpg'); background-size: cover; background-position: center top; background-attachment: fixed; background-repeat: no-repeat; min-height: 100%; }
.top-navbar { display: none; }
.woc-footer { background: #1a4a6e; color: rgba(255,255,255,0.65); text-align: center; padding: 0.55rem 1rem; font-size: 0.72rem; letter-spacing: 0.03em; flex-shrink: 0; }
.woc-footer a { color: rgba(255,255,255,0.9); text-decoration: none; font-weight: 600; }
.woc-footer a:hover { text-decoration: underline; }

/* Sidebar.css */
.sidebar { width: 280px; min-width: 260px; height: 100vh; padding: 1.2rem; background: #548CB6; display: flex; flex-direction: column; gap: 1.2rem; font-family: Inter, system-ui, sans-serif; box-sizing: border-box; z-index: 1001; }
.sidebar-close { display: none; }
.sidebar-overlay { display: none; }
.sidebar-auth { display: flex; justify-content: center; gap: 0.4rem; font-size: 1rem; color: #fff; }
.sidebar-auth span { cursor: pointer; }
.sidebar-auth span:hover { text-decoration: underline; }
.sidebar-auth .divider { cursor: default; color: rgba(255,255,255,0.4); }
.sidebar-auth .divider:hover { text-decoration: none; }
.sidebar-logo { width: 160px; margin: 0 auto; display: block; }
.sidebar-card { background: white; border-radius: 14px; padding: 1rem; box-shadow: 0 10px 25px rgba(0,0,0,0.08); display: flex; flex-direction: column; gap: 0.6rem; }
.sidebar-card h3 { margin-bottom: 0.4rem; text-align: center; }
.sidebar-card label { font-size: 0.8rem; color: #444; }
.sidebar-card select { padding: 0.4rem; border-radius: 8px; border: 1px solid #ccc; font-size: 0.85rem; }
.btn-modern { background: transparent; color: #548CB6; border: 2px solid #548CB6; border-radius: 10px; padding: 0.45rem; margin-top: 0.6rem; cursor: pointer; font-weight: 600; font-size: 0.9rem; text-decoration: none; }
.btn-modern:hover { background: #548CB6; color: white; }
.btn-modern:disabled { opacity: 0.5; cursor: not-allowed; }
.sidebar-tagline { text-align: center; padding: 0.3rem 0.5rem 0.5rem; }
.tagline-main { color: rgba(255,255,255,0.9); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.25rem; }
.tagline-sub { color: rgba(255,255,255,0.6); font-size: 0.68rem; font-weight: 400; letter-spacing: 0.02em; }

/* RecordDetails.css */
.record-page { padding: 1.5rem 1.5rem 0; max-width: 100%; width: 100%; margin: auto; font-family: Inter, system-ui, sans-serif; background: transparent; overflow-x: hidden; box-sizing: border-box; }
.card { background: white; border-radius: 14px; padding: 1.25rem; box-shadow: 0 12px 30px rgba(0,0,0,0.08); margin-bottom: 1.25rem; text-align: left; width: 100%; max-width: 100%; box-sizing: border-box; overflow: hidden; min-width: 0; }
.card h2 { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #94a3b8; margin-bottom: 0.75rem; }
.map-only { height: 62vh; min-height: 420px; width: 100%; border-radius: 14px; overflow: hidden; box-shadow: 0 12px 28px rgba(0,0,0,0.12); margin-bottom: 1.25rem; position: relative; }
#map { width: 100%; height: 100%; }
.leaflet-container { height: 100%; width: 100%; }
/* Hide default Leaflet zoom control (top-right gets crowded) */
.leaflet-top.leaflet-right { display: none !important; }

/* Species title */
.species-title { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; font-size: 1.6rem; font-weight: 700; margin: 0; }
.species-title em { font-style: italic; }
.species-author { font-size: 0.95rem; font-weight: 400; color: #555; font-style: normal; }
.external-icon { color: #2563eb; display: inline-flex; align-items: center; text-decoration: none; }
.external-icon:hover { color: #1e40af; }

/* Taxonomy */
.taxonomy-list { display: flex; flex-wrap: wrap; gap: 0.3rem; padding-bottom: 4px; max-width: 100%; width: 100%; min-width: 0; }
.taxonomy-chip { background: #eef2ff; color: #3730a3; padding: 0.12rem 0.45rem; border-radius: 999px; font-size: 0.72rem; white-space: nowrap; flex-shrink: 0; }
.taxonomy-hover-wrap { position: relative; padding-right: 2rem; }
.taxonomy-copy-btn { position: absolute; top: 0; right: 0; opacity: 0; transition: opacity 0.15s; background: white; border: 1px solid #d0d0d0; border-radius: 6px; padding: 2px 7px; font-size: 0.85rem; color: #555; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.1); z-index: 1; }
.taxonomy-copy-btn:hover { background: #f0f5ff; color: #2563eb; }
.taxonomy-hover-wrap:hover .taxonomy-copy-btn { opacity: 1; }

/* IUCN */
.iucn-not-rated { display: inline-flex; align-items: center; background: #94a3b8; color: white; border-radius: 8px; padding: 0.35rem 0.75rem; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.05em; }
.iucn-badge { display: inline-flex; align-items: center; gap: 0.4rem; color: white; border-radius: 8px; padding: 0.35rem 0.75rem; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.03em; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,0.18); text-decoration: none; }

@media (min-width: 768px) {
  .card-name-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 165px; gap: 1.25rem; align-items: stretch; margin-bottom: 1.25rem; }
  .card-name-wrap > .card { margin-bottom: 0; height: 110px; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
}

/* Section Tabs */
.section-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.25rem; background: transparent; padding: 0; }
.section-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.35rem; padding: 0.5rem 1rem; border-radius: 10px; border: 2px solid var(--tab-color); background: white; color: var(--tab-color); font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: all 0.18s; letter-spacing: 0.02em; white-space: nowrap; }
.section-tab:hover:not(.disabled) { background: color-mix(in srgb, var(--tab-color) 10%, transparent); }
.section-tab.active { background: var(--tab-color) !important; color: white !important; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.section-tab.disabled { opacity: 0.35; cursor: not-allowed; }
.tab-icon { font-size: 0.9rem; line-height: 1; }
.tab-content { border-left: 3px solid var(--tab-color); padding-left: 0.75rem; border-radius: 0 0 0 4px; }
.tab-card { border-top: 2px solid var(--tab-color) !important; }

/* Record counts */
.record-counts { display: flex; gap: 10px; flex-wrap: wrap; }
.count-badge { padding: 6px 14px; border-radius: 10px; font-weight: 600; font-size: 0.82rem; }
.count-badge.total { background: #f1f5f9; color: #1e293b; border: 1px solid #e2e8f0; }
.count-badge.indigenous { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.count-badge.non-indigenous { background: #faf5ff; color: #7c3aed; border: 1px solid #e9d5ff; }
.count-badge.masked { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }

/* Map overlays */
.map-loading { position: absolute; inset: 0; background: rgba(255,255,255,0.85); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; z-index: 10; }
.spinner { width: 32px; height: 32px; border: 3px solid #cbd5e1; border-top-color: #548CB6; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.map-loading span { font-size: 0.85rem; color: #64748b; }

/* Legend (from LayeredMap.tsx) */
.map-legend-wrap { position: absolute; bottom: 8px; left: 12px; z-index: 1000; font-family: Inter, system-ui, sans-serif; pointer-events: auto; max-width: 240px; }
.legend-toggle-btn { display: block; width: 100%; background: rgba(255,255,255,0.93); border: none; border-radius: 8px; padding: 5px 12px; font-size: 0.72rem; font-weight: 600; color: #334155; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.18); letter-spacing: 0.04em; text-align: center; }
.map-dl-btn { display: block; width: 100%; margin-bottom: 6px; background: rgba(255,255,255,0.95); border: 1px solid #1a4a6e55; border-radius: 8px; padding: 5px 12px; font-size: 0.72rem; font-weight: 600; color: #1a4a6e; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.18); letter-spacing: 0.04em; text-align: center; }
.map-dl-btn:hover { background: #fff; }
@media (max-width: 767px) { .map-dl-btn { display: none !important; } }
.legend-panel { background: rgba(255,255,255,0.95); backdrop-filter: blur(6px); border-radius: 12px; padding: 10px 13px; box-shadow: 0 4px 18px rgba(0,0,0,0.14); min-width: 230px; }
.legend-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.legend-header-title { font-weight: 700; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: #64748b; }
.legend-close-btn { background: none; border: none; cursor: pointer; font-size: 0.8rem; color: #94a3b8; padding: 0; line-height: 1; }
.legend-check-item { display: flex; align-items: center; gap: 7px; font-size: 0.78rem; color: #1e293b; margin-bottom: 6px; cursor: pointer; user-select: none; }
.legend-check-item input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; accent-color: #2563eb; flex-shrink: 0; }
.legend-swatch { display: inline-block; width: 13px; height: 13px; border-radius: 3px; flex-shrink: 0; }

/* Compact map attribution */
.compact-attr { font-family: Inter, system-ui, sans-serif; }
.attr-toggle {
  width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(255,255,255,0.75);
  color: #64748b; font-size: 0.7rem; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  display: flex; align-items: center; justify-content: center; margin-left: auto;
}
.attr-toggle:hover { background: white; }
.attr-text {
  background: rgba(255,255,255,0.9); border-radius: 6px; padding: 3px 8px; margin-top: 4px;
  font-size: 0.62rem; color: #64748b; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.attr-text a { color: #548CB6; text-decoration: none; }

/* Map counts (below legend, independent width) */
.map-counts {
  display: none;
}
.map-counts .map-count-badge {
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  backdrop-filter: blur(6px);
}
.map-count-badge.total { background: rgba(255,255,255,0.85); color: #1e293b; }
.map-count-badge.indigenous { background: rgba(22,163,106,0.15); color: #16a34a; border: 1px solid rgba(22,163,106,0.3); }
.map-count-badge.non-indigenous { background: rgba(124,58,237,0.15); color: #7c3aed; border: 1px solid rgba(124,58,237,0.3); }
.map-count-badge.masked { background: rgba(217,119,6,0.15); color: #d97706; border: 1px solid rgba(217,119,6,0.3); }

/* Control panel placeholder */
.cp-placeholder-text {
  font-size: 0.85rem;
  color: #94a3b8;
  font-style: italic;
}

/* Tab panels — hide/show */
.tab-panel { display: block; }
.tab-panel[style*="display:none"] { display: none !important; }

/* Control Panel — Search */
.cp-search-section { margin-bottom: 0.75rem; }
.cp-label { font-size: 0.78rem; font-weight: 600; color: #475569; display: block; margin-bottom: 0.4rem; }
.cp-search-row { display: flex; gap: 0.4rem; }
.cp-search-input {
  flex: 1; padding: 0.5rem 0.7rem; border: 1.5px solid #cbd5e1; border-radius: 8px;
  font-family: inherit; font-size: 0.85rem; color: #1e293b; background: #f8fafc;
}
.cp-search-input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.cp-search-btn {
  padding: 0.5rem 1.2rem; background: linear-gradient(135deg, #92400e, #b45309); color: white; border: none; border-radius: 10px;
  font-weight: 700; font-size: 0.82rem; cursor: pointer; white-space: nowrap; letter-spacing: 0.03em;
  box-shadow: 0 2px 8px rgba(146,64,14,0.25); transition: all 0.2s;
}
.cp-search-btn:hover { background: linear-gradient(135deg, #7c2d12, #92400e); box-shadow: 0 4px 12px rgba(146,64,14,0.35); transform: translateY(-1px); }
.cp-search-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.cp-hint { font-size: 0.68rem; color: #b0bec5; margin-top: 0.5rem; font-style: italic; letter-spacing: 0.01em; }
.cp-op-label {
  font-size: 0.75rem; font-weight: 600; color: #2563eb; text-transform: uppercase; letter-spacing: 0.02em;
  min-width: 70px; flex-shrink: 0; padding: 0.4rem 0;
}
.cp-check-all { font-size: 0.78rem; color: #475569; cursor: pointer; display: flex; align-items: center; gap: 0.3rem; }
.cp-check-all input { accent-color: #2563eb; cursor: pointer; }
.cp-access-tag {
  font-size: 0.6rem; padding: 1px 6px; border-radius: 4px; font-weight: 600;
}
.cp-access-tag.open { background: #dcfce7; color: #16a34a; }
.cp-access-tag.partial { background: #fef9c3; color: #a16207; }
.cp-access-tag.locked { background: #fee2e2; color: #dc2626; }

/* Search mode selector */
.cp-mode-row { margin-bottom: 0.5rem; }
.cp-mode-select {
  width: 100%; padding: 0.45rem 0.7rem; border: 1.5px solid #cbd5e1; border-radius: 8px;
  font-family: inherit; font-size: 0.82rem; color: #1e293b; background: #f8fafc; cursor: pointer;
}
.cp-mode-select:focus { outline: none; border-color: #92400e; box-shadow: 0 0 0 3px rgba(146,64,14,0.12); }

/* ═══ Search Engine — Premium Filter UI ═══ */
.cp-filter-row {
  display: flex; gap: 0.5rem; margin-bottom: 0.6rem; align-items: stretch;
  background: linear-gradient(135deg, #fafbfc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0; border-radius: 12px; padding: 0.5rem 0.6rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cp-filter-row:hover { border-color: #cbd5e1; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.cp-filter-row:focus-within { border-color: #92400e; box-shadow: 0 0 0 3px rgba(146,64,14,0.08); }
.cp-filter-field {
  width: 150px; flex-shrink: 0; padding: 0.4rem 0.5rem; border: none; border-radius: 8px;
  font-family: inherit; font-size: 0.75rem; font-weight: 600; color: #92400e; background: rgba(146,64,14,0.08);
  cursor: pointer; letter-spacing: 0.02em; text-transform: uppercase;
}
.cp-filter-field:focus { outline: none; background: rgba(146,64,14,0.14); }
.cp-filter-input-wrap { flex: 1; display: flex; align-items: center; gap: 0.3rem; min-width: 0; overflow: hidden; }
.cp-filter-input-wrap > div { flex: 1; min-width: 0; }
.cp-filter-input {
  flex: 1; padding: 0.4rem 0.6rem; border: none; border-radius: 8px;
  font-family: inherit; font-size: 0.85rem; color: #1e293b; background: transparent; width: 100%;
}
.cp-filter-input:focus { outline: none; }
.cp-filter-input::placeholder { color: #b0bec5; font-style: italic; font-size: 0.8rem; }
.cp-filter-select {
  width: 100%; padding: 0.4rem 0.5rem; border: none; border-radius: 8px;
  font-family: inherit; font-size: 0.85rem; color: #1e293b; background: transparent; cursor: pointer;
}
.cp-filter-select:focus { outline: none; }
.cp-filter-remove {
  width: 26px; height: 26px; border: none; background: transparent; color: #cbd5e1; font-size: 0.9rem;
  cursor: pointer; flex-shrink: 0; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.cp-filter-remove:hover { color: #dc2626; background: rgba(220,38,38,0.08); }
.cp-filter-actions {
  display: flex; gap: 0.5rem; margin-top: 0.35rem; align-items: center;
}
.cp-add-filter {
  padding: 0.4rem 0.8rem; background: transparent; border: 1.5px dashed #cbd5e1; border-radius: 10px;
  font-size: 0.75rem; color: #94a3b8; cursor: pointer; font-weight: 600; letter-spacing: 0.02em;
  transition: all 0.2s;
}
.cp-add-filter:hover { border-color: #92400e; color: #92400e; background: rgba(146,64,14,0.03); }
.cp-alert {
  margin-top: 0.5rem; padding: 0.55rem 0.75rem; border-radius: 8px; font-size: 0.78rem; line-height: 1.4;
  background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; animation: alertPulse 0.3s ease;
}
@keyframes alertPulse { 0% { transform: scale(0.98); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.cp-year-wrap { display: flex; align-items: center; gap: 0.4rem; width: 100%; }
.cp-year-wrap input[type="range"] {
  flex: 1; accent-color: #92400e; cursor: pointer; height: 4px;
  -webkit-appearance: none; appearance: none; background: #e2e8f0; border-radius: 2px; outline: none;
}
.cp-year-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: #92400e; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.cp-year-label { font-size: 0.72rem; color: #92400e; font-weight: 700; min-width: 32px; text-align: center; font-variant-numeric: tabular-nums; }
.cp-ncbi-label { font-size: 0.82rem; color: #16a34a; font-weight: 600; padding: 0.3rem 0; }

/* Search Results */
.cp-results { margin-top: 0.85rem; border-top: 1px solid #e2e8f0; padding-top: 0.85rem; }
.cp-results-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.cp-results-header span { font-size: 0.78rem; font-weight: 700; color: #475569; letter-spacing: 0.02em; }
.cp-clear-btn {
  font-size: 0.72rem; color: #94a3b8; background: none; border: 1px solid #e2e8f0;
  border-radius: 8px; padding: 3px 10px; cursor: pointer; transition: all 0.15s; font-weight: 500;
}
.cp-clear-btn:hover { color: #dc2626; border-color: #fca5a5; background: rgba(220,38,38,0.04); }
.cp-results-list { display: flex; flex-direction: column; gap: 0.4rem; }

.cp-result-item {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.7rem;
  background: linear-gradient(135deg, #fafbfc 0%, #f1f5f9 100%);
  border-radius: 10px; border: 1px solid #e2e8f0; transition: border-color 0.15s;
}
.cp-result-item:hover { border-color: #cbd5e1; }
.cp-result-checkbox { width: 16px; height: 16px; accent-color: #2563eb; cursor: pointer; flex-shrink: 0; }
.cp-result-species { font-size: 0.82rem; font-weight: 600; color: #1e293b; font-style: italic; flex: 1; }
.cp-result-counts { font-size: 0.7rem; color: #64748b; display: flex; gap: 0.5rem; }
.cp-result-count { padding: 1px 6px; border-radius: 6px; font-weight: 600; }
.cp-result-count.visible { background: #f0fdf4; color: #16a34a; }
.cp-result-count.masked { background: #fffbeb; color: #d97706; }
.cp-color-pick {
  width: 24px; height: 24px; border: 2px solid #e2e8f0; border-radius: 6px; cursor: pointer;
  padding: 0; overflow: hidden; flex-shrink: 0; -webkit-appearance: none; appearance: none;
}
.cp-color-pick::-webkit-color-swatch-wrapper { padding: 0; }
.cp-color-pick::-webkit-color-swatch { border: none; border-radius: 4px; }
.cp-color-pick::-moz-color-swatch { border: none; border-radius: 4px; }
.cp-color-pick:hover { border-color: #92400e; }

/* Raw Data year range — stacked dual slider */
.raw-year-slider {
  position: relative;
  height: 16px;
  width: 100%;
}
.raw-year-slider input[type="range"] {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 16px;
  -webkit-appearance: none; appearance: none;
  background: transparent;
  pointer-events: none;
  margin: 0; padding: 0;
  box-sizing: border-box;
  z-index: 1;
}
.raw-year-slider input[type="range"].range-active {
  z-index: 3;
}
.raw-year-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: #e2e8f0;
  border-radius: 2px;
}
.raw-year-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #2563eb;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  margin-top: -5px;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}
.raw-year-slider input[type="range"]::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #2563eb;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  border: none;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}
.raw-year-slider .raw-range-to::-webkit-slider-runnable-track { background: transparent; }
.raw-year-slider .raw-range-to::-moz-range-track { background: transparent; }
#panel-search .raw-year-slider input[type="range"]::-webkit-slider-thumb { background: #92400e; }
#panel-search .raw-year-slider input[type="range"]::-moz-range-thumb { background: #92400e; }

/* Info panel */
.info-panel { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,0.96); backdrop-filter: blur(6px); border-radius: 12px; padding: 14px 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.18); max-width: 340px; min-width: 240px; z-index: 1000; font-size: 0.82rem; color: #1e293b; max-height: 70%; overflow-y: auto; }
.info-close { position: absolute; top: 8px; right: 10px; background: none; border: none; cursor: pointer; font-size: 0.9rem; color: #94a3b8; }
.info-panel h4 { font-size: 0.85rem; font-weight: 700; margin-bottom: 8px; color: #2a6a94; }
.info-panel .info-row { display: flex; gap: 6px; margin-bottom: 4px; line-height: 1.4; }
.info-row .info-label { font-weight: 600; color: #64748b; min-width: 70px; flex-shrink: 0; }
.info-row .info-value { color: #1e293b; word-break: break-word; }
.info-row .info-value a { color: #2a6a94; text-decoration: underline; }

.record-page > *:last-child { margin-bottom: 0 !important; }

/* ═══ Welcome View — Ghost Placeholders (mirror of speciesView) ═══ */
.welcome-ghost-wrap {
  pointer-events: none;
}
.welcome-ghost-wrap .section-tabs {
  pointer-events: auto;
}
.welcome-ghost-card {
  background: rgba(255,255,255,0.12) !important;
  border: 1.5px dashed rgba(255,255,255,0.25) !important;
  box-shadow: none !important;
  backdrop-filter: blur(2px);
}
.welcome-ghost-line {
  height: 10px; border-radius: 6px;
  background: rgba(255,255,255,0.13);
  margin-bottom: 0.5rem;
}
.welcome-ghost-line.w60 { width: 60%; }
.welcome-ghost-line.w40 { width: 40%; }
.welcome-ghost-line.w50 { width: 50%; }
.welcome-ghost-chips { display: flex; gap: 0.3rem; margin-top: 0.25rem; }
.welcome-ghost-chips span {
  width: 52px; height: 18px; border-radius: 999px;
  background: rgba(255,255,255,0.1);
}
.welcome-ghost-badge {
  width: 80px; height: 28px; border-radius: 8px;
  background: rgba(255,255,255,0.1);
}
.map-only.welcome-ghost-map {
  background: rgba(255,255,255,0.07);
  border: 1.5px dashed rgba(255,255,255,0.18);
  box-shadow: none;
}
/* Welcome tab button states */
.welcome-tab-btn.wtab-disabled {
  opacity: 0.35; cursor: not-allowed;
}
.welcome-tab-btn .wtab-signin { display: none; }
.welcome-tab-btn.wtab-auth.needs-login {
  opacity: 0.45; cursor: not-allowed;
}
.welcome-tab-btn.wtab-auth.needs-login .wtab-label { display: none; }
.welcome-tab-btn.wtab-auth.needs-login .wtab-signin {
  display: inline; font-size: 0.72rem; font-weight: 500; font-style: italic;
}

/* MOBILE */
@media (max-width: 768px) {
  .App { overflow: visible; height: auto; min-height: 100vh; }
  .app-content { height: auto; min-height: 100vh; overflow: visible; }
  .app-routes { padding-top: 54px; }
  .dashboard.right-side { padding: 0; }
  body { background-image: linear-gradient(rgba(82, 139, 184, 0.35), rgba(42, 106, 148, 0.35)), url("/images/background.jpg") !important; }
  .dashboard.right-side { background-image: linear-gradient(rgba(82, 139, 184, 0.35), rgba(42, 106, 148, 0.35)), url("/images/background.jpg") !important; }
  .top-navbar { display: flex; position: fixed; top: 0; left: 0; right: 0; height: 54px; z-index: 1100; background: #548CB6; align-items: center; justify-content: space-between; padding: 0 0.85rem; box-shadow: 0 2px 14px rgba(0,0,0,0.28); gap: 0.5rem; }
  .navbar-logo { display: flex; align-items: center; gap: 0.45rem; color: white; font-weight: 700; font-size: 1rem; text-decoration: none; flex-shrink: 0; }
  .navbar-logo img { width: 32px; height: 32px; object-fit: cover; }
  .navbar-logo sup { font-size: 0.55em; vertical-align: super; }
  .navbar-species-btn { background: rgba(255,255,255,0.13); border: 1.5px solid rgba(255,255,255,0.35); border-radius: 20px; color: white; font-size: 0.82rem; font-weight: 600; padding: 0.42rem 1.1rem; cursor: pointer; white-space: nowrap; position: absolute; right: 0.85rem; top: 50%; transform: translateY(-50%); }
  .sidebar { position: fixed; top: 0; left: 0; width: 280px; min-width: 280px; max-width: 85vw; transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: 0 0 20px rgba(0,0,0,0.2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; align-self: flex-end; background: transparent; border: none; color: white; font-size: 1.4rem; cursor: pointer; }
  .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.35); opacity: 0; pointer-events: none; transition: opacity 0.25s ease; z-index: 1000; }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }
  .record-page { padding: 0.75rem; }
  .card { padding: 1rem; border-radius: 10px; margin-bottom: 0.75rem; }
  .card-name-wrap { margin-bottom: 0.75rem; }
  .card-name-wrap > .card { margin-bottom: 0.75rem; }
  .species-title { font-size: 1.2rem; }
  .species-author { font-size: 0.85rem; }
  .map-only { height: 45vh; min-height: 260px; border-radius: 10px; max-width: 100vw; overflow: hidden; box-sizing: border-box; }
  .map-only.map-compact { height: 32vh; min-height: 180px; }
  .dashboard.right-side, .record-page, .app-content { max-width: 100vw; overflow-x: hidden; }
  .leaflet-container { max-width: 100% !important; overflow: hidden !important; }
  .taxonomy-hover-wrap { display: none; }
  .external-icon { display: none; }
  .card, .map-only, .card-name-wrap { margin-bottom: 0.85rem !important; }
  .card-name-wrap > .card { margin-bottom: 0.85rem !important; }
  .section-tab { font-size: 0.72rem; padding: 0.4rem 0.5rem; }
  .map-counts { display: none !important; }
  .legend-panel { display: none; }
  .legend-toggle-btn { display: block !important; }
  .cp-search-section { max-width: 100%; overflow-x: hidden; }
  .cp-filter-row { flex-wrap: wrap; }
  .cp-year-wrap { min-width: 0; }
  .cp-year-wrap input[type="range"] { min-width: 0; flex: 1; }
  .tab-card { overflow: hidden; }
  #yearSliderRow { flex-wrap: wrap; }
  #yearSliderRow > span { width: 100%; margin-bottom: 0.2rem; }
  .info-panel { max-width: calc(100vw - 24px); min-width: 200px; right: 6px; top: 6px; }

  /* Welcome view — mobile floating buttons */
  .welcome-ghost-wrap { pointer-events: none; padding: 0 !important; }
  .welcome-ghost-wrap .card-name-wrap { display: none !important; }
  .welcome-ghost-wrap .map-only { display: none !important; }
  .welcome-ghost-wrap .section-tabs {
    pointer-events: auto;
    flex-direction: column; align-items: center; justify-content: center;
    gap: 0.85rem; padding: 1rem 2rem;
    height: calc(100dvh - 54px - 32px);
    height: calc(100vh - 54px - 32px);
    box-sizing: border-box;
    overflow: hidden;
  }
  @supports (height: 100dvh) {
    .welcome-ghost-wrap .section-tabs { height: calc(100dvh - 54px - 32px); }
  }
  .welcome-ghost-wrap .section-tab {
    flex: none; width: 220px; max-width: 80vw;
    padding: 0.7rem 1.2rem; border-radius: 14px;
    font-size: 0.88rem; border-width: 2.5px;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    backdrop-filter: blur(8px);
    animation: welcomePulse 4s ease-in-out infinite;
  }
  .welcome-ghost-wrap .section-tab:nth-child(1) { animation-delay: 0s; }
  .welcome-ghost-wrap .section-tab:nth-child(2) { animation-delay: 0.8s; }
  .welcome-ghost-wrap .section-tab:nth-child(3) { animation-delay: 1.6s; }
  .welcome-ghost-wrap .section-tab:nth-child(4) { animation-delay: 2.4s; }
  .welcome-ghost-wrap .section-tab:nth-child(5) { animation-delay: 3.2s; }
  .welcome-ghost-wrap .section-tab:nth-child(6) { animation-delay: 4.0s; }
  .welcome-ghost-wrap .section-tab:nth-child(7) { animation-delay: 4.8s; }
  .welcome-ghost-wrap .section-tab.wtab-disabled,
  .welcome-ghost-wrap .section-tab.wtab-auth.needs-login {
    animation: none;
  }
  @keyframes welcomePulse {
    0%, 70%, 100% { transform: scale(1); box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
    35% { transform: scale(1.04); box-shadow: 0 6px 22px rgba(0,0,0,0.22); }
  }
}

/* ═══ Species-specific: Footer reference cards ═══ */
.footer-cards {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.footer-ref-card {
  font-size: 0.75rem; color: #475569; line-height: 1.5;
}
.footer-ref-card h3 {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: #94a3b8; margin-bottom: 0.5rem;
}
.footer-ref-card .ref-title { font-weight: 600; color: #1e293b; margin-bottom: 0.25rem; }
.footer-ref-card .ref-meta { font-size: 0.68rem; color: #94a3b8; }
.footer-ref-card .ref-btn {
  display: inline-block; margin-top: 0.4rem; padding: 0.25rem 0.6rem;
  border: 1px solid #e2e8f0; border-radius: 6px; font-size: 0.68rem;
  color: #64748b; text-decoration: none; cursor: pointer; font-weight: 600;
}
.footer-ref-card .ref-btn:hover { background: #f1f5f9; color: #1e293b; }

@media (max-width: 768px) {
  .footer-cards { grid-template-columns: 1fr; }
}

/* ═══ Biogeography narrative ═══ */
#bioNarrative { font-size: 0.82rem; color: #1e293b; line-height: 1.7; }
#bioNarrative h3 { font-size: 0.78rem; font-weight: 700; color: #2563eb; margin: 1rem 0 0.4rem; text-transform: uppercase; letter-spacing: 0.05em; }
#bioNarrative ul { padding-left: 1.2rem; margin: 0.3rem 0; }
#bioNarrative li { margin-bottom: 0.2rem; }
#bioNarrative .bio-disclaimer { font-size: 0.72rem; font-style: italic; color: #dc2626; font-weight: 600; margin-top: 0.75rem; }
.bio-read-more {
  display: inline-block; margin-top: 0.5rem; padding: 0.3rem 0.8rem;
  background: linear-gradient(135deg, #2563eb, #1d4ed8); color: white;
  border: none; border-radius: 8px; font-size: 0.75rem; font-weight: 600;
  cursor: pointer; letter-spacing: 0.02em;
}
.bio-read-more:hover { background: linear-gradient(135deg, #1d4ed8, #1e40af); }

/* ═══ Ecology data ═══ */
.eco-overview { font-size: 0.82rem; color: #475569; line-height: 1.6; margin-bottom: 0.75rem; }

/* Filter buttons — rounded pills with category colors */
.eco-filter-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 0.85rem; }
.eco-cat-btn {
  padding: 0.3rem 0.75rem; border-radius: 20px;
  border: 1.5px solid var(--cat-active, #64748b);
  background: white; color: var(--cat-active, #64748b);
  font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.eco-cat-btn.active, .eco-cat-btn:hover {
  background: var(--cat-active, #64748b); color: white;
}
.eco-cat-btns { display: flex; gap: 0.3rem; flex-wrap: wrap; }

/* Scale toggle */
.eco-scale-toggle {
  display: flex; border-radius: 10px; overflow: hidden;
  border: 1.5px solid #16a34a; align-items: center; height: 32px;
}
.eco-scale-btn {
  padding: 0 1rem; border: none; background: white; color: #16a34a;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  transition: all 0.15s; white-space: nowrap; height: 100%;
  display: flex; align-items: center;
}
.eco-scale-btn:first-child { border-right: 1px solid #16a34a; }
.eco-scale-btn.active { background: #16a34a; color: white; }

/* Stats table */
.eco-var-table-wrap { max-height: 420px; overflow-y: hidden; border-radius: 8px; border: 1px solid #e2e8f0; transition: overflow 0.1s; }
.eco-var-table-wrap:hover, .eco-var-table-wrap:focus-within { overflow-y: auto; }
.eco-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.eco-table thead th {
  background: #f8fafc; padding: 0.5rem 0.75rem; text-align: left;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: #94a3b8; position: sticky; top: 0; z-index: 1;
  border-bottom: 1px solid #e2e8f0;
}
.eco-table tbody tr { cursor: default; transition: background 0.12s; }
.eco-table tbody tr:hover { background: #f0f9ff; }
.eco-table td { padding: 0.4rem 0.75rem; border-bottom: 1px solid #f1f5f9; color: #334155; }
.eco-var-name { font-family: monospace; font-size: 0.78rem; color: #1e293b; }
.eco-code {
  display: inline-block; padding: 0.1rem 0.4rem; border-radius: 4px;
  font-family: monospace; font-size: 0.72rem; font-weight: 600;
}
.eco-unit { color: #64748b; font-size: 0.72rem; }
.eco-stat { text-align: right; font-family: monospace; font-size: 0.75rem; color: #334155; white-space: nowrap; }
.eco-stat-mean { font-weight: 600; color: #1e293b; }

/* Download buttons */
.eco-dl-btns { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.eco-dl-row { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.85rem; line-height: 1; }
.eco-dl-label { font-size: 0.8rem; font-weight: 600; color: #64748b; white-space: nowrap; }
.eco-dl-row .btn-modern { margin-top: 0; }
.eco-dl-btn {
  padding: 0.3rem 0.7rem; border-radius: 8px; border: none;
  font-size: 0.72rem; font-weight: 600; cursor: pointer; color: white;
  background: linear-gradient(135deg, #16a34a, #15803d);
}
.eco-dl-btn:hover { background: linear-gradient(135deg, #15803d, #166534); }

/* Mobile ecology */
@media (max-width: 767px) {
  .eco-filter-row { gap: 0.3rem; }
  .eco-cat-btn { padding: 0.25rem 0.55rem; font-size: 0.7rem; }
  .eco-var-table-wrap { max-height: 320px; overflow-x: auto; }
  .eco-table { min-width: 640px; }
  .eco-var-name { font-size: 0.72rem; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ═══ Resource Cards (Bibliography, Archive, SEB) ═══ */
.resources-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem; margin-top: 0.75rem; align-items: start;
}
.resource-card {
  background: white !important; border-radius: 10px; padding: 0.7rem 1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  display: flex; flex-direction: column; gap: 0.25rem;
  border-top: 3px solid var(--tab-color, #2563eb); box-sizing: border-box;
  position: relative; z-index: 1;
}
.resource-icon { font-size: 1.3rem; line-height: 1; flex-shrink: 0; }
.resource-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #94a3b8; white-space: nowrap; }
.resource-sublabel { font-size: 0.72rem; color: #94a3b8; margin-top: -0.3rem; }
.resource-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.25rem; }
.resource-actions .btn-modern {
  font-size: 0.75rem; padding: 0.35rem 0.65rem;
  background: transparent; color: #548CB6; border: 2px solid #548CB6;
  border-radius: 10px; cursor: pointer; font-weight: 600; text-decoration: none;
  display: inline-flex; align-items: center; transition: all 0.15s;
}
.resource-actions .btn-modern:hover { background: #548CB6; color: white; }
@media (max-width: 767px) {
  .resources-row { grid-template-columns: 1fr; gap: 0.5rem; }
  .resource-card { padding: 0.75rem 1rem; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.15); background: white !important; opacity: 1 !important; }
  .resource-actions .btn-modern { font-size: 0.72rem; padding: 0.3rem 0.55rem; }
}

/* ═══ Eco Resources Row ═══ */
.eco-resources-row { margin-top: 0.75rem; }

/* ═══ Eco Raw Data Engine ═══ */
.eco-engine-card { padding: 0 !important; overflow: hidden; }
.eco-engine-header {
  background: linear-gradient(135deg, #14532d 0%, #0f3d22 100%);
  padding: 1rem 1.25rem 0.85rem; border-bottom: 1px solid #16a34a44;
}
.eco-engine-title-row { display: flex; align-items: flex-start; gap: 0.75rem; }
.eco-engine-title { font-size: 1rem; font-weight: 700; color: #fb923c; margin: 0 0 0.2rem; letter-spacing: 0.02em; }
.eco-engine-subtitle { font-size: 0.72rem; color: #a3c4a8; margin: 0; }
.eco-engine-body { padding: 1rem 1.25rem; background: #f0faf4; }
.eco-engine-info-text { font-size: 0.85rem; color: #94a3b8; margin: 0 0 1rem; line-height: 1.5; }
.eco-engine-trigger-btn { background: #f0faf4 !important; border: 1.5px solid #16a34a !important; color: #14532d !important; font-weight: 700; }
.eco-engine-trigger-btn:hover { background: #dcfce7 !important; border-color: #16a34a !important; }
.eco-engine-confirm-box { padding: 1rem 1.25rem; background: #f0faf4; border-top: 2px solid #16a34a33; }
.eco-engine-confirm-title { font-weight: 700; color: #166534; margin: 0 0 0.5rem; font-size: 0.9rem; }
.eco-engine-confirm-text { font-size: 0.8rem; color: #374151; margin: 0 0 0.85rem; line-height: 1.55; }
.eco-engine-human-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: #374151; margin-bottom: 0.85rem; cursor: pointer; }
.eco-engine-human-check input { accent-color: #16a34a; width: 15px; height: 15px; cursor: pointer; }
.eco-engine-confirm-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.eco-engine-confirm-yes {
  height: 36px !important; padding: 0 1rem !important;
  background: #16a34a22; border: 1.5px solid #16a34a !important;
  color: #166534 !important; font-weight: 600;
}
.eco-engine-confirm-yes:disabled { opacity: 0.35; cursor: not-allowed; }
.eco-engine-confirm-yes:not(:disabled):hover { background: #16a34a !important; color: white !important; }
.eco-engine-confirm-no {
  height: 36px !important; padding: 0 1rem !important;
  background: white !important; border: 1.5px solid #d1d5db !important; color: #374151 !important;
}
.eco-engine-confirm-no:hover { background: #f3f4f6 !important; }
.eco-engine-loading { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; padding: 2rem 1.25rem; }
.eco-engine-spinner {
  width: 32px; height: 32px; border: 3px solid #16a34a33;
  border-top-color: #16a34a; border-radius: 50%; animation: eco-spin 0.8s linear infinite;
}
@keyframes eco-spin { to { transform: rotate(360deg); } }
.eco-engine-loading p { font-size: 0.85rem; color: #94a3b8; margin: 0; }
.eco-engine-loading-sub { font-size: 0.75rem !important; color: #6b7280 !important; }
.eco-engine-results { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.eco-engine-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
@media (max-width: 600px) { .eco-engine-counts { grid-template-columns: repeat(2, 1fr); } }
.eco-count-card { display: flex; flex-direction: column; border-radius: 10px; overflow: hidden; border: 2px solid #13502c; }
.eco-count-box { border-radius: 0; padding: 0.6rem 0.5rem; text-align: center; display: flex; flex-direction: column; gap: 0.15rem; }
.eco-count-num { font-size: 1.3rem; font-weight: 700; line-height: 1; }
.eco-count-lbl { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; }
.eco-count-total { background: #1e293b; }
.eco-count-total .eco-count-num { color: #94a3b8; }
.eco-count-total .eco-count-lbl { color: #e2e8f0; }
.eco-count-indigenous { background: #431407; }
.eco-count-indigenous .eco-count-num { color: #fb923c; }
.eco-count-indigenous .eco-count-lbl { color: #e2e8f0; }
.eco-count-nonindig { background: #2e1065; }
.eco-count-nonindig .eco-count-num { color: #c4b5fd; }
.eco-count-nonindig .eco-count-lbl { color: #e2e8f0; }
.eco-count-cols { background: #0f1e2e; }
.eco-count-cols .eco-count-num { color: #60a5fa; }
.eco-count-cols .eco-count-lbl { color: #e2e8f0; }
.eco-count-dl {
  display: block; text-align: center; padding: 0.4rem 0.5rem;
  font-size: 0.65rem; font-weight: 600; text-decoration: none;
  letter-spacing: 0.02em; cursor: pointer; transition: background 0.15s;
}
.eco-count-dl-total { background: #94a3b8; color: #1e293b; }
.eco-count-dl-indigenous { background: #fb923c; color: #431407; }
.eco-count-dl-nonindig { background: #c4b5fd; color: #2e1065; }
.eco-count-dl-cols { background: #60a5fa; color: #0a1828; }
.eco-count-dl-total:hover { background: #cbd5e1; }
.eco-count-dl-indigenous:hover { background: #fdba74; }
.eco-count-dl-nonindig:hover { background: #ddd6fe; }
.eco-count-dl-cols:hover { background: #93c5fd; }
.eco-count-dl-disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.eco-engine-reset-btn {
  align-self: flex-start; font-size: 0.75rem; color: #6b7280;
  background: transparent; border: 1px solid #334155;
  border-radius: 6px; padding: 0.25rem 0.65rem; cursor: pointer;
}
.eco-engine-reset-btn:hover { color: #94a3b8; border-color: #475569; }
