/* ODT - Mobile-First Styles */

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  background: #fff;
  color: #1b1b1b;
  font-size: 14px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* Fullscreen map */
#mapContainer {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* ========== Button Groups ========== */
.btn-group-top-left {
  position: fixed;
  left: 24px;
  top: 12px;
  z-index: 20;
}

.btn-group-top-right,
.btn-group-bottom-right {
  position: fixed;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 20;
}

.btn-group-top-right { top: 12px; }
.btn-group-bottom-right { bottom: 88px; }

.btn-group-top-left button,
.btn-group-top-right button,
.btn-group-bottom-right button {
  width: 46px;
  height: 46px;
  border-radius: 23px;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #333;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-group-top-left button:active,
.btn-group-top-right button:active,
.btn-group-bottom-right button:active {
  transform: scale(0.92);
}

.btn-group-top-left button svg,
.btn-group-top-right button svg,
.btn-group-bottom-right button svg {
  width: 21px;
  height: 21px;
}

/* GPS toggle active state */
#btnGpsToggle.active {
  background: #22c55e;
  color: #fff;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

/* Kebab active state */
#btnKebab.active {
  background: #1b1b1b;
  color: #fff;
}

/* ========== Bottom Info Bar ========== */
.bottom-info-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0,0,0,0.1);
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Main row: Mile + 4 data cards */
.info-bar-main-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  height: 56px;
}

/* Full-width nearest strip below main row */
.info-bar-nearest-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  padding: 0 12px 5px;
}

.info-bar-nearest-row .info-label {
  flex-shrink: 0;
}

/* Daily miles block — pushed to the right of the nearest row */
.daily-miles-block {
  margin-left: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

/* The 4 data items fill remaining space equally */
.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  flex: 1;
  padding: 4px 0;
  min-width: 0;
}

.info-item[role="button"] {
  cursor: pointer;
}

.info-item[role="button"]:active {
  background: rgba(0,0,0,0.05);
}

.info-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.info-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  color: #737373;
  font-weight: 600;
  white-space: nowrap;
}

.info-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1b1b1b;
  line-height: 1;
  white-space: nowrap;
}

.info-value-mile {
  font-size: 1.1rem;
}

.info-value-nearest {
  font-size: 0.8rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Mile label in pair */
#mileLabel {
  font-size: 0.6rem;
}

.info-value.warning {
  color: #dc2626;
}

/* Off-trail state */
.info-value-mile.off-trail {
  color: #dc2626;
}

.info-label.off-trail-label {
  color: #dc2626;
}

/* ========== Settings Popover ========== */
.settings-popover {
  position: fixed;
  left: 92px;  /* default fallback; JS overrides to be right of layers button */
  top: 80px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-popover[hidden] { display: none; }

/* ========== Kebab Expanding Sub-Buttons ========== */

/* The kebab group is a flex column so sub-buttons stack below the main button */
#kebabGroup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.kebab-sub-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: kebab-expand 0.18s ease-out;
}

.kebab-sub-buttons[hidden] { display: none; }

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

/* Each sub-button: matches main map button size */
.kebab-sub-btn {
  width: 46px;
  height: 46px;
  border-radius: 23px;
  border: none;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: #333;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
}

.kebab-sub-btn svg {
  width: 18px;
  height: 18px;
}

.kebab-sub-label {
  font-size: 0.45rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  line-height: 1;
  color: #555;
}

.kebab-sub-btn:active {
  transform: scale(0.92);
}

/* Active state for stateful sub-buttons (test mode only — layers never shows active) */
.kebab-sub-btn.active {
  background: #1b1b1b;
  color: #fff;
}
.kebab-sub-btn.active .kebab-sub-label {
  color: rgba(255,255,255,0.7);
}

/* Layers button specifically: never show selected state */
#btnKebabLayers.active {
  background: rgba(255, 255, 255, 0.95);
  color: #333;
}
#btnKebabLayers.active .kebab-sub-label {
  color: #555;
}

/* ========== Weather API Key Setup Screen ========== */
.weather-api-setup {
  padding: 32px 24px;
  max-width: 360px;
  margin: 0 auto;
  text-align: center;
}

.weather-setup-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1b1b1b;
  margin: 0 0 10px;
}

