/* Admin page: add photos. Builds on styles.css tokens. */
body.admin { padding-bottom: 80px; }
.ad-brand { display: flex; align-items: center; gap: 12px; }
.ad-tag { color: var(--muted); font-size: 0.95rem; }
.ad-conn { font-size: 0.85rem; color: var(--muted); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { border-bottom: 1px solid var(--line); }

.ad { padding: clamp(24px, 4vw, 56px) var(--pad) 0; max-width: 1180px; }
.ad h1 { margin: 0; font-weight: 300; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -0.03em; line-height: 1.05; }
.ad-head p, .ad-panel > p { max-width: 62ch; color: var(--muted); margin: 12px 0 0; }
.ad-panel { max-width: 720px; }
.hint { color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.hint a { color: var(--ink); }
.linkish { text-decoration: underline; text-underline-offset: 3px; color: var(--ink); }

/* ---- fields ---- */
.f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f > span { font-size: 0.8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.f > span i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.f input {
  font: inherit; font-size: 0.95rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; width: 100%;
  transition: border-color .15s;
}
.f input:focus { outline: none; border-color: var(--ink); }
.f input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.f.edited input { border-color: color-mix(in srgb, var(--ink) 55%, var(--line)); }
.f.wide { grid-column: 1 / -1; }

.ad-form { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-top: 28px; }
.ad-form .wide { grid-column: 1 / -1; }
.ad-form .row, .ad-done .row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ad-msg { font-size: 0.88rem; color: var(--muted); }

/* ---- drop zone ---- */
.ad-drop {
  margin-top: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 36px 20px; border: 1.5px dashed var(--line); border-radius: 14px; text-align: center; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.ad-drop:hover, .ad-drop.over { border-color: var(--ink); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.ad-drop svg.i { width: 26px; height: 26px; }
.ad-drop small { color: var(--muted); }

/* ---- toolbar ---- */
.ad-toolbar {
  position: sticky; top: calc(var(--bar-h) + env(safe-area-inset-top)); z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 24px calc(-1 * var(--pad)) 0; padding: 12px var(--pad);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--line);
}
.ad-toolbar .grow { flex: 1; }
.ad-toolbar .btn:disabled { opacity: .4; cursor: default; }
.ad-all { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; margin-right: 6px; font-variant-numeric: tabular-nums; }
.ad-target { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; font-size: 0.85rem; }
.ad-target label { padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.ad-target input { position: absolute; opacity: 0; pointer-events: none; }
.ad-target label:has(input:checked) { background: var(--ink); color: var(--bg); }
.ad-status { margin: 14px 0 0; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- list ---- */
.ad-list { display: flex; flex-direction: column; gap: 18px; margin-top: 20px; }
.ad-photo {
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px;
  padding: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  transition: border-color .15s, box-shadow .2s;
}
.ad-photo.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.ad-photo.flag { box-shadow: 0 0 0 3px #B3261E; }
.ad-thumb { position: relative; display: block; align-self: start; border-radius: 10px; overflow: hidden; background: var(--soft); cursor: pointer; }
.ad-thumb img { width: 100%; height: auto; display: block; }
.ad-nothumb { display: grid; place-items: center; aspect-ratio: 4 / 3; padding: 12px; font-size: 0.8rem; color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.ad-sel { position: absolute; top: 10px; left: 10px; width: 20px; height: 20px; accent-color: var(--ink); z-index: 1; }
.ad-pos { position: absolute; top: 10px; right: 10px; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; color: #fff; background: rgba(20,20,19,.62); }
.ad-fields { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ad-file { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.ad-file > span:not(.ad-order) { opacity: .7; }
.ad-order { margin-left: auto; display: inline-flex; gap: 2px; }
.ad-order .icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 14px; align-items: end; }
.ad-loc { border: 0; padding: 0; margin: 0; min-width: 0; }
.ad-loc legend, .ad-gear summary span { font-size: 0.82rem; font-weight: 600; padding: 0; margin-bottom: 8px; }
.ad-note { margin: 0 0 10px; font-size: 0.86rem; color: var(--muted); }
.ad-loc.missing .ad-note { color: var(--ink); }
.ad-pick { justify-content: center; height: 38px; }
.ad-gear summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.ad-gear summary::-webkit-details-marker { display: none; }
.ad-gear summary span::after { content: " +"; color: var(--muted); font-weight: 400; }
.ad-gear[open] summary span::after { content: " –"; }
.ad-gear summary small { color: var(--muted); font-size: 0.85rem; }
.ad-gear .ad-grid { margin-top: 12px; }

/* stacks */
.ad-stack {
  display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 18px;
  border: 1.5px solid var(--ink); background: color-mix(in srgb, var(--soft) 60%, transparent);
}
.ad-stack > header { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding: 4px 4px 6px; }
.ad-stack > header .f { flex: 1; min-width: 200px; max-width: 360px; }
.ad-post { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ad-stack-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; padding-bottom: 9px; }
.ad-stack .ad-photo { grid-template-columns: 180px minmax(0, 1fr); }

.ad-done { margin-top: 32px; padding: 28px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); max-width: 640px; }
.ad-done h2 { margin: 0 0 6px; font-weight: 400; font-size: 1.4rem; }
.ad-done p { margin: 0 0 18px; color: var(--muted); }

/* ---- tabs ---- */
.ad-tabs { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); margin-bottom: clamp(20px, 3vw, 36px); }
.ad-tabs nav { display: flex; gap: 24px; }
.ad-tab { position: relative; height: 46px; color: var(--muted); font-weight: 500; }
.ad-tab[aria-selected="true"] { color: var(--ink); }
.ad-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); }
.ad-filter { font: inherit; font-size: 0.92rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; width: min(320px, 100%); }
.ad-filter:focus { outline: none; border-color: var(--ink); }

/* ---- edit published ---- */
.ed-post { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color .15s; }
.ed-post.dirty { border-color: var(--ink); }
.ed-post > summary { display: flex; align-items: center; gap: 16px; padding: 12px 16px; cursor: pointer; list-style: none; }
.ed-post > summary::-webkit-details-marker { display: none; }
.ed-post > summary::after { content: "+"; margin-left: auto; color: var(--muted); font-size: 1.2rem; }
.ed-post[open] > summary::after { content: "–"; }
.ed-thumbs { display: flex; flex: none; }
.ed-thumbs img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 2px solid var(--surface); background: var(--soft); }
.ed-thumbs img + img { margin-left: -22px; }
.ed-name { display: flex; flex-direction: column; min-width: 0; }
.ed-name strong { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-name small { color: var(--muted); font-variant-numeric: tabular-nums; }
.ed-chip { flex: none; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; background: var(--ink); color: var(--bg); }
.ed-chip.warn { background: #B3261E; color: #fff; }
.ed-body { display: flex; flex-direction: column; gap: 14px; padding: 4px 16px 16px; }
.ed-posthead { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; }
.ed-posthead .f { flex: 1; min-width: 220px; max-width: 520px; }
.ed-photo { background: var(--bg); }
.ed-photo.removed { opacity: .55; }
.ed-photo.removed .ad-thumb img { filter: grayscale(1); }
.ed-rm { height: 32px; padding: 0 12px; font-size: 0.85rem; }
.ed-rm svg.i { width: 16px; height: 16px; }

/* ---- map picker ---- */
.ad-map {
  width: min(880px, calc(100vw - 24px)); height: min(720px, calc(100dvh - 24px)); padding: 0; border: 0; border-radius: 16px;
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px -20px rgba(0,0,0,.45);
}
.ad-map[open] { display: flex; flex-direction: column; }
.ad-map::backdrop { background: rgba(0,0,0,.4); }
.ad-map-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 0 20px; }
.ad-map-head h2 { margin: 0; font-weight: 500; font-size: 1.1rem; }
.ad-search { display: flex; gap: 8px; padding: 12px 20px; }
.ad-search input { flex: 1; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.ad-results { list-style: none; margin: 0 20px 10px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; max-height: 180px; overflow: auto; }
.ad-results button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; font-size: 0.92rem; }
.ad-results button:hover { background: var(--soft); }
.ad-results .muted { padding: 8px 10px; color: var(--muted); font-size: 0.9rem; }
.ad-mapbox { position: relative; flex: 1; margin: 0 20px; border-radius: 10px; overflow: hidden; background: var(--soft); isolation: isolate; }
#pickMap { position: absolute; inset: 0; }
.ad-pin { border-radius: 50%; background: #1B1C19; border: 4px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 4px 12px rgba(0,0,0,.3); cursor: grab; }
.ad-map-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; font-variant-numeric: tabular-nums; color: var(--muted); }

@media (max-width: 720px) {
  .ad-photo, .ad-stack .ad-photo { grid-template-columns: 1fr; padding: 14px; }
  .ad-thumb { max-width: 320px; }
  .ad-form { grid-template-columns: 1fr; }
  .ad-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ad-conn { display: none; }
  .ad-toolbar .grow { flex-basis: 100%; height: 0; }
  .ad-toolbar { position: static; }
  .ed-post > summary { gap: 12px; padding: 10px 12px; }
  .ed-thumbs img { width: 44px; height: 44px; }
  .ed-body { padding: 4px 10px 12px; }
}

/* Trips switched off in site.config.json */
.no-trips .f:has(> input[name="__trip"]) { display: none; }
