/* MisplacedPets.com web frontend — styles.
 * Mobile-first, fast, and print-friendly. */
:root {
  --blue: #0d60ff;
  --blue-dark: #0a3fa8;
  --ink: #1c2430;
  --muted: #5d6b7d;
  --bg: #edf3fe;
  --card: #ffffff;
  --line: #d3e0f6;
  --lost: #c0392b;
  --found: #1e8449;
  --seen: #0d60ff;
  --warn-bg: #fff4e0;
  --warn-line: #e0a800;
  --warn-ink: #7a3b00;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(20, 40, 70, .12);
  --wrap: 1120px;
}
/* Dark mode (v1.0.7+): toggled via [data-theme] on <html>.
 * "dark" = standard gray, "black" = AMOLED black, "blue" = dark navy. */
[data-theme="dark"] {
  --blue: #5b93ff;
  --blue-dark: #0a3fa8;
  --ink: #ececec;
  --muted: #a3a3a3;
  --bg: #121212;
  --card: #1e1e1e;
  --line: #333333;
  --lost: #e57373;
  --found: #66bb6a;
  --seen: #5b93ff;
  --warn-bg: #2a2113;
  --warn-line: #a87f1a;
  --warn-ink: #f0c96a;
  --shadow: 0 1px 4px rgba(0, 0, 0, .45);
}
[data-theme="black"] {
  --blue: #5b93ff;
  --blue-dark: #0a3fa8;
  --ink: #f5f5f5;
  --muted: #9a9a9a;
  --bg: #000000;
  --card: #101010;
  --line: #262626;
  --lost: #e57373;
  --found: #66bb6a;
  --seen: #5b93ff;
  --warn-bg: #1d1710;
  --warn-line: #8a6a15;
  --warn-ink: #f0c96a;
  --shadow: 0 1px 4px rgba(0, 0, 0, .6);
}
[data-theme="blue"] {
  --blue: #5b93ff;
  --blue-dark: #0a3fa8;
  --ink: #e8edf5;
  --muted: #93a1b8;
  --bg: #0b1226;
  --card: #16213c;
  --line: #2c3a5c;
  --lost: #e57373;
  --found: #66bb6a;
  --seen: #5b93ff;
  --warn-bg: #2a2113;
  --warn-line: #a87f1a;
  --warn-ink: #f0c96a;
  --shadow: 0 1px 4px rgba(0, 0, 0, .45);
}
/* The logo is dark blue on transparent — unreadable on dark surfaces. */
[data-theme="dark"] .brand, [data-theme="black"] .brand, [data-theme="blue"] .brand {
  background: #fff; border-radius: 8px; padding: 4px 8px;
}
[data-theme="dark"] .nav-link:hover { background: #2b2b2b; }
[data-theme="black"] .nav-link:hover { background: #1a1a1a; }
[data-theme="blue"] .nav-link:hover { background: #22304f; }
.nav-theme {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 8px; padding: 6px 8px; font-size: .85rem; font-weight: 600; cursor: pointer;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.large-text { font-size: 125%; }
body {
  margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.5;
}
img { max-width: 100%; height: auto; }
a { color: var(--blue); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- header ---------- */
#site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; }
.brand img { height: 42px; display: block; max-width: 38vw; object-fit: contain; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: 8px; }
.nav-link { padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; white-space: nowrap; }
.nav-link:hover { background: #eef3f9; }
.nav-link.active { background: var(--blue); color: #fff; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-user { font-size: .9rem; color: var(--muted); }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 1.3rem; padding: 4px 10px; cursor: pointer; }

/* ---------- buttons / forms ---------- */
.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 10px 16px; border-radius: 8px; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--blue); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-danger { background: var(--lost); border-color: var(--lost); color: #fff; }
.btn-success { background: var(--found); border-color: var(--found); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: .85rem; }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn-post { white-space: nowrap; }

form .field { margin-bottom: 14px; }
label { display: block; font-weight: 700; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=datetime-local], input[type=number], input[type=tel], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; background: var(--card); color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: no-preference) { :focus-visible { transition: outline-color .15s; } }
.hint { font-size: .85rem; color: var(--muted); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-error {
  display: none; background: #fdecea; border: 1px solid #e5a49c; color: #8f1d12;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 600;
}
.checkbox-row { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.checkbox-row input { margin-top: 4px; }

/* ---------- hero ---------- */
.hero { background: linear-gradient(135deg, #0a3fa8, #0d60ff); color: #fff; padding: 44px 0; text-align: center; }
.hero h1 { margin: 0 0 8px; font-size: 2rem; }
.hero p { margin: 0 auto 18px; max-width: 640px; color: #dbe7f5; }
.hero-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hero .btn { border-color: transparent; }
.btn-hero-lost { background: var(--lost); color: #fff; }
.btn-hero-found { background: var(--found); color: #fff; }
.btn-hero-ghost { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.4); }

/* ---------- cards ---------- */
.section { padding: 28px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 1.4rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-body { padding: 12px 14px 14px; }
.card-body h3 { margin: 0 0 4px; font-size: 1.1rem; }
.card-body h3 a { color: var(--ink); text-decoration: none; }
.card-body h3 a:hover { text-decoration: underline; }
.card-photo { display: block; position: relative; aspect-ratio: 4/3; background: #e8edf3; overflow: hidden; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-photo-none { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 800; letter-spacing: .5px; }
.badge.type { position: absolute; top: 8px; left: 8px; color: #fff; }
.badge.type.lost { background: var(--lost); }
.badge.type.found { background: var(--found); }
.badge.type.seen { background: var(--seen); }
.badge.days { background: #fdecea; color: #8f1d12; border: 1px solid #e5a49c; }
.badge.status { background: #e8edf3; color: var(--muted); }
.card-badges { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.card-loc { font-size: .9rem; color: var(--muted); margin-top: 4px; }

/* ---------- listing detail ---------- */
.banner { color: #fff; text-align: center; font-size: 2rem; font-weight: 800; letter-spacing: 6px; padding: 10px; border-radius: var(--radius); margin: 18px 0 6px; }
.banner.lost { background: var(--lost); }
.banner.found { background: var(--found); }
.banner.seen { background: var(--seen); }
.listing-head { text-align: center; margin-bottom: 16px; }
.listing-head h1 { margin: 4px 0; font-size: 2rem; }
.listing-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; align-items: start; }
.gallery-main { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.gallery-thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.gallery-thumbs img.active { border-color: var(--blue); }
.detail-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.detail-table th, .detail-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.detail-table th { width: 130px; color: var(--muted); font-weight: 600; }
.detail-table tr:last-child th, .detail-table tr:last-child td { border-bottom: none; }
.desc-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; white-space: pre-wrap; }
.warn {
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink);
  border-radius: var(--radius); padding: 12px 14px; margin: 18px 0; font-size: .95rem;
}
.privacy-note {
  background: #eaf3ff; border: 1px solid #9cc3ee; color: #1a3c5e;
  border-radius: var(--radius); padding: 12px 14px; margin: 18px 0;
}
.contact-card { background: #eaf7ea; border: 2px solid var(--found); border-radius: var(--radius); padding: 14px; margin: 18px 0; text-align: center; }
.action-grid { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }

/* share pack */
.share-pack { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 18px 0; }
.share-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.share-manual { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 14px; }
.caption-box { font-family: ui-monospace, monospace; font-size: .85rem; }

/* matches */
.match-score { font-weight: 800; color: var(--blue); }
.score-bar { height: 8px; background: #e8edf3; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.score-bar > div { height: 100%; background: var(--blue); }
.comp-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.comp-chip { background: #eef3f9; border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; font-size: .78rem; }
.match-reasons { margin-top: 8px; }
.match-reasons ul { margin: 4px 0 0; padding-left: 20px; }
.match-reasons li { font-size: .9rem; }

/* ---------- map ---------- */
#map { height: 62vh; min-height: 420px; border-radius: var(--radius); border: 1px solid var(--line); }
.map-tools { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.map-zip { display: inline-flex; gap: 6px; align-items: center; }
.map-pin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.map-pin.lost { background: var(--lost); } .map-pin.found { background: var(--found); } .map-pin.seen { background: var(--seen); }
.map-popup img { width: 120px; border-radius: 6px; display: block; margin-bottom: 6px; }

/* ---------- checklist ---------- */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; display: flex; gap: 10px; align-items: flex-start; }
.checklist input[type=checkbox] { width: 22px; height: 22px; margin-top: 2px; flex-shrink: 0; }
.checklist li.done { opacity: .65; }
.checklist li.done .cl-title { text-decoration: line-through; }
.cl-title { font-weight: 700; }
.cl-detail { font-size: .9rem; color: var(--muted); }

/* ---------- misc ---------- */
.loading { text-align: center; padding: 40px 0; color: var(--muted); }
.spin { width: 34px; height: 34px; border: 4px solid var(--line); border-top-color: var(--blue); border-radius: 50%; margin: 0 auto 10px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; color: var(--muted); padding: 30px 10px; background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }
#toast-box { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1c2430; color: #fff; padding: 10px 18px; border-radius: 99px; opacity: 0; transition: opacity .3s; font-weight: 600; max-width: 90vw; }
.toast.show { opacity: 1; }
.toast.error { background: #8f1d12; }
.progress { height: 10px; background: #e8edf3; border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress > div { height: 100%; background: var(--blue); width: 0; transition: width .3s; }
.photo-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photo-preview img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.seg { display: flex; border: 2px solid var(--blue); border-radius: 10px; overflow: hidden; margin-bottom: 18px; }
.seg button { flex: 1; padding: 12px; font-size: 1.05rem; font-weight: 800; border: none; background: #fff; color: var(--blue); cursor: pointer; }
.seg button.active { background: var(--blue); color: #fff; }
.seg button#seg-lost.active { background: var(--lost); }
.seg button#seg-found.active { background: var(--found); }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-card { border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; background: #fff; }
.mode-card.selected { border-color: var(--blue); background: #f0f6fd; }
.mode-card h4 { margin: 0 0 4px; }
.mode-card p { margin: 0; font-size: .88rem; color: var(--muted); }
.flier-frame { width: 100%; height: 78vh; min-height: 560px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.article-body h3, .article-body h4 { margin-top: 1.2em; }
.shelter-card .card-body p { margin: 6px 0; }
.shelter-body { display: flex; gap: 14px; align-items: flex-start; }
.shelter-icon { flex: 0 0 auto; border-radius: 10px; margin-top: 2px; }
.shelter-main { flex: 1 1 auto; min-width: 0; }
.shelter-head { display: flex; align-items: center; gap: 10px; }
.shelter-head h3 { margin: 0; flex: 1 1 auto; }
.dist-badge { flex: 0 0 auto; background: var(--blue-soft, #e8f1fd); color: var(--blue, #1a6fd4); border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.shelter-fresh { margin: 4px 0 2px; font-size: .82rem; }
.freshness { color: var(--muted); font-weight: 600; }
.freshness-unknown { color: var(--warn-ink); font-weight: 600; }
.shelter-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn-call { background: var(--blue, #1a6fd4); color: #fff; border-color: var(--blue, #1a6fd4); }
.btn-call:hover { filter: brightness(1.08); color: #fff; }
.stale-badge { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); border-radius: 6px; padding: 2px 8px; font-size: .78rem; font-weight: 700; }
footer#site-footer, #site-footer { background: #16202e; color: #c7d3e2; margin-top: 40px; padding: 28px 0 18px; }
#site-footer a { color: #9fc3ee; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 20px; }
.footer-base { margin-top: 18px; padding-top: 12px; border-top: 1px solid #2b3a4f; font-size: .85rem; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .listing-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; flex-direction: column; padding: 8px 16px 14px; border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; }
  #site-header { position: relative; }
  .nav-toggle { display: block; margin-left: auto; }
  .nav-right .nav-user, .nav-right .nav-link { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .mode-pick { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.5rem; }
  .banner { font-size: 1.5rem; letter-spacing: 3px; }
}

/* ---------- print: fliers and listing pages print cleanly ---------- */
@media print {
  #site-header, #site-footer, .nav, .action-grid, .share-pack, #toast-box,
  .no-print, .hero-cta, form, .map-tools { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; }
  .card, .listing-grid, .share-pack { box-shadow: none; break-inside: avoid; }
  a { color: var(--ink); text-decoration: none; }
  .flier-frame { height: auto; border: none; }
}

/* ---------- confirmation / notice panels (post flow, pending listings) ---------- */
.notice-banner {
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink);
  border-radius: var(--radius); padding: 12px 16px; margin: 18px 0; font-size: .95rem;
}
.success-panel {
  border: 2px solid var(--found); border-radius: var(--radius); background: var(--card);
  padding: 28px; margin: 18px 0;
}
.success-panel h2 { margin-top: 0; }
.manage-link-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.manage-link-row input { flex: 1 1 260px; }

/* ---------- legal pages (terms / privacy) ---------- */
.legal { max-width: 760px; }
.legal h2 { margin-top: 1.6em; font-size: 1.2rem; }
.legal p, .legal li { line-height: 1.6; }
.legal .updated { font-size: .85rem; }

/* ---------- admin console ---------- */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 18px; }
.admin-tab { padding: 8px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); cursor: pointer; font-weight: 600; color: var(--muted); }
.admin-tab.active { color: #fff; background: var(--blue); border-color: var(--blue); }
.admin-table { width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .9rem; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }
.admin-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; }
.stat-card .num { font-size: 1.6rem; font-weight: 800; }
.stat-card .lbl { font-size: .8rem; color: var(--muted); }

/* ---------- giant hero buttons (home) ---------- */
.hero-big { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin: 8px 0 14px; }
.hero-big-btn {
  flex: 1 1 260px; max-width: 380px; display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 28px 20px; border-radius: 18px; text-decoration: none; color: #fff;
  box-shadow: 0 6px 22px rgba(0,0,0,.25); transition: transform .12s ease;
}
.hero-big-btn:hover { transform: translateY(-2px); color: #fff; }
.hero-big-btn.hero-lost { background: linear-gradient(135deg, #c0392b, #e74c3c); }
.hero-big-btn.hero-found { background: linear-gradient(135deg, #1e7e34, #28a745); }
.hero-big-emoji { font-size: 2.6rem; }
.hero-big-title { font-size: 1.7rem; font-weight: 900; letter-spacing: 1px; }
.hero-big-sub { font-size: .92rem; opacity: .92; text-align: center; }
.hero-alt { margin-top: 6px; }
.hero-alt a { color: #fff; opacity: .9; text-decoration: underline; }

/* ---------- form step badges ---------- */
.step {
  display: inline-block; background: var(--blue); color: #fff; font-size: .72rem;
  font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  border-radius: 999px; padding: 3px 12px; margin-right: 8px; vertical-align: middle;
}

/* ---------- photo-first drop zone ---------- */
.photo-first { border: 2px dashed var(--line); }
.photo-drop { position: relative; cursor: pointer; border-radius: var(--radius); }
.photo-drop input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}
.photo-drop-inner {
  border: 2px dashed var(--blue); border-radius: var(--radius); background: var(--card);
  padding: 30px 16px; text-align: center;
}
.photo-drop-inner:hover { background: color-mix(in srgb, var(--blue) 6%, var(--card)); }

/* ---------- species quick chips ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 6px 16px; font-size: .9rem; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.check-col { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }

/* ---------- urgency banner ---------- */
.urgency-banner {
  background: #fdecea; border: 2px solid #c0392b; color: #7a1a10;
  border-radius: var(--radius); padding: 12px 16px; margin: 18px 0; font-size: .95rem;
}
[data-theme="dark"] .urgency-banner, [data-theme="black"] .urgency-banner { background: #3a1410; color: #f5b7a8; }

/* ---------- tips list ---------- */
.tips { margin: 8px 0 0; padding-left: 20px; }
.tips li { margin-bottom: 6px; line-height: 1.5; }

/* ---------- match feedback ---------- */
.match-feedback .btn { margin: 4px 4px 0 0; }