.weather-setup-desc {
  font-size: 0.9rem;
  color: #555;
  margin: 0 0 20px;
  line-height: 1.5;
}

.weather-setup-desc a { color: #3b82f6; }

.weather-key-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.weather-key-input {
  flex: 1;
  padding: 10px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
  color: #1b1b1b;
  outline: none;
  min-width: 0;
  font-family: inherit;
}

.weather-key-input:focus { border-color: #1b1b1b; }

.weather-key-save {
  padding: 10px 16px;
  background: #1b1b1b;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-family: inherit;
}

.weather-key-save:active { transform: scale(0.95); }

.weather-key-hint {
  font-size: 0.78rem;
  color: #888;
  margin: 0;
  line-height: 1.5;
}

.weather-change-key {
  text-align: center;
  font-size: 0.78rem;
  color: #aaa;
  margin: 16px 0 8px;
  padding-bottom: 8px;
}

.weather-change-key a { color: #aaa; text-decoration: underline; }

/* ========== Mileage Log Modal ========== */
.mileage-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid #eee;
  flex-wrap: wrap;
}

.mileage-filter-label {
  font-size: 0.75rem;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mileage-date-input {
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  color: #1b1b1b;
  background: #fff;
}

.mileage-apply-btn {
  padding: 5px 12px;
  background: #1b1b1b;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.mileage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.mileage-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #888;
  border-bottom: 1px solid #eee;
}

.mileage-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #f0f0f0;
  color: #1b1b1b;
}

.mileage-today-row td {
  background: #f0f7ff;
  font-weight: 500;
}

.mileage-live-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #22c55e;
  color: #fff;
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 4px;
  vertical-align: middle;
  letter-spacing: 0.04em;
}

.mileage-range {
  font-size: 0.8rem;
  color: #777;
}

.mileage-delete-btn {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.mileage-delete-btn:hover { color: #e11d48; background: #fff0f3; }

.mileage-summary-row {
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  border-top: 2px solid #eee;
  text-align: center;
  background: #fafafa;
}

.mileage-empty {
  padding: 32px 24px;
  text-align: center;
  font-size: 0.9rem;
  color: #888;
}

/* Category toggle buttons (used in settings popover) */
.category-toggle-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 48px;
  color: #999;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  font-size: 0.9rem;
}

.category-toggle-btn:active {
  transform: scale(0.95);
}

.category-toggle-btn.active {
  background: rgba(0, 0, 0, 0.04);
}

.category-toggle-btn[data-category="water-reliable"].active {
  color: #3b82f6;
  border-color: #3b82f6;
}

.category-toggle-btn[data-category="water-other"].active {
  color: #94a3b8;
  border-color: #94a3b8;
}

.category-toggle-btn[data-category="towns"].active {
  color: #059669;
  border-color: #059669;
}

.category-toggle-btn[data-category="navigation"].active {
  color: #8b5cf6;
  border-color: #8b5cf6;
}

.category-toggle-btn[data-category="toilets"].active {
  color: #f59e0b;
  border-color: #f59e0b;
}

.category-toggle-btn[data-category="sections"].active {
  color: #1d4ed8;
  border-color: #1d4ed8;
}

.category-toggle-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.category-toggle-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.category-toggle-btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* ========== Full-screen Overlays ========== */
.fullscreen-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fullscreen-overlay[hidden] { display: none; }

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid #e5e5e5;
  flex-shrink: 0;
  background: #fff;
}

.overlay-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.overlay-close {
  background: none;
  border: 1.5px solid #bbb;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: #555;
  min-width: 60px;
  min-height: 36px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.overlay-close:active {
  background: #e5e5e5;
}

.elev-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.elev-jump-btn-top {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid #bbb;
  background: #fff;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.elev-jump-btn-top svg {
  width: 20px;
  height: 20px;
}

.elev-jump-btn-top:active {
  background: #e5e5e5;
}

.overlay-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Elevation overlay — canvas fills the available body space */
#elevationOverlay {
  position: fixed;
  inset: 0;
}

#elevationOverlay .overlay-body {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 16px;
  overflow: hidden;
  position: relative;
}

#elevationOverlay canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ========== Waypoint List Filter Bar ========== */
.overlay-filter-bar {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid #e5e5e5;
  padding: 0;
}

