/* Lahore Classifieds — mobile-first, Craigslist-style minimal CSS */
:root {
  --link: #0000cc;
  --visited: #551a8b;
  --text: #222;
  --muted: #666;
  --line: #ddd;
  --bg: #fff;
  --green: #1a7f37;
  --red: #b42318;
  --amber: #92400e;
}

* { box-sizing: border-box; }

/* author styles (e.g. .stdform label { display:block }) must not defeat the hidden attribute */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--link); }
a:visited { color: var(--visited); }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 12px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* header */
.site-head { border-bottom: 1px solid var(--line); padding: 10px 0; margin-bottom: 16px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { font-size: 22px; font-weight: 700; text-decoration: none; color: var(--text) !important; }
.logo span { color: var(--green); }
.logo em { font-style: normal; font-weight: 400; font-size: 14px; color: var(--muted); }

/* city selector */
.citybar { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; padding: 8px 0 4px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.citybar strong { color: var(--text); }
.searchbar { display: flex; gap: 6px; margin-top: 10px; }
.searchbar input { flex: 1; }
.adminnav { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }

/* buttons + forms */
.btn {
  display: inline-block; padding: 8px 16px; border: 1px solid var(--line);
  border-radius: 4px; text-decoration: none; background: #f6f6f6;
  color: var(--text) !important; font-size: 14px; cursor: pointer;
}
.btn-post { background: var(--green); border-color: var(--green); color: #fff !important; font-weight: 600; }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff !important; }
button { font: inherit; }
.linklike {
  background: none; border: none; padding: 0; color: var(--link);
  text-decoration: underline; cursor: pointer; font-size: inherit;
}
.linklike.danger { color: var(--red); }
.inline { display: inline; }

input[type="text"], input[type="search"], input[type="email"], input[type="tel"],
input[type="password"], input[type="number"], input[type="file"], select, textarea {
  width: 100%; padding: 8px; border: 1px solid #bbb; border-radius: 4px;
  font: inherit; background: #fff;
}
input.tiny { width: 70px; }
.searchbar input, .searchbar button, .filterbar input, .filterbar select, .filterbar button { width: auto; }
.searchbar button, .filterbar button { padding: 8px 14px; }

.stdform { max-width: 620px; }
.stdform.narrow { max-width: 360px; }
.stdform label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
.stdform label .muted { font-weight: 400; }
.stdform input, .stdform select, .stdform textarea { margin-top: 4px; font-weight: 400; }
.stdform button[type="submit"] { margin-top: 6px; }
.form-2col { display: grid; grid-template-columns: 1fr; gap: 0 16px; }

.filterbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 18px; }
.filterbar input[type="search"], .filterbar input[type="text"] { flex: 1; min-width: 160px; }

/* honeypot — visually removed but present for bots */
.hp-field { position: absolute; left: -9999px; top: -9999px; height: 0; overflow: hidden; }

/* headings & text */
.page-title { font-size: 20px; margin: 4px 0 10px; }
.section-title { font-size: 16px; margin: 22px 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.muted, .count { color: var(--muted); font-weight: 400; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.price { color: var(--green); font-weight: 700; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

/* flash messages */
.flash { padding: 10px 12px; border-radius: 4px; margin-bottom: 12px; font-size: 14px; }
.flash ul { margin: 0; padding-left: 18px; }
.flash-ok { background: #e6f4ea; color: var(--green); border: 1px solid #b7dfc2; }
.flash-error { background: #fdecea; color: var(--red); border: 1px solid #f5c6c0; }
.flash-warn { background: #fef3cd; color: var(--amber); border: 1px solid #f0dc9a; }

/* homepage: category directory + latest ads */
.home-cols { display: block; }
.cat-grid { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 20px; }
.cat-grid > li { padding: 0 0 14px; break-inside: avoid; }
.cat-head { font-weight: 700; }
.cat-sub { list-style: none; padding: 2px 0 0; margin: 0; font-size: 14px; }
.cat-sub li { padding: 1px 0; }

/* subcategory links on category pages */
.subcats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; margin: 4px 0 12px; }

.subinput { width: calc(100% - 20px); }

/* ad list */
.ad-list { list-style: none; padding: 0; margin: 0; }
.ad-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ad-thumb { flex: 0 0 88px; }
.ad-thumb img { width: 88px; height: 66px; object-fit: cover; border-radius: 3px; display: block; background: #eee; }
.noimg {
  display: flex; width: 88px; height: 66px; align-items: center; justify-content: center;
  background: #f0f0f0; color: #999; font-size: 11px; border-radius: 3px;
}
.ad-info { min-width: 0; }
.ad-title { font-weight: 600; word-break: break-word; }
.ad-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ad detail */
.ad-detail-meta { color: var(--muted); }
.gallery { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.gallery img { width: 150px; height: 112px; object-fit: cover; border-radius: 4px; background: #eee; display: block; }
.ad-desc { white-space: normal; margin: 16px 0; max-width: 700px; word-break: break-word; }
.contact-box { border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; max-width: 420px; margin: 20px 0; }
.contact-box h2 { margin: 0 0 10px; font-size: 15px; }
.contact-box p { margin: 8px 0; }
.report-box { margin: 24px 0; font-size: 14px; max-width: 420px; }
.report-box summary { cursor: pointer; color: var(--muted); }
.report-box form { margin-top: 10px; }
.report-box label { display: block; margin-bottom: 10px; }

/* tables (admin, my ads) */
.table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; }
.table th, .table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.narrowtable { max-width: 420px; }
.actions form { display: inline; }
.actions .linklike { margin-right: 8px; }

.status { font-size: 12px; padding: 1px 7px; border-radius: 10px; background: #eee; white-space: nowrap; }
.status-active { background: #e6f4ea; color: var(--green); }
.status-pending { background: #fef3cd; color: var(--amber); }
.status-suspended, .status-deleted { background: #fdecea; color: var(--red); }
.status-expired { background: #eee; color: var(--muted); }

/* stats */
.statgrid { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.statgrid li { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.statgrid strong { display: block; font-size: 20px; color: var(--text); }

.img-admin { text-align: center; font-size: 13px; }

/* pager */
.pager { display: flex; gap: 16px; align-items: center; margin: 18px 0; font-size: 14px; }
.pager .dim { color: #bbb; }

/* footer */
.site-foot { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 14px; padding-bottom: 24px; font-size: 13px; color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 6px; }

/* larger screens */
@media (min-width: 640px) {
  body { font-size: 16px; }
  .searchbar { max-width: 560px; }
  .cat-grid { columns: 3; }
  .form-2col { grid-template-columns: 1fr 1fr; }
  .ad-thumb, .ad-thumb img, .noimg { width: 120px; }
  .ad-thumb img, .noimg { height: 90px; }
  .statgrid { grid-template-columns: repeat(3, 1fr); }
  .page-title { font-size: 24px; }
}

@media (min-width: 900px) {
  /* Craigslist-style: category directory left, latest ads right */
  .home-cols { display: grid; grid-template-columns: 1fr 340px; gap: 32px; align-items: start; }
  .home-latest .section-title { margin-top: 0; }
  .cat-grid { columns: 3; }
  .statgrid { grid-template-columns: repeat(5, 1fr); }
}
