/* ============================================
   Handy Spins - Routes page
   Builds on css/style.css variables
   ============================================ */

.routes-app {
  padding-top: 1rem;
}

/* --- Year tabs --- */
.year-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.year-tab {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  padding: 0.45rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.year-tab:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.year-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* --- Trip meta bar --- */
.trip-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1.5rem;
  margin-bottom: 1rem;
}

.trip-meta h2 {
  font-size: 1.6rem;
  margin: 0;
}

.trip-meta .meta-item {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.trip-meta .meta-item strong {
  color: var(--text-primary);
}

/* --- A9 banner --- */
.a9-banner {
  background: rgba(255, 82, 82, 0.1);
  border: 1px solid rgba(255, 82, 82, 0.35);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

/* --- Filter chips --- */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.chip:hover {
  color: var(--text-primary);
}

.chip.active {
  color: var(--text-primary);
  border-color: var(--chip-color, var(--accent));
  background: var(--bg-card-hover);
}

.chip .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--chip-color, var(--accent));
  flex: none;
}

.chip .count {
  color: var(--text-muted);
  font-size: 0.8em;
}

/* --- Map --- */
#map {
  height: 62vh;
  min-height: 380px;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  box-shadow: var(--shadow);
}

.map-hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0.6rem 0 2rem;
}

.leaflet-container {
  font-family: var(--font);
  background: #0b0b12;
}

.leaflet-container a {
  color: var(--accent);
}

.leaflet-tooltip.route-tip {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 0.85rem;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow);
}

.leaflet-popup-content {
  font-size: 0.9rem;
}

.leaflet-bar a {
  background: var(--bg-card);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

.leaflet-bar a:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.leaflet-control-layers {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.leaflet-control-attribution {
  background: rgba(7, 7, 12, 0.7) !important;
  color: var(--text-muted);
}

.leaflet-control-attribution a {
  color: var(--text-secondary);
}

/* --- Route groups & cards --- */
.route-group {
  margin-bottom: 2.2rem;
}

.route-group > h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.route-group > h3 .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: none;
}

.route-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.route-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--route-color, var(--accent));
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.route-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.route-card.selected {
  border-color: var(--route-color, var(--accent));
  background: var(--bg-card-hover);
  box-shadow: 0 0 0 1px var(--route-color, var(--accent)), var(--shadow);
}

.route-card.muted-card {
  opacity: 0.6;
  cursor: default;
}

.route-card.muted-card:hover {
  transform: none;
}

.route-card h4 {
  font-size: 1.05rem;
  line-height: 1.3;
  margin: 0;
}

.route-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.badge-ai {
  background: rgba(192, 132, 252, 0.15);
  border-color: rgba(192, 132, 252, 0.5);
  color: #d8b4fe;
}

.badge-warn {
  background: rgba(255, 82, 82, 0.12);
  border-color: rgba(255, 82, 82, 0.4);
  color: #ff8a8a;
}

.route-stats {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}

.route-stats span {
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  letter-spacing: normal;
}

.route-notes {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0;
}

.route-stops {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.route-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.3rem;
}

.btn-sm {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  background: var(--bg-secondary);
  transition: var(--transition);
}

.btn-sm:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm.btn-gpx {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-sm.btn-gpx:hover {
  background: var(--accent-hover);
  color: #fff;
}

/* --- Provenance note --- */
.provenance {
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  padding: 1.2rem 0 2.5rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  #map {
    height: 48vh;
  }

  .route-cards {
    grid-template-columns: 1fr;
  }

  .trip-meta {
    gap: 0.3rem 1rem;
  }
}

/* --- Toolbar --- */
.routes-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.search-box {
  flex: 1 1 260px;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.search-box:focus {
  border-color: var(--accent);
}

.search-box::placeholder {
  color: var(--text-muted);
}

.sort-select {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-random {
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
}

.near-tag {
  color: #4da3ff !important;
}

.group-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font);
  font-weight: 400;
  letter-spacing: normal;
}

.no-results {
  color: var(--text-muted);
  padding: 2rem 0 3rem;
}

.locate-control a {
  font-size: 1rem;
  line-height: 30px;
  text-align: center;
  text-decoration: none;
}

.badge-by {
  background: rgba(0, 212, 170, 0.1);
  border-color: rgba(0, 212, 170, 0.4);
  color: var(--accent-alt);
}

.credit-item {
  color: var(--accent-alt);
}
