/* Plan Trip — builds on /locations-mapping/styles.css (tokens, topbar, btn, chips, tabs). */
/* Brand tokens (match /assets/site.css) and the shared site header height. */
:root {
  --start: #2563eb; --route: #194d33; --panel-w: 420px;
  --primary: #194d33; --primary-dark: #123a26; --primary-soft: #e7f0ea;
  --bg: #f6f4ee; --border: #e4e0d5; --header-h: var(--kr-hd-h, 64px);
}
body { font-family: 'Poppins', -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.pt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* First-visit tips + "get help" card */
.pt-intro { position: relative; padding: 14px 16px; border-color: #d9e6dd; background: linear-gradient(180deg, #f1f7f3, #fff); }
.pt-intro strong { display: block; font-size: 1rem; margin-bottom: 6px; color: var(--primary); }
.pt-intro ol { margin: 0 0 8px; padding-left: 20px; font-size: .86rem; line-height: 1.45; }
.pt-intro li { margin-bottom: 3px; }
.pt-intro-x { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 1.3rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px; }
.pt-help { margin-top: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; border-color: #f0dd9f; background: #fffaf0; }
.pt-help strong { display: block; margin-bottom: 2px; }
.pt-help small { line-height: 1.4; display: block; }

body { overflow-x: hidden; }

.pt-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w);
  height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h));
}
.pt-map-wrap { position: relative; min-width: 0; }
/* #map overrides the fixed heights in /locations-mapping/styles.css */
#map.pt-map { position: absolute; inset: 0; width: auto; height: auto; background: #e5e7eb; }
.pt-map.picking { cursor: crosshair; }
.pt-map-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 500;
  background: var(--text); color: #fff; padding: 6px 14px; border-radius: 999px; font-size: .85rem; box-shadow: var(--shadow-lg);
}
.pt-locate { position: absolute; right: 12px; bottom: 24px; z-index: 500; box-shadow: var(--shadow-lg); }

.pt-panel {
  min-width: 0; overflow-y: auto; background: var(--bg); border-left: 1px solid var(--border);
  padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 12px;
}

