/* Dan's List — Classic Craigslist skin (T25, per danslist-design/ prototype).
   White bg, black text, blue/visited-purple underlined links, Verdana 14px,
   dense link grids, minimal chrome. Functionality classes (T22 map, T23
   photos, T24 badge/panel/toast) preserved with light-theme styling. */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --link: #0000EE;
  --visited: #551A8B;
  --hover: #CC0000;
  --text: #000;
  --dim: #666;
  --faint: #777;
  --band: #f4f4f4;
  --sep: #ddd;
  --row-hover: #f6f6fb;
  --unread: #ffffcc;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: Verdana, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; width: 100%; }

a { color: var(--link); text-decoration: underline; }
a:visited { color: var(--visited); }
a:hover { color: var(--hover); }

:focus-visible { outline: 2px dotted var(--link); outline-offset: 1px; }

b, strong { font-weight: bold; }

img { max-width: 100%; }

.wrap, .container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 18px 40px;
}

/* --- Header band ---------------------------------------------------- */

.site-header {
  background: var(--band);
  border-bottom: 1px solid #ccc;
  position: relative;
  z-index: 20;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 18px 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.header-brand { min-width: 0; }

.brand, .logo {
  font-size: 34px;
  font-weight: bold;
  color: var(--visited);
  letter-spacing: -1px;
  text-decoration: none;
  white-space: nowrap;
}

.brand:visited, .logo:visited { color: var(--visited); }
.brand:hover, .logo:hover { color: var(--visited); text-decoration: none; }

.tag { font-size: 12px; color: var(--dim); margin-top: 2px; }

.headerlinks { font-size: 13px; text-align: right; padding-top: 8px; min-width: 0; max-width: 100%; overflow-wrap: break-word; }

.nav-link {
  color: var(--link);
  margin-left: 12px;
  white-space: nowrap;
  text-decoration: underline;
}

.nav-link:visited { color: var(--visited); }
.nav-link:hover { color: var(--hover); }

.nav-link.active {
  font-weight: bold;
  color: var(--text);
  text-decoration: none;
}


/* --- Zip search bar -------------------------------------------------- */

.searchbar {
  padding: 10px 18px;
  background: #fff;
  border-bottom: 1px solid var(--sep);
}

.searchbar form {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.zip-input, .searchbar input[type=text] {
  font-family: inherit;
  font-size: 15px;
  padding: 6px 8px;
  border: 2px inset #ccc;
  width: 240px;
  max-width: 100%;
}

.zip-hint { color: var(--dim); font-size: 12px; flex-basis: 100%; }

/* --- Page head / notices / empty ------------------------------------ */

.page-title { font-size: 20px; }

.pagehead {
  border-bottom: 1px solid #999;
  margin: 4px 0 10px;
  padding-bottom: 6px;
}

.pagehead h1 { font-size: 20px; }
.pagehead .crumb, .crumb { font-size: 12px; color: var(--dim); margin-bottom: 3px; }
.page-sub { color: var(--dim); font-size: 13px; margin: 0 0 14px; }

.section-title { font-size: 16px; margin: 16px 0 6px; }

.notice {
  background: var(--unread);
  border: 1px solid #e0e0a0;
  padding: 6px 10px;
  font-size: 13px;
  margin-bottom: 10px;
}

.error-banner {
  color: var(--hover);
  font-size: 13px;
  margin: 10px 0;
  padding: 6px 10px;
  border: 1px solid #e0b0b0;
  background: #fff4f4;
}

.empty {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--sep);
  color: var(--dim);
  font-size: 14px;
}

.muted { color: var(--dim); }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.hidden { display: none !important; }

/* --- Category link grid + filter row -------------------------------- */

.cats {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 0 0 8px;
}

.catcol { min-width: 200px; flex: 1; }

.catcol h2 {
  font-size: 16px;
  color: var(--text);
  border-bottom: 1px solid #999;
  padding-bottom: 3px;
  margin-bottom: 6px;
  font-weight: bold;
}

.catcol h2 + h2, .catcol h2.subhead { margin-top: 14px; }

.catcol h2 a, .catcol h2 a:visited { color: var(--text); text-decoration: none; }
.catcol h2 a:hover { color: var(--hover); }

.catcol ul { list-style: none; }
.catcol li { padding: 1px 0; font-size: 14px; }
.catcol li .count { color: var(--dim); font-size: 12px; }

.filters {
  font-size: 13px;
  background: #f7f7f7;
  border: 1px solid var(--sep);
  padding: 8px 10px;
  margin: 12px 0;
}

.filters a { margin-right: 10px; white-space: nowrap; }

.filters .on, .filters .on:visited {
  font-weight: bold;
  color: var(--text);
  text-decoration: none;
}

/* --- Listing rows ---------------------------------------------------- */

ul.rows, .rows { list-style: none; border-top: 1px solid var(--sep); }

ul.rows li, .rows > .thread {
  border-bottom: 1px solid var(--sep);
  padding: 7px 6px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

ul.rows li:hover { background: var(--row-hover); }

.rows .thumb, ul.rows .thumb {
  width: 66px;
  height: 50px;
  object-fit: cover;
  border: 1px solid #ccc;
  background: #eee;
  flex: 0 0 auto;
}

ul.rows .rmain, .rows .rmain { flex: 1; min-width: 0; }
ul.rows .rtitle, .rows .rtitle { font-size: 15px; }

.card-title-link {
  color: var(--link);
  font-size: 15px;
  overflow-wrap: break-word;
}

ul.rows .rmeta, .rows .rmeta {
  font-size: 12px;
  color: var(--dim);
  margin-top: 2px;
  overflow-wrap: break-word;
}

ul.rows .rprice, .rows .rprice {
  font-weight: bold;
  font-size: 14px;
  white-space: nowrap;
}

ul.rows .rdate, .rows .rdate {
  font-size: 12px;
  color: var(--dim);
  white-space: nowrap;
}

.rows .rside { text-align: right; flex: 0 0 auto; }

.pagn { padding: 12px 6px; font-size: 14px; color: var(--dim); }

.anon { color: var(--dim); font-style: italic; }

/* --- Listing detail -------------------------------------------------- */

.detail h1 { font-size: 20px; margin-bottom: 4px; overflow-wrap: break-word; }

.detail .price {
  font-size: 18px;
  font-weight: bold;
  color: #111;
  margin: 6px 0;
}

.detail .meta {
  font-size: 12px;
  color: var(--dim);
  border-bottom: 1px solid var(--sep);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.gallery { margin: 0 0 14px; }

.gallery-main {
  border: 1px solid #ccc;
  overflow: hidden;
  background: #eee;
  max-width: 640px;
}

.gallery-main img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  background: #eee;
}

.gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.gallery-thumb {
  padding: 0;
  border: 2px solid #ccc;
  background: #eee;
  cursor: pointer;
  overflow: hidden;
  width: 64px;
  height: 64px;
}

.gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb.active { border-color: #999; }

.gallery-thumb:focus-visible { outline: 2px dotted var(--link); outline-offset: 1px; }

.detail .body {
  font-size: 15px;
  max-width: 720px;
  margin-bottom: 16px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.replybox {
  background: var(--band);
  border: 1px solid #ccc;
  padding: 10px 12px;
  max-width: 720px;
  font-size: 13px;
}

.replybox .reply-links { margin-top: 8px; }
.replybox .reply-links a { font-weight: bold; margin-right: 8px; }

/* --- Forms ------------------------------------------------------------ */

.form { max-width: 620px; margin: 12px 0; }

.field {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  margin-bottom: 10px;
  align-items: flex-start;
}

.label {
  width: 130px;
  flex: 0 0 auto;
  font-size: 13px;
  padding-top: 5px;
  text-align: right;
  color: #333;
}

input, select, textarea { max-width: 100%; }

.input, .select, .textarea, .zip-input {
  font-family: inherit;
  font-size: 14px;
  padding: 5px 6px;
  border: 2px inset #ccc;
  background: #fff;
  color: var(--text);
  max-width: 100%;
}

.field .input, .field .select, .field .textarea { flex: 1; min-width: 200px; width: auto; }

.textarea { min-height: 110px; resize: vertical; }

.help { font-size: 11px; color: var(--faint); flex-basis: 100%; padding-left: 140px; }

.form-error {
  color: var(--hover);
  font-size: 13px;
  flex-basis: 100%;
  padding-left: 140px;
}

.checkbox-row { display: flex; align-items: center; gap: 6px; padding-left: 140px; }
.checkbox { width: 16px; height: 16px; cursor: pointer; }
.checkbox-label { font-size: 13px; cursor: pointer; }

.photos input[type=file] { font-size: 12px; border: none; }
.photo-previews { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

.photo-preview {
  position: relative;
  width: 88px;
  height: 88px;
  border: 1px solid #ccc;
  overflow: hidden;
  background: #eee;
}

.photo-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }

.photo-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: #000;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.photo-remove:hover { background: var(--hover); color: #fff; }

.photo-note { margin: 8px 0 0; font-size: 13px; color: var(--hover); }

/* --- Buttons (outset gray, craigslist style) ------------------------- */

.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 14px;
  padding: 6px 14px;
  background: #e9e9ed;
  border: 2px outset #ccc;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:visited { color: var(--text); }
.btn:hover { background: #ddd; text-decoration: none; color: var(--text); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.primary { font-weight: bold; }
.btn.ghost { background: transparent; border: 1px solid #ccc; }
.btn.block { width: auto; }

.btn.small { font-size: 12px; padding: 3px 10px; }

.btn.danger, .delete-link {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--hover);
  text-decoration: underline;
  cursor: pointer;
}

.btn.danger:hover { background: none; color: var(--hover); text-decoration: underline; }

/* --- Inbox threads + messages ---------------------------------------- */

.thread-list { margin: 0 0 16px; }

.thread {
  border-bottom: 1px solid var(--sep);
  padding: 8px 6px;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}

.thread:hover { background: var(--row-hover); }
.thread.unread { background: var(--unread); }
.thread.unread:hover { background: #ffffe0; }

.thread-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.thread-title {
  color: var(--text);
  font-weight: bold;
  font-size: 14px;
  overflow-wrap: break-word;
}

.thread-with { font-size: 12px; color: var(--dim); }
.thread-last { font-size: 13px; color: var(--dim); overflow-wrap: break-word; }

.thread-side {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.thread-date { font-size: 12px; color: var(--dim); }

.unread-badge, .inbox-badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--hover);
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  text-align: center;
  line-height: 1.4;
  vertical-align: 1px;
}

.inbox-badge { margin-left: 2px; }

.messages { max-width: 720px; display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }

.msg, .message { border: 1px solid #ccc; margin-bottom: 2px; }

.msg .mh, .message-meta {
  background: #f0f0f0;
  font-size: 12px;
  padding: 4px 8px;
  color: #444;
}

.msg .mb, .message-body {
  padding: 8px;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.msg.mine, .message.mine { border-color: #b7b7e0; }
.msg.mine .mh, .message.mine .message-meta { background: #eef; }

/* --- Footer ------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid #ccc;
  margin-top: 30px;
  padding: 12px 18px;
  font-size: 11px;
  color: var(--faint);
}

.site-footer a { color: var(--faint); }
.site-footer .container { padding: 0; }

/* --- Browse map (T22) -------------------------------------------------- */

.browse-map-section { margin: 4px 0 8px; }

.browse-map {
  height: 280px;
  background: var(--band);
  border: 1px solid #ccc;
  z-index: 0;
}

.browse-map .leaflet-popup-content-wrapper,
.browse-map .leaflet-popup-tip {
  background: #fff;
  color: var(--text);
}

.browse-map .leaflet-popup-close-button { color: var(--dim); }

.browse-map .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.8);
  color: var(--faint);
}

.browse-map .leaflet-control-attribution a { color: var(--link); }

.browse-map .leaflet-bar a {
  background: #fff;
  color: var(--text);
  border-bottom-color: #ccc;
}

/* --- Notifications (T24): panel + toast -------------------------------- */

.notif-panel {
  display: none;
  position: absolute;
  top: 100%;
  right: 16px;
  width: min(340px, calc(100vw - 32px));
  max-height: 60vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #999;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 30;
}

.notif-panel.open { display: block; }

.notif-empty { padding: 14px 16px; font-size: 13px; color: var(--dim); }

.notif-row {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--sep);
  color: var(--text);
}

.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: var(--row-hover); text-decoration: none; color: var(--text); }

.notif-name { font-size: 13px; font-weight: bold; color: var(--text); }
.notif-age { float: right; font-size: 11px; color: var(--faint); }

.notif-title {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--visited);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-preview {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--dim);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #999;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.25);
  font-size: 13px;
}

.toast-link { font-weight: bold; white-space: nowrap; }

.toast-close {
  padding: 0 2px;
  border: none;
  background: none;
  color: var(--faint);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.toast-close:hover { color: var(--text); }

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in 160ms ease-out; }

  @keyframes toast-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }
}

/* --- Mobile (<=640px) --------------------------------------------------- */

@media (max-width: 640px) {
  .container, .wrap { padding: 12px; }
  .header-inner { padding: 10px 12px; }
  .brand, .logo { font-size: 26px; }
  .headerlinks { text-align: left; padding-top: 0; }
  .nav-link { margin-left: 0; margin-right: 12px; }

  .searchbar { padding: 10px 12px; }
  .zip-input, .searchbar input[type=text] { width: 100%; max-width: none; }

  .catcol { min-width: 100%; flex: 0 0 auto; }

  .thumb { width: 52px; height: 40px; }

  .label { width: auto; text-align: left; padding-top: 0; }
  .field { flex-direction: column; gap: 3px; }
  .field .input, .field .select, .field .textarea { width: 100%; min-width: 0; flex: none; }
  .help, .form-error { padding-left: 0; }
  .checkbox-row { padding-left: 0; }
  .btn.block { width: auto; }

  .notif-panel { right: 8px; }

  .form button { margin-left: 0; }
}

@media (min-width: 600px) {
  .browse-map { height: 360px; }
  .gallery-main img { max-height: 480px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
