/* Pawgust — fresh nature-inspired theme */

:root {
  --bg-page: #f7faf5;
  --bg-sidebar: #ffffff;
  --bg-stat: #ffffff;
  --bg-active: #e8f5e9;
  --text-primary: #1b4332;
  --text-secondary: #3d5a45;
  --text-muted: #6b8f71;
  --accent: #2d6a4f;
  --accent-light: #52b788;
  --accent-dark: #1b4332;
  --border: #d8e8dc;
  --shadow: 0 2px 12px rgba(45, 106, 79, 0.08);
  --shadow-lg: 0 8px 24px rgba(45, 106, 79, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Nunito", system-ui, -apple-system, sans-serif;
  --route-color: #40916c;
  --route-active: #1b4332;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: linear-gradient(135deg, #d8f3dc 0%, #b7e4c7 50%, #95d5b2 100%);
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.btn-donate {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 700;
  color: #ffffff;
  text-decoration: none;
  background: var(--accent-dark);
  border: 2px solid var(--accent-dark);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.btn-donate:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header__icon {
  font-size: 2rem;
  line-height: 1;
}

.header__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-dark);
  letter-spacing: -0.02em;
}

.header__subtitle {
  margin: 0.125rem 0 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Stats */
.stats {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
}

.stat-card {
  flex: 1 1 0;
  min-width: 0;
  background: var(--bg-stat);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 0.875rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.stat-card__value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-card__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: auto;
}

.stat-card__detail {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.3;
  min-height: 1.05rem;
}

.stat-card__detail--spacer {
  visibility: hidden;
}

.stat-card__bar-spacer {
  height: 0.375rem;
  margin: 0.125rem 0;
  flex-shrink: 0;
}

.goal-progress__bar {
  height: 0.375rem;
  margin: 0.125rem 0;
  flex-shrink: 0;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.goal-progress__fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-light), var(--accent));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.goal-progress__fill--complete {
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
}

@media (max-width: 520px) {
  .stats {
    gap: 0.5rem;
    padding: 1rem;
  }

  .stat-card {
    padding: 0.75rem 0.5rem;
  }

  .stat-card__value {
    font-size: 1.25rem;
  }

  .stat-card__detail {
    font-size: 0.625rem;
    min-height: 0.875rem;
  }

  .stat-card__label {
    font-size: 0.625rem;
    letter-spacing: 0.02em;
  }
}

/* Main layout */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

.sidebar {
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem 1.5rem;
  max-height: 40vh;
  overflow-y: auto;
}


.sidebar__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.sidebar__toolbar .sidebar__heading {
  margin: 0;
}

.btn-all-trails {
  flex-shrink: 0;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--bg-active);
  border: 1px solid var(--accent-light);
  border-radius: 999px;
  padding: 0.375rem 0.875rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-all-trails:hover {
  background: #d8f3dc;
  border-color: var(--accent);
}

.sidebar__heading {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.walk-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.walk-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  min-height: 48px;
  border-left: 3px solid transparent;
}

.walk-item:hover {
  background: var(--bg-active);
  border-color: var(--accent-light);
}

.walk-item.active {
  background: var(--bg-active);
  border-color: var(--accent-light);
  border-left-color: var(--accent);
  box-shadow: var(--shadow);
}

.walk-item.error {
  opacity: 0.7;
  border-left-color: #c1121f;
}

.walk-item__date {
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 3.5rem;
}

.walk-item__info {
  flex: 1;
  min-width: 0;
}

.walk-item__title {
  display: block;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.walk-item__distance {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 600;
}

.walk-item__badge {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #c1121f;
  background: #fde8e8;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
}

.walk-detail {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.walk-detail__notes {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.walk-detail__photo {
  display: block;
  margin-top: 0.75rem;
  max-width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

/* Map */
.map-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 50vh;
}

.map {
  flex: 1;
  min-height: 320px;
  z-index: 0;
}

.map-hint {
  margin: 0;
  padding: 0.625rem 1.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  text-align: center;
  line-height: 1.5;
}

.map-hint a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.map-hint a:hover {
  color: var(--accent-dark);
}

/* Leaflet overrides */
.leaflet-container {
  font-family: var(--font);
}

/* Loading / empty states */
.loading,
.empty-state {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.5;
}

.empty-state a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.empty-state a:hover {
  color: var(--accent-dark);
}

.error-banner {
  margin: 0 1.5rem 1rem;
  padding: 0.75rem 1rem;
  background: #fde8e8;
  color: #9b2226;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
}

/* Desktop */
@media (min-width: 768px) {
  .stats {
    padding: 1.25rem 1.5rem;
    max-width: none;
  }

  .main {
    flex-direction: row;
    align-items: stretch;
    padding: 0 1.5rem 1.5rem;
    gap: 1rem;
  }

  .sidebar {
    flex: 0 0 340px;
    max-height: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-top: 0;
  }

  .map-panel {
    flex: 1;
    min-height: 480px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
  }

  .map {
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .map-hint {
    border-radius: 0 0 var(--radius) var(--radius);
  }
}

@media (min-width: 1024px) {
  .sidebar {
    flex-basis: 380px;
  }

  .header {
    padding: 1.5rem 2rem;
  }

  .stats {
    padding-left: 2rem;
  }

  .main {
    padding: 0 2rem 2rem;
  }
}
