/* ── Detail view ── */

/* When <main> is on an activity route, drop the feed column cap so the
   detail page can span the full viewport and host a side-by-side layout
   on wide screens. */
.activity-main {
  width: 100%;
}

.activity-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.activity-detail-map-pane {
  position: relative;
  height: 60vh;
  background: var(--surface-alt);
  overflow: hidden;
}

/* ActivityMapDetail wraps the map in a relative div; make it fill the pane
   so the inner `.maplibre-map` (height: 100%) actually resolves to a real
   height. */
.activity-detail-map-pane > div,
.activity-detail-map-pane .maplibre-map,
.activity-detail-map-pane .map-no-gps {
  height: 100%;
}

.activity-detail-content-pane {
  padding: 16px 16px 32px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 1024px) {
  .activity-detail {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    align-items: start;
    min-height: calc(100vh - 90px);
  }

  .activity-detail-map-pane {
    position: sticky;
    top: 90px;
    height: calc(100vh - 90px);
    border-right: 1px solid var(--border);
  }

  .activity-detail-content-pane {
    max-width: 560px;
    padding: 28px 24px 56px;
  }
}

.back-btn {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0 16px;
  letter-spacing: 0.2px;
}

.back-btn:hover {
  text-decoration: underline;
}

.detail-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.detail-menu-wrapper {
  position: relative;
}

.detail-menu-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 6px;
  letter-spacing: 2px;
}

.detail-menu-btn:hover {
  background: var(--surface-alt);
}

.detail-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99;
}

.detail-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 100;
  padding: 4px 0;
}

.detail-menu-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.detail-menu-item:hover {
  background: var(--surface-alt);
}

.detail-menu-item.danger {
  color: var(--danger);
}

.detail-menu-item.danger:hover {
  background: var(--danger-soft);
}

.detail-header {
  background: var(--surface);
  padding: 16px 16px 12px;
  border-radius: 14px 14px 0 0;
}

.detail-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
}

.detail-title-editable {
  cursor: text;
  border-radius: 4px;
  margin: 0 -4px;
  padding: 0 4px;
  transition: background 0.1s;
}

.detail-title-editable:hover {
  background: var(--surface-alt);
}

.detail-title-input {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
  width: 100%;
  border: none;
  border-bottom: 2px solid var(--accent);
  border-radius: 0;
  background: transparent;
  outline: none;
  padding: 0;
  font-family: inherit;
}

/* ── Charts ── */

.chart-section {
  background: var(--surface);
  padding: 14px 16px 10px;
  border-top: 1px solid var(--border);
}

.chart-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-subtle);
  margin-bottom: 6px;
}

.line-chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart-tick {
  font-size: 9px;
  fill: var(--text-subtle);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── Stats bar ── */

.activity-stats {
  display: flex;
  border-top: 1px solid var(--border);
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  gap: 2px;
}

.stat-item + .stat-item {
  border-left: 1px solid var(--border);
}

.stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 0.68rem;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.detail-device {
  margin: 8px 16px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.detail-description {
  margin: 12px 16px 0;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  cursor: text;
  border-radius: 4px;
  padding: 4px 6px;
  color: var(--text);
}

.detail-description-editable:hover {
  background: var(--surface-alt);
}

.detail-description-empty {
  color: var(--text-muted);
  font-style: italic;
}

.detail-description-empty:hover {
  background: var(--surface-alt);
}

.detail-description-textarea {
  display: block;
  margin: 12px 16px 0;
  width: calc(100% - 32px);
  min-height: 80px;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.5;
  padding: 4px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  resize: vertical;
  box-sizing: border-box;
  background: var(--surface);
  color: var(--text);
}

/* ── Gear Picker (Activity Detail) ── */

.gear-picker {
  margin: 8px 0 12px;
  position: relative;
}

.gear-picker-current {
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
}

.gear-picker-current:hover {
  color: var(--text);
}

.gear-picker-empty {
  color: var(--text-subtle);
  font-style: italic;
}

.gear-picker-dropdown {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  min-width: 200px;
}

.gear-picker-option {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
}

.gear-picker-option:hover {
  background: var(--surface-alt);
}

.gear-picker-option.selected {
  font-weight: 600;
}