/* Start card */
.pt-start { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.pt-start-row { display: flex; gap: 10px; align-items: flex-start; }
.pt-start-text { display: flex; flex-direction: column; min-width: 0; }
.pt-start-text small { line-height: 1.35; }
.pt-dot { flex: none; width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; background: #cbd5e1; box-shadow: 0 0 0 4px #e2e8f0; }
.pt-dot.ok { background: var(--start); box-shadow: 0 0 0 4px rgba(37, 99, 235, .2); }
.pt-dot.warn { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245, 158, 11, .2); }
.pt-start-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pt-district select { min-height: 32px; padding: 4px 8px; font: inherit; font-size: .85rem; border: 1px solid var(--border, #d1d5db); border-radius: 8px; background: #fff; max-width: 100%; }
.pt-start-actions .btn.active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

/* Filters */
.pt-filters .chips { margin-bottom: 0; }
.pt-radius { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.pt-radius b { color: var(--text); }
.pt-radius input { width: 100%; accent-color: var(--primary); }
.pt-quick { display: flex; gap: 6px; flex-wrap: wrap; margin: -2px 0 10px; }
.pt-quick button { border: 1.5px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 11px; font: 500 .8rem inherit; font-family: inherit; color: var(--text); cursor: pointer; }
.pt-quick button:hover { border-color: var(--primary); }
.pt-quick button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.pt-panel .tabs { margin-bottom: -13px; padding: 0; }
.pt-count {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px;
  background: var(--border); color: var(--text); font-size: .75rem; text-align: center;
}
.tabs button.active .pt-count { background: var(--primary); color: #fff; }
.pt-tab {
  background: var(--surface); border: 1px solid var(--border); border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
}
.pt-tab input[type="search"] { width: 100%; }

/* Nearby list */
.pt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pt-list li {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 9px 4px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.pt-list li:last-child { border-bottom: 0; }
.pt-list li:hover { background: #f8fafc; }
.pt-list li.focus { background: var(--primary-soft); }
.pt-list .dot { width: 10px; height: 10px; border-radius: 50%; }
.pt-list .meta { display: flex; flex-direction: column; min-width: 0; }
.pt-list .meta strong { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-list .meta small { color: var(--muted); font-size: .8rem; }
.pt-add { min-width: 64px; }
.pt-hot { display: inline-block; padding: 0 6px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: .74rem; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.pt-add.added { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.pt-more { align-self: center; }
.pt-empty { margin: 0; }

/* Suggest */
.pt-suggest { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: none; background: var(--primary-soft); border-color: #c7d2fe; }
.pt-suggest small { display: block; }
.pt-suggest-row { display: flex; gap: 8px; }
.pt-suggest-row select { min-height: 32px; padding: 4px 8px; }

/* Stops */
.pt-stops { list-style: none; margin: 0; padding: 0; counter-reset: stop; display: flex; flex-direction: column; gap: 6px; }
.pt-stops li {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: center;
  padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.pt-num {
  width: 24px; height: 24px; border-radius: 50%; background: var(--route); color: #fff;
  display: grid; place-items: center; font-size: .78rem; font-weight: 700;
}
.pt-stops .meta { min-width: 0; display: flex; flex-direction: column; }
.pt-stops .meta strong { font-size: .9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-stops .meta small { color: var(--muted); font-size: .78rem; }
.pt-stops .ctl { display: flex; gap: 2px; }
.pt-stops .ctl button { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 4px 6px; border-radius: 6px; font-size: .9rem; }
.pt-stops .ctl button:hover { background: var(--bg); color: var(--text); }

.pt-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; font-size: .85rem; color: var(--muted); }
.pt-options label { display: flex; flex-direction: column; gap: 3px; }
.pt-options input[type="time"] {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; color: var(--text); background: var(--surface);
}
.pt-options .pt-check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }
.pt-actions { display: flex; gap: 8px; }
.pt-actions .primary { flex: 1; }

/* Plan output */
.pt-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 8px; }
.pt-totals div { background: var(--bg); border-radius: var(--radius-sm); padding: 8px; text-align: center; }
.pt-totals b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.pt-totals small { color: var(--muted); font-size: .75rem; }
.pt-day { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; }
.pt-day-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.pt-day-head small { color: var(--muted); }
.pt-timeline { list-style: none; margin: 0; padding: 6px 10px 8px; }
.pt-timeline li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; padding: 4px 0; }
.pt-timeline .t { font-variant-numeric: tabular-nums; font-weight: 600; font-size: .85rem; }
.pt-timeline .drive { color: var(--muted); font-size: .8rem; }
.pt-timeline .drive .t { font-weight: 400; color: var(--muted); }
.pt-timeline .stop strong { font-size: .9rem; }
.pt-timeline .stop small { display: block; color: var(--muted); font-size: .78rem; }
.pt-timeline a { font-size: .78rem; }
.pt-nav { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 10px 10px; }
.pt-warn { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: .82rem; margin: 0 0 8px; }
.pt-warn ul { margin: 4px 0 0; padding-left: 18px; }
.pt-note { margin: 0; line-height: 1.4; }

/* Map markers */
.pt-pin {
  width: 26px; height: 26px; border-radius: 50%; background: var(--route); color: #fff; border: 2px solid #fff;
  display: grid; place-items: center; font: 700 12px/1 -apple-system, "Segoe UI", sans-serif; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.pt-me { width: 18px; height: 18px; border-radius: 50%; background: var(--start); border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(37,99,235,.35), 0 1px 4px rgba(0,0,0,.4); }
.leaflet-popup-content { margin: 10px 12px; font-size: .85rem; }
.leaflet-popup-content strong { display: block; font-size: .92rem; }
.leaflet-popup-content .btn { margin-top: 6px; }

@media (max-width: 900px) {
  .pt-layout { display: flex; flex-direction: column; height: auto; }
  .pt-map-wrap { height: 52vh; height: 52dvh; min-height: 300px; }
  .pt-panel { border-left: 0; border-top: 1px solid var(--border); overflow: visible; padding: 12px 16px 32px; }
  .topbar { gap: 12px; padding: 0 16px; }
  .brand { display: none; }
}
@media (max-width: 420px) {
  .pt-options { grid-template-columns: 1fr; }
}
