/* VetHub shared styles — vetmap.html, map-viewer.html, admin.html
   Dark theme is the default; html.light-mode switches tokens. No build step. */

:root {
  --bg: #0b1220;
  --bg-2: #111827;
  --surface: rgba(30, 41, 59, 0.72);
  --surface-solid: #172033;
  --surface-2: rgba(51, 65, 85, 0.55);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #e5e7eb;
  --text-2: #a3aec2;
  --text-3: #7c879b;
  --red: #dc2626;
  --red-strong: #b91c1c;
  --red-soft: rgba(220, 38, 38, 0.16);
  --blue: #2563eb;
  --blue-strong: #1d4ed8;
  --navy: #1e3a8a;
  --gold: #f5b83d;
  --ok: #16a34a;
  --warn: #d97706;
  --focus: #60a5fa;
  --link: #7cb3ff;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --radius: 14px;
  --radius-sm: 9px;
  --nav-h: 60px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

html.light-mode {
  --bg: #f4f6fa;
  --bg-2: #ffffff;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-2: rgba(226, 232, 240, 0.7);
  --border: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.22);
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --red-soft: rgba(220, 38, 38, 0.09);
  --link: #1d4ed8;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 16px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(30, 58, 138, 0.35), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(153, 27, 27, 0.22), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
html.light-mode body {
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(59, 130, 246, 0.12), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(220, 38, 38, 0.08), transparent 60%);
}
img { max-width: 100%; }
a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.vh-noscroll, .vh-noscroll body { overflow: hidden; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -100px; z-index: 10000;
  background: var(--red); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 8px; }
/* Fluid page: gutters grow with the window; only ultra-wide screens are capped. */
.container { width: 100%; max-width: 2560px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 72px); }
.container-read { max-width: 1480px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 0.92rem; text-decoration: none; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
  white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-strong); border-color: var(--red-strong); }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-strong); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 34px; padding: 0 11px; font-size: .84rem; border-radius: 8px; }
.btn-icon { width: 42px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn-block { width: 100%; }

/* --------------------------------------------------------------- inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: .85rem; font-weight: 600; color: var(--text); }
.hint { font-size: .78rem; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-solid); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(96, 165, 250, .3); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--red); }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }

/* ---------------------------------------------------------------- pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: .74rem; font-weight: 650; line-height: 1.5; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.pill-cat { color: #fff; border: 0; background: var(--cat, #6b7280); }
.pill-open { background: rgba(22, 163, 74, .18); color: #4ade80; border-color: rgba(22, 163, 74, .45); }
.pill-closed { background: rgba(148, 163, 184, .14); color: var(--text-2); }
html.light-mode .pill-open { color: #15803d; }
.pill-featured { background: linear-gradient(135deg, #f5b83d, #f59e0b); color: #1f1300; border: 0; }
.pill-status-pending_review { background: rgba(245, 158, 11, .2); color: #fbbf24; border-color: rgba(245, 158, 11, .5); }
.pill-status-approved { background: rgba(22, 163, 74, .18); color: #4ade80; border-color: rgba(22, 163, 74, .45); }
.pill-status-rejected { background: rgba(220, 38, 38, .18); color: #f87171; border-color: rgba(220, 38, 38, .45); }
.pill-status-archived { background: rgba(148, 163, 184, .16); color: var(--text-2); }
html.light-mode .pill-status-pending_review { color: #92400e; }
html.light-mode .pill-status-approved { color: #15803d; }
html.light-mode .pill-status-rejected { color: #b91c1c; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: .86rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--chip, var(--red)); }
.chip[aria-pressed="true"] { background: var(--chip, var(--red)); border-color: var(--chip, var(--red)); color: #fff; }
.chip .count { font-size: .75rem; opacity: .75; font-weight: 600; }

/* ---------------------------------------------------------- map pieces */
.vh-pin-wrap { background: none; border: 0; }
.vh-pin {
  --pin: #6b7280;
  display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--pin); border: 2px solid #fff; font-size: 17px; line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45); transition: transform .18s ease, box-shadow .18s ease;
}
.vh-pin.is-featured { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(245, 184, 61, .35), 0 2px 6px rgba(0, 0, 0, .45); }
.vh-pin.is-selected { transform: scale(1.32); box-shadow: 0 0 0 4px rgba(255, 255, 255, .9), 0 0 0 8px var(--pin), 0 6px 16px rgba(0, 0, 0, .5); z-index: 1000; }
.vh-pin-wrap.is-dimmed .vh-pin { opacity: .25; }
@media (prefers-reduced-motion: reduce) { .vh-pin { transition: none; } }

