/* Saved routes, pistes and lifts (saved-routes.js): the Save control under a route's summary and on a piste or lift
   card, its inline name form, the Saved list with rename and delete in place, and the notice over a route opened from
   Saved. Linked on map.html and trail-map.html after route.css, whose rows (.route-choice) the list reuses. */

.sr-save { margin: var(--space-2) 0 0; }
/* In the Ski Map's piste and lift card: a row of its own under the card's buttons, so they keep their room */
.place-actions:has(> .sr-save) { flex-wrap: wrap; }
.place-actions > .sr-save { flex-basis: 100%; margin: 0; }

.sr-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 0 14px;
  border: 1px solid var(--stroke); border-radius: 999px;
  background: #fff; color: var(--accent);
  font: inherit; font-size: var(--text-sm); font-weight: 600; cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}
.sr-btn:hover { background: var(--fill); }
.sr-btn:focus-visible, .sr-icon:focus-visible, .sr-link:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.sr-btn.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.sr-btn.primary:hover { background: var(--accent-hover); }
.sr-btn.danger, .sr-notice .danger { border-color: var(--sos); background: var(--sos); color: #fff; }
.sr-btn svg, .sr-state svg, .sr-icon svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.sr-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-2); margin: 0; }
.sr-field { display: flex; flex-direction: column; gap: 2px; flex: 1 1 160px; min-width: 0; font-size: var(--text-xs); font-weight: 600; color: var(--muted); }
.sr-field input {
  width: 100%; min-height: 36px; padding: 0 10px; box-sizing: border-box;
  border: 1px solid var(--stroke); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font: inherit; font-size: var(--text-base); font-weight: 400;
}
.sr-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.sr-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.sr-state { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--text-sm); color: var(--text); }
.sr-state svg { color: var(--accent); }
.sr-state.sr-full { color: var(--caution-ink); }
.sr-link {
  padding: 0; border: 0; background: none; color: var(--accent);
  font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}

/* On the trail map: the card's Save under its sections, and Explore's Saved list under the other lists */
.tm-card-save { margin: var(--space-3) 0 0; }
.tm-card-save .sr-save { margin: 0; }
.tm-saved-list { padding: 0 var(--space-3) var(--space-2); }
.tm-saved-list .sr-list > .hint { margin-top: var(--space-2); }
.tm-sym-saved { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }

/* The list: rows like the chooser's, with rename and delete beside each */
.sr-fold { margin-top: var(--space-4); border-top: 1px solid var(--separator); }
.sr-fold > summary {
  display: flex; align-items: center; gap: var(--space-2); min-height: 44px;
  list-style: none; cursor: pointer; font-weight: 600;
}
.sr-fold > summary::-webkit-details-marker { display: none; }
.sr-fold > summary > svg { width: 14px; height: 14px; margin-left: auto; transition: transform var(--dur-fast) var(--ease); }
.sr-fold[open] > summary > svg { transform: rotate(180deg); }
.sr-fold > summary:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.sr-count {
  min-width: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--fill); color: var(--muted); font-size: var(--text-xs); line-height: 20px; text-align: center;
}
.sr-rows { margin-top: 0; }
.sr-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.sr-row > .sr-open { flex: 1 1 0; width: auto; min-width: 0; margin-right: 0; }
.sr-row > .sr-form, .sr-row.sr-confirm > * { flex-basis: 100%; }
.sr-row.sr-confirm, .sr-row > .sr-form { padding: var(--space-2) 0; }
.sr-row.sr-confirm p { margin: 0 0 var(--space-2); font-size: var(--text-sm); }
.sr-open small { display: block; color: var(--muted); font-size: var(--text-sm); overflow-wrap: anywhere; }
.sr-open strong { overflow-wrap: anywhere; }
.sr-icon {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: none; color: var(--muted); cursor: pointer;
}
.sr-icon:hover { background: var(--fill); color: var(--text); }
.sr-flag { flex-basis: 100%; margin: 0 0 var(--space-2); font-size: var(--text-sm); color: var(--caution-ink); }
.sr-group { margin: var(--space-3) 0 2px; font-size: var(--text-xs); font-weight: 600; color: var(--muted); }
.sr-where, .sr-empty, .sr-full { margin: var(--space-2) 0 0; font-size: var(--text-sm); }

/* Over a route opened from Saved: the same way, a different one today, or what's missing, with Remove and Plan again */
.sr-notice { margin: var(--space-3) 0 0; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--fill); font-size: var(--text-sm); }
.sr-notice p { margin: 0; }
.sr-notice p + p { margin-top: 4px; }
.sr-notice .sr-actions { margin-top: var(--space-2); }
.sr-notice.sr-same { padding: 0; background: none; color: var(--muted); }
.sr-notice.sr-differs, .sr-notice.sr-gone, .sr-notice.sr-noroute, .sr-notice.sr-blocked { background: rgb(245 163 0 / .12); color: var(--caution-ink); }

/* 44 px targets on phones (WCAG 2.5.8, tools/verify/smoke/touch-targets.smoke.mjs's pattern) */
@media (max-width: 600px), (pointer: coarse) {
  .sr-btn, .sr-link { position: relative; }
  .sr-btn::after { content: ""; position: absolute; inset: calc(50% - 22px) 0; }
  .sr-icon { width: 44px; height: 44px; }   /* side by side: a box of their own rather than areas that would overlap */
  .sr-link::after { content: ""; position: absolute; inset: calc(50% - 22px) -4px; }
  .sr-field input { min-height: 44px; }
}
