/* Ride Heatmap v2 — light frosted-glass panels over a Positron basemap.
   Values transcribed from the Claude Design prototype (Ride Heatmap v2.dc.html). */

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

* { box-sizing: border-box; }

body {
  font-family: "Manrope", sans-serif;
  color: #17181c;
}

a { color: #ffd400; text-decoration: none; }
a:hover { color: #d9b500; }

/* ---- Leaflet chrome ---- */

.leaflet-container {
  font-family: "Manrope", sans-serif;
  background: #eef0f2;
}

.leaflet-control-attribution {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.7);
}

/* ---- Layout ---- */

.rh-app {
  position: fixed;
  inset: 0;
}

.rh-map {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.rh-panels {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1000;
  width: 344px;
  /* Leave room for the bottom-left zoom control even with a long ride list. */
  max-height: calc(100vh - 130px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- Frosted-glass panels ---- */

.rh-panel {
  background: rgba(238, 240, 243, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: none;
  border-radius: 2px;
  box-shadow: 0 10px 30px rgba(10, 12, 18, 0.22);
  overflow: hidden;
  flex-shrink: 0;
}

.rh-panel--rides {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex-shrink: 1;
}

.rh-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.rh-panel-header--main { padding: 16px 18px; }

.rh-panel-header--rides {
  padding: 15px 18px;
  flex-shrink: 0;
}

.rh-panel-body { padding: 0 18px 18px; }

.rh-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffd400;
  box-shadow: 0 0 12px #ffd400;
  animation: rhpulse 2.2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes rhpulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.rh-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 19px;
  margin: 0;
  letter-spacing: -0.01em;
  flex: 1;
  color: #17181c;
}

.rh-chevron {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  color: #17181c;
  background: #ffd400;
  border-radius: 2px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.rh-chevron--collapsed { transform: rotate(-90deg); }

.rh-subtitle {
  margin: 0 0 16px;
  font-size: 12.5px;
  color: rgba(23, 24, 28, 0.55);
  line-height: 1.4;
}

/* ---- Stats ---- */

.rh-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.rh-stat-card {
  flex: 1;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 2px;
  padding: 13px 15px;
}

.rh-stat-value {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 25px;
  letter-spacing: -0.02em;
  color: #17181c;
  line-height: 1;
}

.rh-stats--secondary {
  margin-top: -6px;
}

.rh-stat-value--small {
  font-size: 17px;
}

.rh-stat-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(23, 24, 28, 0.5);
  margin-top: 6px;
}

/* ---- Heatmap / Routes toggle ---- */

.rh-mode-toggle {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  padding: 4px;
  margin-bottom: 16px;
}

.rh-seg-btn {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: all 0.15s;
  background: transparent;
  color: rgba(23, 24, 28, 0.5);
}

.rh-seg-btn--active {
  background: #17181c;
  color: #fff;
  box-shadow: 0 2px 8px rgba(10, 12, 18, 0.25);
}

/* ---- Dropzone ---- */

.rh-dropzone {
  border: 1px dashed rgba(23, 24, 28, 0.3);
  border-radius: 2px;
  padding: 16px 14px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.3);
  transition: all 0.15s;
}

.rh-dropzone--over {
  border-color: #ffd400;
  background: rgba(255, 212, 0, 0.14);
}

.rh-dropzone-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  color: #17181c;
}

.rh-dropzone-hint {
  font-size: 11.5px;
  color: rgba(23, 24, 28, 0.5);
  margin-top: 4px;
}

/* ---- Rides panel ---- */

.rh-rides-label {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #17181c;
}

.rh-count-badge {
  min-width: 22px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 2px;
  background: rgba(23, 24, 28, 0.1);
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(23, 24, 28, 0.7);
}

.rh-spacer { flex: 1; }

/* ---- Ride search ---- */

.rh-search {
  position: relative;
  padding: 0 18px 10px;
  flex-shrink: 0;
}

.rh-search-input {
  width: 100%;
  padding: 8px 32px 8px 11px;
  border: 1px solid rgba(23, 24, 28, 0.18);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.45);
  font-family: "Manrope", sans-serif;
  font-size: 12.5px;
  color: #17181c;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.rh-search-input::placeholder {
  color: rgba(23, 24, 28, 0.4);
}

.rh-search-input:focus {
  border-color: #ffd400;
  background: rgba(255, 255, 255, 0.7);
}

.rh-search-clear {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(calc(-50% - 5px));
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 2px;
  background: rgba(23, 24, 28, 0.12);
  color: rgba(23, 24, 28, 0.6);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.rh-search-clear:hover {
  background: #ffd400;
  color: #17181c;
}

/* ---- Ride list sorting ---- */

.rh-sort {
  display: flex;
  gap: 4px;
  border-radius: 2px;
  padding: 3px;
  margin-bottom: 8px;
  /* Stay pinned while the ride list scrolls underneath (issue #8); near-
     opaque frosted background so passing rows don't bleed through. */
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(234, 237, 240, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.rh-sort-btn {
  flex: 1;
  padding: 5px 0;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: all 0.15s;
  background: transparent;
  color: rgba(23, 24, 28, 0.5);
}

.rh-sort-btn--active {
  background: #17181c;
  color: #fff;
}

.rh-inline-form { display: inline-flex; }

.rh-clear-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 11.5px;
  color: rgba(23, 24, 28, 0.45);
  cursor: pointer;
  font-family: "Manrope", sans-serif;
}

.rh-clear-btn:hover { color: #b38f00; }

.rh-rides-body {
  overflow-y: auto;
  padding: 0 18px 16px;
  min-height: 150px;
}

.rh-ride-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rh-ride-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.4);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.rh-ride-item:hover {
  background: rgba(255, 255, 255, 0.65);
  color: inherit;
}

.rh-ride-item--active {
  background: rgba(255, 212, 0, 0.3);
  box-shadow: inset 2px 0 0 #ffd400;
}

/* display:flex above would beat the UA [hidden] rule while searching */
.rh-ride-item[hidden] {
  display: none;
}

.rh-ride-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.rh-ride-info {
  flex: 1;
  min-width: 0;
}

.rh-ride-name {
  font-size: 13px;
  font-weight: 600;
  color: #17181c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rh-ride-distance {
  font-size: 11px;
  color: rgba(23, 24, 28, 0.5);
  margin-top: 1px;
}

.rh-ride-places {
  font-size: 10.5px;
  color: rgba(23, 24, 28, 0.45);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rh-ride-leg {
  margin-left: 6px;
  font-size: 12px;
  color: rgba(23, 24, 28, 0.45);
}

.rh-ride-chip {
  flex-shrink: 0;
  height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 2px;
  background: rgba(255, 212, 0, 0.35);
  font-size: 11px;
  font-weight: 700;
  color: rgba(23, 24, 28, 0.75);
}

.rh-ride-delete {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 2px;
  border: none;
  background: transparent;
  color: rgba(23, 24, 28, 0.35);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.rh-ride-delete:hover {
  background: rgba(255, 212, 0, 0.4);
  color: #17181c;
}

.rh-empty {
  padding: 16px 12px;
  text-align: center;
  font-size: 12.5px;
  color: rgba(23, 24, 28, 0.5);
  background: rgba(255, 255, 255, 0.35);
  border-radius: 2px;
  line-height: 1.5;
}

/* ---- Route details panel ---- */

.rh-details-frame {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: block;
  width: 320px;
  max-height: calc(100vh - 130px);
}

.rh-details {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 130px);
}

.rh-details-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  flex-shrink: 0;
}

.rh-details-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 15px;
  margin: 0;
  flex: 1;
  color: #17181c;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.rh-details-close {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: none;
  border-radius: 2px;
  background: #ffd400;
  color: #17181c;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.rh-details-body {
  padding: 0 18px 18px;
  overflow-y: auto;
}

.rh-details-facts {
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rh-details-facts > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
}

.rh-details-facts dt {
  color: rgba(23, 24, 28, 0.5);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.09em;
  padding-top: 2px;
}

.rh-details-facts dd {
  margin: 0;
  font-weight: 600;
  color: #17181c;
  text-align: right;
}

.rh-details-chart-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(23, 24, 28, 0.5);
  margin-bottom: 6px;
}

.rh-elevation-chart {
  width: 100%;
  height: auto;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  margin-bottom: 14px;
}

.rh-elevation-area {
  fill: rgba(255, 212, 0, 0.3);
}

.rh-elevation-line {
  fill: none;
  stroke: #17181c;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.rh-elevation-tick {
  font-family: "Manrope", sans-serif;
  font-size: 9px;
  fill: rgba(23, 24, 28, 0.55);
}

.rh-details-pending {
  font-size: 11.5px;
  color: rgba(23, 24, 28, 0.5);
  background: rgba(255, 255, 255, 0.35);
  border-radius: 2px;
  padding: 10px 12px;
  margin-bottom: 14px;
  line-height: 1.45;
}

.rh-danger-form {
  display: block;
}

.rh-danger-btn {
  width: 100%;
  padding: 9px 0;
  border: 1px solid rgba(255, 10, 84, 0.45);
  border-radius: 2px;
  background: rgba(255, 10, 84, 0.08);
  color: #d40045;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.15s;
}

.rh-danger-btn:hover {
  background: #ff0a54;
  border-color: #ff0a54;
  color: #fff;
}

/* ---- My location ---- */

.rh-locate {
  position: absolute;
  bottom: 26px;
  right: 26px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: rgba(238, 240, 243, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #17181c;
  border: none;
  border-radius: 2px;
  font-family: "Manrope", sans-serif;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(10, 12, 18, 0.22);
}

.rh-locate-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffd400;
  box-shadow: 0 0 8px #ffd400;
}

/* ---- Scrollbar ---- */

.rh-scroll::-webkit-scrollbar { width: 7px; }
.rh-scroll::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.25); border-radius: 8px; }
.rh-scroll::-webkit-scrollbar-track { background: transparent; }
