/* RideRoute Plugin Styles v1.2.0 - Minimalist Map & Player UI */
body.rr-no-scroll {
  overflow: hidden !important;
}

.rr-theater-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  z-index: 99980;
}

.rr-card {
  margin: 1.5rem 0;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #ffffff;
  color: #111827;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  overscroll-behavior-x: contain;
  font-variant-numeric: tabular-nums;
}

.rr-card * {
  box-sizing: border-box;
}

/* 网页大屏（剧场模式） */
.rr-card.is-theater {
  position: fixed !important;
  inset: 16px !important;
  z-index: 99990 !important;
  margin: 0 !important;
  border-radius: 16px;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
}

.rr-card.is-theater .rr-header {
  padding: 12px 18px 10px;
}

.rr-card.is-theater .rr-desc {
  display: none;
}

.rr-card.is-theater .rr-stats {
  margin-top: 8px;
  padding-top: 8px;
}

.rr-card.is-theater .rr-map-wrap {
  flex: 1 1 auto;
  min-height: 240px;
  display: flex;
  flex-direction: column;
}

.rr-card.is-theater .rr-map {
  height: 100% !important;
  flex: 1 1 auto;
}

.rr-card.is-theater .rr-profile-svg-box {
  height: 88px;
}

.rr-loading,
.rr-error {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

.rr-error {
  color: #dc2626;
}

/* Header: 清爽标题 + 无边框指标条 */
.rr-header {
  padding: 18px 20px 14px;
  background: #ffffff;
  flex-shrink: 0;
}

.rr-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.rr-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #111827;
}

.rr-date-range {
  font-size: 12px;
  color: #9ca3af;
  font-weight: 500;
}

.rr-desc {
  margin: 5px 0 0;
  font-size: 13px;
  color: #6b7280;
}

.rr-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}

.rr-stat {
  padding: 0 12px;
  border-right: 1px solid #f3f4f6;
}

.rr-stat:first-child {
  padding-left: 0;
}

.rr-stat:last-child {
  border-right: none;
  padding-right: 0;
}

.rr-stat-label {
  font-size: 11px;
  color: #9ca3af;
  display: block;
}

.rr-stat-val {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin-top: 2px;
  display: block;
  letter-spacing: -0.01em;
}

/* 分段选择器：轻盈柔和的浅底 Chip，无杂乱描边 */
.rr-seg-bar {
  padding: 10px 20px 12px;
  background: #f9fafb;
  border-top: 1px solid #f3f4f6;
  border-bottom: 1px solid #eef0f3;
  flex-shrink: 0;
}

.rr-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rr-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: #ffffff;
  color: #4b5563;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.rr-pill:hover {
  color: #111827;
  background: #ffffff;
  border-color: #d1d5db;
}

.rr-pill.is-active {
  background: #111827;
  color: #ffffff;
  border-color: #111827;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.18);
}

.rr-pill.is-hidden-extra {
  display: none;
}

.rr-pill-km {
  opacity: 0.68;
  font-size: 11px;
  font-weight: 400;
}

.rr-pill-toggle {
  background: transparent;
  box-shadow: none;
  color: #2563eb;
  border: 1px dashed #bfdbfe;
}

.rr-pill-toggle:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.rr-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Map Area & Floating Glass Controls */
.rr-map-wrap {
  position: relative;
  width: 100%;
  background: #e5e7eb;
}

.rr-map {
  width: 100%;
  height: 480px;
}

.rr-map .ol-attribution {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.78);
}

.rr-map .ol-zoom {
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  padding: 2px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.12);
}

.rr-map .ol-zoom button {
  background: transparent;
  color: #374151;
  border-radius: 6px;
  width: 26px;
  height: 26px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.rr-map .ol-zoom button:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #111827;
}

/* 地图右上角悬浮毛玻璃控制条 */
.rr-map-floating {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rr-glass-group {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 9px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.14);
  padding: 3px;
  gap: 2px;
}

.rr-glass-btn {
  height: 28px;
  padding: 0 9px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #374151;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.rr-glass-btn:hover {
  background: rgba(15, 23, 42, 0.07);
  color: #111827;
}

.rr-glass-btn.is-active {
  background: #111827;
  color: #ffffff;
}

.rr-glass-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-left: 7px;
  color: #4b5563;
}

.rr-glass-select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  height: 28px;
  padding: 0 20px 0 4px;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  outline: none;
}

