:root {
  --green-900: #1a3320;
  --green-800: #1e4d2b;
  --green-700: #2d6a3b;
  --green-600: #3d8b4e;
  --green-500: #4caf50;
  --green-400: #66bb6a;
  --green-300: #81c784;
  --green-200: #a5d6a7;
  --green-100: #c8e6c9;
  --green-50: #e8f5e9;
  --earth-800: #4e342e;
  --earth-700: #5d4037;
  --earth-600: #6d4c41;
  --earth-500: #795548;
  --earth-200: #bcaaa4;
  --sky-50: #e1f5fe;
  --sky-100: #b3e5fc;
  --cream-50: #fff8e1;
  --cream-100: #ffecb3;
  --cream-200: #ffe082;
  --white: #ffffff;
  --shadow: 0 2px 8px rgba(0,0,0,0.12);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.15);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--green-50);
  color: var(--earth-800);
  line-height: 1.6;
  min-height: 100vh;
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
header {
  background: linear-gradient(135deg, var(--green-800), var(--green-700));
  color: var(--white);
  padding: 20px 24px;
  border-radius: 0 0 var(--radius) var(--radius);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

header h1 {
  font-size: 1.8rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.leaf-icon { font-size: 1.6rem; }

nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

nav a {
  color: var(--green-100);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: var(--transition);
}

nav a:hover, nav a.active {
  background: rgba(255,255,255,0.15);
  color: var(--white);
}

/* Views */
.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

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

.card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--green-100);
}

.card-body {
  padding: 14px 16px 16px;
}

.card h3 {
  font-size: 1rem;
  color: var(--green-800);
  margin-bottom: 4px;
}

.card .subtitle {
  font-size: 0.82rem;
  color: var(--earth-600);
  margin-bottom: 6px;
}

.card .subtitle i { font-style: italic; }

.card-stats {
  display: flex;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--earth-500);
}

.card-stats span {
  display: flex;
  align-items: center;
  gap: 3px;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-right: 4px;
  margin-bottom: 4px;
}

/* Stats cards */
#home-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card .num {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--green-700);
}

.stat-card .label {
  font-size: 0.82rem;
  color: var(--earth-600);
  margin-top: 4px;
}

/* Section titles */
.section-title {
  font-size: 1.2rem;
  color: var(--green-800);
  margin: 20px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--green-200);
}

/* Detail header */
.detail-header { margin-bottom: 20px; }

.detail-header h2 {
  font-size: 1.5rem;
  color: var(--green-800);
}

.detail-header .subtitle {
  font-size: 0.85rem;
  color: var(--earth-600);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--green-100);
  color: var(--green-700);
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  margin-bottom: 12px;
  transition: var(--transition);
}

.back-btn:hover { background: var(--green-200); }

/* Data lists */
.data-list {
  list-style: none;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.data-list li {
  padding: 12px 16px;
  border-bottom: 1px solid var(--green-50);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
}

.data-list li:last-child { border-bottom: none; }
.data-list li:hover { background: var(--cream-50); }

.data-list .left {
  display: flex;
  flex-direction: column;
}

.data-list .name {
  font-weight: 500;
  color: var(--earth-800);
}

.data-list .meta {
  font-size: 0.78rem;
  color: var(--earth-500);
}

.data-list .right {
  font-size: 0.82rem;
  color: var(--earth-600);
  text-align: right;
}

/* Section card (for species detail) */
.section-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.section-card h3 {
  font-size: 1rem;
  color: var(--green-700);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--green-100);
}

/* Facts box */
.facts-box {
  background: var(--cream-50);
  border-left: 3px solid var(--green-500);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 12px 0;
  font-size: 0.9rem;
  color: var(--earth-700);
}

.facts-box + .facts-box { margin-top: 8px; }

/* Image gallery */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.gallery img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.gallery img:hover { transform: scale(1.03); }

/* Map */
#map {
  height: 500px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 16px 0;
}

/* Search */
.search-box {
  margin: 16px 0;
}

.search-box input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--green-200);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus { border-color: var(--green-500); }

/* Timeline items */
.timeline-item {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: var(--transition);
}

.timeline-item:hover {
  box-shadow: var(--shadow-lg);
  transform: translateX(4px);
}

.timeline-item .date-badge {
  display: inline-block;
  background: var(--green-700);
  color: var(--white);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.timeline-item h3 {
  font-size: 1rem;
  color: var(--green-800);
}

.timeline-item .timeline-stats {
  font-size: 0.82rem;
  color: var(--earth-600);
  margin-top: 4px;
}

/* Species detail grid */
.sp-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.sp-detail-grid .full-width { grid-column: 1 / -1; }

@media (max-width: 768px) {
  .sp-detail-grid { grid-template-columns: 1fr; }
  #home-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Empty state */
.empty-state {
  text-align: center;
  color: var(--earth-500);
  padding: 40px 20px;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--green-100);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.72rem;
  color: var(--green-800);
  margin-left: 4px;
}

/* Footer */
footer {
  text-align: center;
  padding: 24px 0 16px;
  color: var(--earth-500);
  font-size: 0.8rem;
  border-top: 1px solid var(--green-100);
  margin-top: 32px;
}

/* Filter chips */
.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.chip {
  padding: 4px 14px;
  border-radius: 14px;
  border: 1px solid var(--green-200);
  background: var(--white);
  color: var(--earth-700);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
}

.chip:hover, .chip.active {
  background: var(--green-700);
  color: var(--white);
  border-color: var(--green-700);
}

/* Leaflet custom markers */
.place-marker {
  background: var(--green-600);
  border: 2px solid white;
  border-radius: 50%;
  width: 12px;
  height: 12px;
}

/* Place detail tree list */
.tree-list {
  list-style: none;
}

.tree-list li {
  padding: 8px 12px;
  border-bottom: 1px solid var(--green-50);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tree-list li:hover { background: var(--cream-50); }
.tree-list li:last-child { border-bottom: none; }

/* Skeleton loading placeholder */
.skeleton {
  background: linear-gradient(90deg, var(--green-100) 25%, var(--green-50) 50%, var(--green-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Mini stat row */
.mini-stats {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--earth-500);
  margin-top: 4px;
}