.filter-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-family: inherit;
  color: #737373;
  min-height: 52px;
}

.filter-btn svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.filter-btn span {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.filter-btn.active {
  color: #1b1b1b;
  border-bottom: 3px solid currentColor;
  background: rgba(0,0,0,0.05);
}

/* Per-category active tint colors */
.filter-btn[data-filter="reliable-water"].active { color: #3b82f6; background: rgba(59,130,246,0.08); }
.filter-btn[data-filter="other-water"].active    { color: #94a3b8; background: rgba(148,163,184,0.10); }
.filter-btn[data-filter="towns"].active          { color: #059669; background: rgba(5,150,105,0.08); }
.filter-btn[data-filter="navigation"].active     { color: #8b5cf6; background: rgba(139,92,246,0.08); }
.filter-btn[data-filter="toilets"].active        { color: #f59e0b; background: rgba(245,158,11,0.08); }
.filter-btn[data-filter="sections"].active       { color: #7c3aed; background: rgba(124,58,237,0.08); }

.filter-btn:active {
  background: rgba(0,0,0,0.04);
}

/* ========== Waypoint List Items ========== */
.waypoint-list-item {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5e5;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: stretch;
  gap: 0;
}

.waypoint-list-item:active {
  background: #f5f5f5;
}

/* Color bar on left edge indicating type */
.waypoint-list-bar {
  width: 5px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-right: 16px;
  align-self: stretch;
}
.waypoint-list-bar.bar-water-reliable { background: #3b82f6; }
.waypoint-list-bar.bar-water-other    { background: #94a3b8; }
.waypoint-list-bar.bar-towns          { background: #059669; }
.waypoint-list-bar.bar-navigation     { background: #8b5cf6; }
.waypoint-list-bar.bar-toilets        { background: #f59e0b; }
.waypoint-list-bar.bar-water          { background: #3b82f6; }
.waypoint-list-bar.bar-sections       { background: #7c3aed; }

.waypoint-list-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.waypoint-list-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.waypoint-list-name {
  font-weight: 700;
  font-size: 1rem;
  color: #1b1b1b;
  line-height: 1.2;
  flex: 1;
  min-width: 0;
}

.waypoint-list-mile {
  font-size: 0.95rem;
  color: #1b1b1b;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.waypoint-list-sub {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
  margin-bottom: 2px;
}
.waypoint-list-sub.sub-reliable  { color: #2563eb; }
.waypoint-list-sub.sub-seasonal  { color: #7c3aed; }
.waypoint-list-sub.sub-unreliable{ color: #dc2626; }
.waypoint-list-sub.sub-full      { color: #059669; }
.waypoint-list-sub.sub-limited   { color: #d97706; }
.waypoint-list-sub.sub-other     { color: #6b7280; }

.waypoint-list-desc {
  font-size: 0.82rem;
  color: #555;
  line-height: 1.35;
}

.waypoint-list-empty {
  padding: 48px 20px;
  text-align: center;
  color: #999;
  font-size: 0.95rem;
}

/* ========== About Modal ========== */
.about-modal-content {
  max-width: 340px;
  min-height: auto !important;
}

@media (max-width: 640px) {
  .about-modal-content {
    max-width: calc(100% - 48px);
    margin: 10vh 24px !important;
    border-radius: 12px !important;
    min-height: auto !important;
  }
}

.about-body {
  padding: 4px 0 12px;
}

.about-credit {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 10px;
  gap: 10px;
}

.about-avatar-pair {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.about-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.about-photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  border: 2px solid #e5e5e5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.about-photo-fallback {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #f0f0f0;
  align-items: center;
  justify-content: center;
  border: 2px solid #e5e5e5;
}

.about-photo-fallback svg {
  width: 36px;
  height: 36px;
}

.about-claude-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #e5e5e5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.about-claude-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.about-avatar-name {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #555;
}

.about-heart {
  font-size: 1.4rem;
  color: #ef4444;
  margin-bottom: 18px;
  line-height: 1;
}

.about-tagline {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1b1b1b;
  text-align: center;
  margin: 0;
}

.about-divider {
  border: none;
  border-top: 1px solid #e5e5e5;
  margin: 10px 0;
}

.about-info {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #444;
}

.about-info p {
  margin: 0 0 8px;
}

.about-info h4 {
  margin: 10px 0 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #888;
}

.about-info ul {
  margin: 0 0 6px;
  padding-left: 16px;
}

.about-info li {
  margin-bottom: 3px;
}

/* ========== View on Map Button ========== */
.view-on-map-btn {
  width: 100%;
  padding: 18px;
  margin-top: 12px;
  background: #1b1b1b;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-family: inherit;
}

.view-on-map-btn:active {
  background: #333;
}

.view-on-map-btn[hidden] { display: none; }

/* ========== Tables ========== */
table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #ccc;
}

th, td {
  border: 1px solid #ccc;
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f5f5f5;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Sticky header row */
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f5f5f5;
}
thead th.day-header { background: #e8eeff; }
thead th.night-header { background: #ebebf7; }

.location-header { min-width: 130px; }
.mile-header { min-width: 52px; text-align: center; }

.section-cell {
  width: 6px;
  padding: 0;
  border-right: none;
}

.section-indicator {
  width: 6px;
  height: 100%;
  min-height: 40px;
}

/* Section colors by region */
.section-1, .section-2, .section-3, .section-4 { background: #22c55e; }
.section-5, .section-6 { background: #84cc16; }
.section-7, .section-8, .section-9, .section-10, .section-11, .section-12 { background: #3b82f6; }
.section-13, .section-14, .section-15, .section-16, .section-17, .section-18, .section-19, .section-20 { background: #f59e0b; }
.section-21, .section-22, .section-23, .section-24, .section-25 { background: #ef4444; }

.location-cell { min-width: 130px; }

.location-name { font-weight: 600; font-size: 1rem; }
.location-name a { color: inherit; text-decoration: none; }
.location-name a:hover { color: #0066cc; text-decoration: underline; }

.elevation {
  font-size: 0.9rem;
  color: #555;
  margin-top: 3px;
}

.mile {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  min-width: 52px;
}

/* Forecast cells */
.day-header { background: #e8eeff; }

.forecast-cell {
  min-width: 80px;
  vertical-align: middle;
  padding: 8px 6px;
  cursor: pointer;
  transition: background 0.1s;
}
.forecast-cell:active { filter: brightness(0.95); }
.forecast-cell-active { outline: 2px solid #3b82f6; outline-offset: -2px; }

/* Icon left, values right */
.fc-inner {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fc-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: block;
}

.fc-values {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

/* High / Low temps row */
.fc-temps {
  display: flex;
  gap: 5px;
  align-items: baseline;
}

.fc-high {
  font-size: 1rem;
  font-weight: 700;
  color: #c0392b;
}

.fc-low {
  font-size: 0.9rem;
  font-weight: 500;
  color: #2980b9;
}

/* Precip row */
.fc-precip-row {
  display: flex;
  gap: 4px;
  align-items: baseline;
  min-height: 1.1em;
}

.fc-precip {
  font-size: 0.85rem;
  font-weight: 500;
  color: #aaa;
}
.fc-precip.precip-mod { color: #3b82f6; }
.fc-precip.precip-heavy { color: #dc2626; font-weight: 700; }

.fc-amount {
  font-size: 0.82rem;
  color: #3b82f6;
}

/* Inline hourly expansion — horizontal filmstrip */
.hourly-expansion-spacer {
  background: #f0f5ff;
  border-top: 2px solid #3b82f6;
  border-bottom: 2px solid #3b82f6;
  padding: 0;
}

.hourly-expansion-row td {
  padding: 0;
  border-top: 2px solid #3b82f6;
  border-bottom: 2px solid #3b82f6;
  background: #f0f5ff;
  /* override table cell overflow so filmstrip can scroll */
  overflow: hidden;
}

.hourly-expansion-inner {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 8px 8px;
  scrollbar-width: thin;
}

.hourly-inline-list {
  display: flex;
  flex-direction: row;
  gap: 4px;
  width: max-content; /* let it grow horizontally */
}

/* Each hour = a compact vertical card */
.hourly-inline-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 6px;
  min-width: 52px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.hourly-inline-heavy { background: #fff0f0; }

.hi-time { font-size: 0.8rem; color: #666; white-space: nowrap; }
.hi-icon { width: 28px; height: 28px; display: block; }
.hi-temp { font-size: 1rem; font-weight: 700; color: #111; }
.hi-precip { font-size: 0.85rem; font-weight: 600; color: transparent; min-height: 1.1em; }
.hi-precip.precip-mod { color: #3b82f6; }
.hi-precip.precip-heavy { color: #dc2626; }
.hi-amount { font-size: 0.78rem; color: #3b82f6; }

/* ========== Hourly Detail Modal ========== */
.hourly-modal {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}
.sources-modal.hourly-modal.visible { display: flex; }

.hourly-modal .sources-modal-content {
  max-width: 340px;
  width: 100%;
  min-height: auto;
  margin: 0;
  border-radius: 10px;
}

.hourly-modal .sources-modal-header {
  position: static;
  padding-bottom: 8px;
  margin-bottom: 4px;
  background: transparent;
}

.hm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid #f0f0f0;
}
.hm-row:last-child { border-bottom: none; }
.hm-row-heavy { background: #fff5f5; margin: 0 -4px; padding: 5px 4px; border-radius: 4px; }

.hm-time { font-size: 0.75rem; color: #666; width: 40px; flex-shrink: 0; }
.hm-icon { width: 22px; height: 22px; flex-shrink: 0; display: block; }
.hm-temp { font-size: 0.9rem; font-weight: 700; color: #111; width: 38px; flex-shrink: 0; }
.hm-precip { font-size: 0.82rem; font-weight: 600; color: transparent; flex: 1; }
.hm-precip.precip-mod { color: #3b82f6; }
.hm-precip.precip-heavy { color: #dc2626; font-weight: 700; }
.hm-amount { font-size: 0.75rem; color: #3b82f6; min-width: 32px; text-align: right; }

/* ========== Moon Button & Modal ========== */
.moon-btn {
  background: rgba(30, 27, 75, 0.9);
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 1rem;
  cursor: pointer;
  min-height: 36px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.moon-btn:active { filter: brightness(1.2); }

/* Modal backdrop */
.moon-panel {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.moon-panel[hidden] { display: none; }

/* Modal card */
.moon-panel-inner {
  background: #1a1440;
  border-radius: 16px;
  padding: 24px 20px 20px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.moon-phase-row {
  display: flex;
  align-items: center;
  gap: 24px;
}

.moon-phase-emoji {
  font-size: 3rem;
  line-height: 1;
  flex-shrink: 0;
}

.moon-phase-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.moon-phase-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
}

.moon-phase-illumination {
  font-size: 1rem;
  font-weight: 600;
  color: #d4cfff;
}

.moon-phase-age {
  font-size: 0.9rem;
  font-weight: 500;
  color: #a89fd4;
}

.moon-times-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.moon-time-card {
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.moon-time-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #c4bcf0;
}

.moon-time-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
}

.moon-location-note {
  font-size: 0.8rem;
  color: #9890c8;
  line-height: 1.4;
}

.moon-panel-close-row {
  display: flex;
  justify-content: center;
}

.moon-panel-close {
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 10px;
  padding: 12px 0;
  width: 100%;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-family: inherit;
}
.moon-panel-close:active { background: rgba(255,255,255,0.25); }

.loading {
  padding: 20px;
  text-align: center;
  color: #666;
  font-style: italic;
}

.weather-status-banner {
  margin: 12px 12px 0;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.35;
  border: 1px solid transparent;
}

.weather-status-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.weather-status-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.weather-status-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.error-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 16px;
}

/* ========== Modal Styles ========== */
.sources-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  padding: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sources-modal.visible { display: block; }

.sources-modal-content {
  max-width: 800px;
  margin: 20px auto;
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  min-height: calc(100vh - 40px);
}

@media (max-width: 640px) {
  .sources-modal { padding: 0; }
  .sources-modal-content {
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
    padding: 12px;
  }
}

@media (min-width: 641px) {
  .sources-modal-content { padding: 20px; }
}

.sources-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e5e5e5;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
}

.sources-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.sources-modal-close {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #666;
  -webkit-tap-highlight-color: transparent;
}

.sources-modal-close:active { background: #e5e5e5; }

@media (hover: hover) {
  .sources-modal-close:hover { background: #e5e5e5; }
}

/* Compact waypoint modal */
.waypoint-modal .sources-modal-content {
  max-width: 360px;
  min-height: auto;
  margin: 15vh auto;
}

@media (max-width: 640px) {
  .waypoint-modal .sources-modal-content {
    max-width: calc(100% - 32px);
    margin: 20vh 16px;
    min-height: auto;
    border-radius: 8px;
  }
}

.waypoint-modal .sources-modal-header {
  position: static;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.waypoint-detail {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #333;
}

.waypoint-detail p { margin: 0 0 8px 0; }
.waypoint-detail p:last-child { margin-bottom: 0; }
.waypoint-detail strong { color: #1b1b1b; }

.sources-list {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  .sources-list { max-height: calc(100vh - 100px); }
}

.source-item {
  padding: 14px 12px;
  border-bottom: 1px solid #e5e5e5;
}

.source-item.highlight {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  padding-left: 8px;
}

.source-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 12px;
}

.source-mile {
  font-weight: 600;
  color: #1b1b1b;
  font-size: 0.95rem;
  white-space: nowrap;
}

.source-name {
  font-weight: 500;
  color: #333;
  font-size: 0.95rem;
  margin-top: 2px;
}

.source-details {
  font-size: 0.85rem;
  color: #666;
  margin-top: 6px;
  line-height: 1.4;
}

/* ========== Map Controls ========== */
.maplibregl-ctrl-scale {
  background: rgba(255, 255, 255, 0.6) !important;
  border: 1.5px solid rgba(0,0,0,0.4) !important;
  border-top: none !important;
  color: #1b1b1b !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 2px 6px !important;
  box-shadow: none !important;
}

.maplibregl-ctrl-top-left,
.maplibregl-ctrl-top-right,
.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  z-index: 10 !important;
}

.maplibregl-ctrl-bottom-left {
  bottom: 72px !important;
}

/* Zoom level display */
.zoom-level-display {
  background: rgba(255, 255, 255, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #333;
  margin-top: 4px;
  box-shadow: none;
}

.maplibregl-ctrl-bottom-left .maplibregl-ctrl-scale {
  margin-left: 10px;
  margin-bottom: 4px;
}

/* ========== GPS Status ========== */
.gps-status {
  font-size: 0.5rem;
  color: #737373;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.gps-status.acquiring { color: #f59e0b; }
.gps-status.active { color: #22c55e; }
.gps-status.error { color: #dc2626; }

/* ========== User Location Marker ========== */
.user-location-marker {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.35));
}

.location-arrow {
  transition: transform 0.3s ease-out;
  overflow: visible;
}

.user-location-marker.pulsing .location-arrow circle {
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% { stroke-width: 2.5; stroke: rgba(255,255,255,1); }
  50% { stroke-width: 5; stroke: rgba(59,130,246,0.4); }
  100% { stroke-width: 2.5; stroke: rgba(255,255,255,1); }
}

/* ========== Accessibility ========== */
*:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.sources-modal-close:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  background: #e5e5e5;
}

/* ========== Touch Improvements ========== */
* { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }

.maplibregl-popup-content {
  padding: 8px 12px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13px;
}

.maplibregl-popup-content strong { display: block; margin-bottom: 2px; }
.maplibregl-popup-content .mile-marker { color: #666; font-size: 12px; }

/* ========== Reduced Motion ========== */
@media (prefers-reduced-motion: reduce) {
  .user-location-marker.pulsing .location-arrow circle { animation: none; }
  .category-toggle-btn { transition: none; }
  .btn-group-top-left button,
  .btn-group-top-right button,
  .btn-group-bottom-right button { transition: none; }
}

/* ========== Hover States (non-touch) ========== */
@media (hover: hover) {
  .btn-group-top-left button:hover,
  .btn-group-top-right button:hover,
  .btn-group-bottom-right button:hover {
    background: rgba(240, 240, 240, 0.95);
  }

  #btnGpsToggle.active:hover {
    background: #16a34a;
  }

  .category-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.06);
  }

  .waypoint-list-item:hover {
    background: #f9f9f9;
  }

  .filter-btn:hover {
    background: #e5e5e5;
  }

  .filter-btn.active:hover {
    background: #333;
  }

  .overlay-close:hover {
    background: #e5e5e5;
  }

  .view-on-map-btn:hover {
    background: #333;
  }
}
