/* DCPS Landscaping Maps - base styles. Plain CSS, no framework.
   Colors are variables so the look can be matched to the other DCPS sites in one place. */
:root {
  --brand: #1f3a5f;
  --brand-text: #ffffff;
  --accent: #2e7d32;
  --accent-hover: #256628;
  --danger: #b3261e;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --border: #d9dee3;
  --text: #1c1f23;
  --muted: #5f6b76;
  --ok: #2e7d32;
  --off: #8a94a0;
  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.4; display: flex; flex-direction: column; }
a { color: var(--brand); }
h1 { font-size: 1.4rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
.muted { color: var(--muted); }

/* Top bar */
.topbar { background: var(--brand); color: var(--brand-text); flex: 0 0 auto; }
.topbar-inner { display: flex; align-items: center; gap: 1.5rem; padding: 0 1rem; height: 50px; }
.brand { color: var(--brand-text); text-decoration: none; font-weight: 600; font-size: 1.05rem; white-space: nowrap; }
.brand-org { opacity: .8; font-weight: 700; letter-spacing: .04em; }
.nav { display: flex; gap: .25rem; flex: 1; }
.nav a { color: var(--brand-text); text-decoration: none; padding: .4rem .7rem; border-radius: var(--radius); opacity: .85; }
.nav a:hover, .nav a.active { background: rgba(255,255,255,.14); opacity: 1; }
.userbox { display: flex; align-items: center; gap: .75rem; }
.username { opacity: .9; color: var(--brand-text); text-decoration: none; }
.username:hover { text-decoration: underline; }
.btn-link { background: none; border: none; color: var(--brand-text); cursor: pointer; text-decoration: underline; padding: 0; font: inherit; }

/* Layout */
.page { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.flashes { max-width: 1100px; margin: 1rem auto 0; padding: 0 1rem; width: 100%; }
.flash { padding: .6rem .9rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--panel); margin-bottom: .5rem; }
.flash-error { border-color: var(--danger); color: var(--danger); }
.flash-success { border-color: var(--ok); color: var(--ok); }

/* Forms */
label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  font: inherit; color: var(--text); padding: .45rem .6rem; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.form-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.form-row label { flex: 1 1 180px; }
.form-inline { display: inline-flex; gap: .4rem; align-items: center; margin: 0; }
.btn { font: inherit; padding: .45rem .9rem; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; color: var(--text); cursor: pointer; }
.btn:hover { background: #f0f2f4; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #fbeae9; }
.btn-small { padding: .25rem .6rem; font-size: .85rem; }
.btn-block { width: 100%; margin-top: .5rem; }

/* Login */
.login-page .page { display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh; }
.login-card { width: 100%; max-width: 380px; }
.login-card form { display: flex; flex-direction: column; gap: .75rem; margin-top: .75rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.row-inactive td { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.inline-details summary { list-style: none; display: inline-block; }
.inline-details summary::-webkit-details-marker { display: none; }
.inline-details[open] .form-inline { margin-top: .4rem; }
.badge { display: inline-block; font-size: .75rem; padding: .1rem .45rem; border-radius: 999px; background: #e8ecf0; color: var(--muted); }
.badge-ok { background: #e3f2e4; color: var(--ok); }
.badge-off { background: #eceff1; color: var(--off); }

@media (max-width: 640px) {
  .topbar-inner { gap: .5rem .75rem; flex-wrap: wrap; height: auto; padding: .4rem .75rem; }
  .nav { order: 3; flex-basis: 100%; }
  .nav a { padding: .3rem .55rem; font-size: .95rem; }
  .userbox { margin-left: auto; }
  .username { display: none; }
  .table th:nth-child(5), .table td:nth-child(5) { display: none; }
}

/* Upload */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: center; margin: .75rem 0; background: #fafbfc; }
.dropzone.over { border-color: var(--accent); background: #eef7ee; }
.dropzone p { margin: .25rem 0; }
.columns-list { columns: 2; margin: 0; padding-left: 1.2rem; }
.columns-list li { margin: .15rem 0; }
code { background: #eef1f4; padding: .05rem .3rem; border-radius: 3px; font-size: .9em; }
.stats { display: flex; flex-wrap: wrap; gap: .75rem; }
.stat { flex: 1 1 120px; border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .8rem; display: flex; flex-direction: column; }
.stat-num { font-size: 1.5rem; font-weight: 600; }
.stat-label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.stat-warn { border-color: #e0a800; background: #fff8e1; }
.stat-error { border-color: var(--danger); background: #fbeae9; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .75rem; }
.filter-tabs a { text-decoration: none; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border); color: var(--text); font-size: .9rem; }
.filter-tabs a.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.badge-success, .badge-added { background: #e3f2e4; color: var(--ok); }
.badge-partial, .badge-flagged { background: #fff3cd; color: #8a6d00; }
.badge-rejected, .badge-error { background: #fbeae9; color: var(--danger); }
.badge-updated { background: #e3ecf7; color: var(--brand); }
.badge-unchanged { background: #eceff1; color: var(--muted); }

/* Map screen */
.map-page { height: 100vh; overflow: hidden; }
.map-layout { flex: 1; display: flex; min-height: 0; position: relative; }
.panel-show { position: absolute; top: 10px; left: 10px; z-index: 1000; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.panel-show[hidden] { display: none; }
.map-page .flashes { position: absolute; z-index: 1000; left: 50%; transform: translateX(-50%); top: 56px; width: auto; max-width: 600px; }
.panel { width: 380px; flex: 0 0 380px; background: var(--panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; transition: width .2s, flex-basis .2s; }
.panel.collapsed { width: 0; flex-basis: 0; overflow: hidden; border: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.panel-head h1 { font-size: 1.05rem; margin: 0; }
.panel-body { overflow-y: auto; padding: .75rem 1rem 1rem; display: flex; flex-direction: column; gap: .75rem; min-height: 0; }
.map { flex: 1; min-width: 0; }
.panel.collapsed + .map { flex: 1 1 100%; }
.panel-toggle { white-space: nowrap; }
.search { width: 100%; }
.filters { display: flex; flex-direction: column; gap: .5rem; }
.filters select { width: 100%; }
.filter-label { font-size: .85rem; color: var(--muted); }
.filter-status { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; }
.check { flex-direction: row; align-items: center; gap: .3rem; color: var(--text); font-size: .9rem; }
.filter-range { display: flex; align-items: center; gap: .4rem; }
.filter-range input { width: 100px; flex: 1; }
.filter-actions { display: flex; gap: .5rem; }
.totals { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); align-items: baseline; }
.totals-num { font-size: 1.3rem; font-weight: 600; margin-right: .3rem; }
.totals-label { font-size: .8rem; color: var(--muted); }
.totals-extra { width: 100%; font-size: .8rem; color: var(--muted); }
.colorby label { color: var(--muted); }
.colorby select { width: 100%; }
.legend { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.legend li { display: grid; grid-template-columns: 14px 1fr auto auto; gap: .5rem; align-items: center; font-size: .88rem; }
.swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); display: inline-block; }
.legend-count { color: var(--muted); min-width: 2ch; text-align: right; }
.legend-total { color: var(--muted); min-width: 8ch; text-align: right; font-variant-numeric: tabular-nums; }
.legend-flag { font-size: .85rem; color: var(--muted); margin-top: .4rem; display: flex; align-items: center; gap: .5rem; }
.list-head { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; border-top: 1px solid var(--border); padding-top: .6rem; }
.plist { list-style: none; margin: 0; padding: 0; }
.pitem { display: flex; gap: .6rem; padding: .45rem .3rem; border-bottom: 1px solid var(--border); cursor: pointer; align-items: flex-start; }
.pitem:hover { background: var(--bg); }
.pitem-nolocation { cursor: default; }
.pitem-main { min-width: 0; }
.pitem-name { font-weight: 500; }
.pitem-name .badge { margin-left: .3rem; vertical-align: middle; }
.pitem-sub { font-size: .8rem; color: var(--muted); }

/* Pins (Leaflet divIcon) */
.pin-wrap { background: none; border: none; }
.pin { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.4); box-sizing: border-box; }
.pin-flagged { background: #9e9e9e; color: #fff; font-weight: 700; font-size: 12px; line-height: 1; }
.pin-removed { opacity: .45; }
.pin-list { width: 14px; height: 14px; flex: 0 0 14px; margin-top: .25rem; font-size: 10px; border-width: 1px; }
.pin-legend { width: 14px; height: 14px; font-size: 10px; border-width: 1px; }
.leaflet-popup-content { margin: .6rem .8rem; font: inherit; font-size: .9rem; }
.leaflet-container { font-family: var(--font); }

@media (max-width: 767px) {
  .map-layout { flex-direction: column; }
  .panel { width: 100%; flex: 0 0 auto; max-height: 50vh; border-right: none; border-bottom: 1px solid var(--border); transition: none; }
  .panel.collapsed { max-height: 0; width: 100%; flex-basis: auto; }
  .panel.collapsed .panel-head { display: none; }
  .panel.collapsed { border-bottom: none; }
  .map { flex: 1; min-height: 0; }
}

/* Property drawer */
.drawer { position: absolute; top: 10px; right: 10px; bottom: 10px; width: 400px; max-width: calc(100% - 20px); z-index: 1000; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.18); display: flex; flex-direction: column; }
.drawer[hidden] { display: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-size: 1.05rem; }
.drawer-sub { font-size: .85rem; color: var(--muted); margin-top: .15rem; }
.drawer-sub .badge { margin-left: .25rem; }
.drawer-body { overflow-y: auto; padding: .75rem 1rem 1rem; display: flex; flex-direction: column; gap: 1rem; }
.drawer-body section h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 .4rem; display: flex; align-items: center; gap: .5rem; }
.from-aspire { font-size: .7rem; text-transform: none; letter-spacing: 0; background: #eef1f4; color: var(--muted); padding: .05rem .4rem; border-radius: 999px; cursor: help; border: 1px dashed var(--border); }
.aspire-fields { margin: 0; display: grid; grid-template-columns: 9.5rem 1fr; gap: .25rem .6rem; font-size: .9rem; }
.aspire-fields dt { color: var(--muted); }
.aspire-fields dd { margin: 0; }
.drawer-flag { border: 1px solid #e0a800; background: #fff8e1; border-radius: var(--radius); padding: .6rem .8rem; font-size: .9rem; }
.drawer-flag p { margin: 0 0 .5rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
#d-form { display: flex; flex-direction: column; gap: .6rem; }
#d-form textarea { resize: vertical; font: inherit; }
.small { font-size: .82rem; }
.addr-search { margin-top: .75rem; }
.addr-results { list-style: none; margin: .3rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.addr-pick { font: inherit; font-size: .85rem; text-align: left; width: 100%; padding: .4rem .6rem; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; cursor: pointer; }
.addr-pick:hover { background: var(--bg); border-color: var(--brand); }
.drawer-foot { font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: .6rem; }
.pitem.selected { background: #e8eef7; }
.pin-selected .pin { box-shadow: 0 0 0 3px var(--brand), 0 1px 3px rgba(0,0,0,.4); }
.pin-dragging { cursor: grab; }
.pin-dragging .pin { transform: scale(1.3); box-shadow: 0 0 0 3px var(--accent), 0 2px 6px rgba(0,0,0,.5); }
@media (max-width: 767px) {
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-width: 100%; max-height: 70%; border-radius: var(--radius) var(--radius) 0 0; }
}