/* Keyless "night" street map: OSM tiles with a dark filter. */
.vh-tiles-night { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.55); }

.leaflet-container { font-family: var(--font); background: #0f1626; }
html.light-mode .leaflet-container { background: #dfe6ee; }
.leaflet-bar a, .leaflet-control-layers, .leaflet-control-layers-toggle {
  background-color: var(--surface-solid) !important; color: var(--text) !important; border-color: var(--border) !important;
}
.leaflet-bar a:hover { background-color: var(--surface-2) !important; }
.leaflet-bar { border: 1px solid var(--border-strong) !important; box-shadow: var(--shadow-sm) !important; }
.leaflet-control-layers { border-radius: 10px !important; box-shadow: var(--shadow-sm) !important; }
.leaflet-control-layers-expanded { padding: 10px 12px !important; font-size: 14px; min-width: 190px; }
.leaflet-control-layers label { padding: 4px 2px; border-radius: 6px; }
.leaflet-control-layers-toggle { width: 40px !important; height: 40px !important; }
html:not(.light-mode) .leaflet-control-layers-toggle { filter: invert(1) hue-rotate(180deg); background-color: #e9edf4 !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow); }
.leaflet-popup-content-wrapper { border-radius: 12px; border: 1px solid var(--border); }
.leaflet-popup-content { margin: 14px 16px; min-width: 220px; max-width: 280px; font-size: 14px; line-height: 1.45; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-2); width: 28px; height: 28px; font-size: 22px; }
.leaflet-control-attribution { background: rgba(15, 23, 42, .7) !important; color: #cbd5e1 !important; font-size: 10.5px; }
.leaflet-control-attribution a { color: #93c5fd !important; }
html.light-mode .leaflet-control-attribution { background: rgba(255, 255, 255, .8) !important; color: #334155 !important; }
html.light-mode .leaflet-control-attribution a { color: #1d4ed8 !important; }
.vh-fs-control a { display: flex !important; align-items: center; justify-content: center; }
.vh-pseudo-fullscreen { position: fixed !important; inset: 0 !important; z-index: 5000 !important; width: 100vw !important; height: 100vh !important; height: 100dvh !important; border-radius: 0 !important; margin: 0 !important; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background-color: rgba(220, 38, 38, .35) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background-color: rgba(185, 28, 28, .92) !important; color: #fff !important; font-weight: 700; }
.marker-cluster div { font-family: var(--font); }

/* -------------------------------------------------------------- dialog */
.vh-dialog {
  width: min(720px, calc(100vw - 32px)); max-height: min(88vh, 900px); padding: 0; border: 1px solid var(--border-strong);
  border-radius: 18px; background: var(--surface-solid); color: var(--text); box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
.vh-dialog::backdrop { background: rgba(2, 6, 23, .62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.vh-dialog[open] { animation: vh-pop .2s ease-out; }
@keyframes vh-pop { from { opacity: .6; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .vh-dialog { width: 100vw; max-width: 100vw; max-height: 92vh; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: 0; }
  .vh-dialog[open] { animation: vh-sheet .24s ease-out; }
  @keyframes vh-sheet { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { .vh-dialog[open] { animation: none; } }

/* --------------------------------------------------------------- toasts */
.vh-toasts { position: fixed; z-index: 9000; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: calc(100vw - 32px); }
.vh-toast {
  pointer-events: auto; padding: 12px 16px; border-radius: 10px; background: #0f172a; color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, .15); box-shadow: var(--shadow); font-weight: 550; font-size: .92rem;
  animation: vh-toast-in .2s ease-out;
}
.vh-toast.is-ok { border-left: 4px solid var(--ok); }
.vh-toast.is-error { border-left: 4px solid var(--red); }
@keyframes vh-toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 640px) { .vh-toasts { left: 16px; right: 16px; bottom: 16px; } }

.vh-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--red); animation: vh-spin .8s linear infinite; }
@keyframes vh-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .vh-spinner { animation-duration: 2.4s; } }