.rr-glass-select-wrap::after {
  content: "";
  position: absolute;
  right: 7px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid #6b7280;
  border-bottom: 1.5px solid #6b7280;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

/* 二级底图切换浮层 */
.rr-layer-wrap {
  position: relative;
}

.rr-layer-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 248px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  z-index: 30;
  display: none;
}

.rr-layer-popover.is-open {
  display: block;
}

.rr-layer-sec + .rr-layer-sec {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

.rr-layer-sec-title {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  margin-bottom: 6px;
}

.rr-layer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.rr-layer-chip {
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #4b5563;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}

.rr-layer-chip:hover {
  background: #f3f4f6;
  color: #111827;
}

.rr-layer-chip.is-active {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
}

.rr-glass-divider {
  width: 1px;
  height: 16px;
  background: rgba(15, 23, 42, 0.1);
  margin: 0 2px;
}

.rr-map-badge {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 5;
  background: rgba(17, 24, 39, 0.62);
  backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.92);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  pointer-events: none;
}

/* 高德地图左下角有官方 Logo 与审图号，角标移至左上角留白区避免遮挡 */
.rr-card.is-provider-amap .rr-map-badge {
  bottom: auto;
  top: 12px;
  left: 12px;
}

/* 底部轨迹播放器 + 海拔剖面区 */
.rr-profile-wrap {
  padding: 12px 20px 14px;
  border-top: 1px solid #eef0f3;
  background: #ffffff;
  position: relative;
  flex-shrink: 0;
}

.rr-player-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.rr-player-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rr-play-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #111827;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.22);
  transition: transform 0.12s ease, background 0.15s ease;
  padding: 0;
}

.rr-play-circle:hover {
  background: #2563eb;
  transform: scale(1.04);
}

.rr-play-circle.is-playing {
  background: #f97316;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.32);
}

.rr-icon-btn {
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #4b5563;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.rr-icon-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

.rr-icon-btn.is-active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #2563eb;
}

/* 分段式倍速切换器（取代原生 select） */
.rr-speed-seg {
  display: inline-flex;
  align-items: center;
  background: #f3f4f6;
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}

.rr-speed-opt {
  height: 24px;
  padding: 0 7px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}

.rr-speed-opt:hover {
  color: #111827;
}

.rr-speed-opt.is-active {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
}

.rr-profile-range {
  font-size: 12px;
  color: #6b7280;
}

.rr-profile-svg-box {
  position: relative;
  width: 100%;
  height: 112px;
  user-select: none;
  touch-action: none;
  cursor: crosshair;
  border-radius: 8px;
  background: #fafcff;
  border: 1px solid #f1f5f9;
  overflow: hidden;
}

.rr-profile-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.rr-profile-tip {
  position: absolute;
  top: 6px;
  left: 8px;
  background: rgba(17, 24, 39, 0.88);
  color: #ffffff;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  display: none;
  z-index: 4;
}

/* Generic modal buttons */
.rr-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #1f2937;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rr-btn:hover {
  background: #f3f4f6;
}

.rr-btn-primary {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
}

.rr-btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

/* Unlock & Photo Modal */
.rr-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(3px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.rr-modal {
  background: #ffffff;
  border-radius: 14px;
  width: 100%;
  max-width: 380px;
  padding: 20px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

.rr-modal h4 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #111827;
}

.rr-modal p {
  margin: 0 0 14px;
  font-size: 13px;
  color: #6b7280;
}

.rr-input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 10px;
}

.rr-modal-err {
  color: #dc2626;
  font-size: 12px;
  margin-bottom: 10px;
  min-height: 16px;
}

.rr-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.rr-lightbox {
  max-width: 90vw;
  max-height: 90vh;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.rr-lightbox img {
  max-width: 88vw;
  max-height: 75vh;
  object-fit: contain;
  display: block;
}

.rr-lightbox-cap {
  padding: 10px 14px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

@media (max-width: 640px) {
  .rr-card.is-theater {
    inset: 6px !important;
    max-height: calc(100vh - 12px);
  }
  .rr-header,
  .rr-seg-bar,
  .rr-profile-wrap {
    padding-left: 14px;
    padding-right: 14px;
  }
  .rr-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 0;
  }
  .rr-stat:nth-child(2) {
    border-right: none;
  }
  .rr-stat:nth-child(3) {
    padding-left: 0;
  }
  .rr-map {
    height: 360px !important;
  }
  .rr-glass-btn span.rr-hide-sm {
    display: none;
  }
}
