:root {
  --jadoke-green: #16330a;
  --jadoke-green-light: #2d5c19;
  --jadoke-accent: #e07b1a;
  --jadoke-accent-dark: #c2650e;
  --jadoke-gray: #7a7a7a;
  --bg: #f7f7f5;
  --card-bg: #ffffff;
  --border: #e2e2de;
  --text: #222;
  --text-muted: #6b6b6b;
  --danger: #b3261e;
  --success: #1e7a34;
}

* { box-sizing: border-box; }

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

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--jadoke-green-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.site-header { background: #fff; border-bottom: 1px solid var(--border); }
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 20px;
  flex-wrap: wrap;
}
.logo-link { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo { height: 42px; width: auto; }
.tagline { color: var(--jadoke-gray); font-size: 0.85rem; font-style: italic; display: none; }
@media (min-width: 640px) { .tagline { display: inline; } }

.header-search { flex: 1; display: flex; min-width: 200px; }
.header-search input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 4px 0 0 4px;
}
.header-search button {
  padding: 8px 16px;
  border: none;
  background: var(--jadoke-green);
  color: #fff;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
}

.header-nav { display: flex; align-items: center; gap: 16px; font-size: 0.95rem; }

/* Hidden by default (desktop) — only shown below the mobile breakpoint,
   where it replaces .header-nav's normal inline layout. See the
   @media block near the bottom of this file. */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1.2rem;
  line-height: 1;
  padding: 6px 12px;
  cursor: pointer;
  color: var(--jadoke-green);
}
.nav-toggle:hover { background: var(--bg); }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: 0.92; }
.btn-accent { background: var(--jadoke-accent); color: #fff; }
.btn-primary { background: var(--jadoke-green); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--jadoke-green); color: var(--jadoke-green); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { display: block; width: 100%; text-align: center; }

.category-bar { background: var(--jadoke-green); }
/* Not wrapping here — .listing-type-filter and .category-links sit
   side by side as two flex items. .category-links wraps internally
   (its own flex-wrap below) while .listing-type-filter stays one row;
   flex's default align-items:stretch then makes .listing-type-filter
   stretch to match however tall .category-links gets, so its divider
   line runs the full height even when categories wrap to a 2nd line. */
.category-bar-inner { display: flex; gap: 18px; padding: 8px 20px; }
.category-bar-inner a { color: #eee; font-size: 0.85rem; }
.category-bar-inner a:hover { color: #fff; }

.category-links {
  display: flex; gap: 18px; flex-wrap: wrap; align-items: center; align-content: center;
}

.listing-type-filter {
  display: flex; gap: 2px; align-items: center; flex-shrink: 0;
  margin-right: 10px; padding-right: 14px;
  border-right: 1px solid rgba(255,255,255,0.3);
}
.listing-type-filter a {
  padding: 3px 10px; border-radius: 999px; font-size: 0.8rem;
  background: rgba(255,255,255,0.12);
}
.listing-type-filter a:hover { background: rgba(255,255,255,0.22); }
.listing-type-filter a.active { background: #fff; color: var(--jadoke-green); font-weight: 600; }
.listing-type-filter a.active:hover { color: var(--jadoke-green); }

.category-more { position: relative; }
.category-more-toggle {
  background: none; border: none; color: #eee; font-size: 0.85rem;
  cursor: pointer; padding: 0; font-family: inherit;
}
.category-more-toggle:hover { color: #fff; }
.category-more-menu {
  display: none; position: absolute; top: 100%; left: 0; margin-top: 8px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.15); padding: 8px 0; min-width: 180px; z-index: 20;
}
.category-more-menu.open { display: block; }
.category-more-menu a {
  display: block; padding: 6px 16px; color: var(--text); font-size: 0.85rem;
}
.category-more-menu a:hover { background: #f0f0ec; }

/* Mobile header — below this width, .header-nav's links (How It
   Works, Sell, My Account, etc.) would otherwise wrap across several
   lines fighting for space next to the search bar. Instead they
   collapse behind .nav-toggle (a plain "menu" button, shown here and
   hidden on desktop) and drop into a stacked panel underneath the
   header row when tapped open (see the nav-toggle click handler in
   base.html). The category bar isn't hidden the same way — it just
   becomes a single horizontally-scrollable row instead of wrapping,
   since swiping sideways through categories is faster than opening
   another menu for something people tap often. */
@media (max-width: 700px) {
  .nav-toggle { display: block; order: 3; }
  .header-search { order: 2; }
  .header-nav {
    display: none;
    order: 4;
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }
  .header-nav.open { display: flex; }

  .category-bar-inner {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .listing-type-filter, .category-links { flex-shrink: 0; flex-wrap: nowrap; }
}

/* Layout */
.page { padding: 28px 20px 60px; min-height: 60vh; }

.flash-stack { margin-bottom: 20px; }
.flash { padding: 10px 14px; border-radius: 4px; margin-bottom: 8px; font-size: 0.92rem; }
.flash-success { background: #e6f4ea; color: var(--success); border: 1px solid #b7e0c3; }
.flash-error { background: #fbe9e7; color: var(--danger); border: 1px solid #f3c2bd; }
.flash-info { background: #eef3fb; color: #2757a8; border: 1px solid #c9dcf3; }

h1, h2, h3 { color: var(--jadoke-green); }

/* Browse / search filters */
.filters {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filters .field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; }
.filters input, .filters select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.listing-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.featured-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #2757a8;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Featured-ad sections (hero / homepage banner strip / category ad) —
   see app/featured_ads.py. */
.featured-section { margin-bottom: 28px; }
.featured-section .featured-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--jadoke-accent-dark);
  margin-bottom: 8px;
}
.ad-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.ad-grid .listing-card img { height: 90px; }
.ad-grid .listing-card .body { padding: 8px 10px; gap: 2px; }
.ad-grid .listing-card .price { font-size: 1rem; }
@media (max-width: 700px) { .ad-grid { grid-template-columns: repeat(2, 1fr); } }
.hero-fallback {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
}
.hero-fallback a { color: var(--jadoke-accent-dark); font-weight: 600; }

/* Hero Ad section — the single most prominent (and most expensive)
   placement, so it gets its own visual treatment: a bordered card
   with a solid green banner header, rather than the plain label used
   by the other featured-ad sections. */
.hero-section {
  border: 3px solid var(--jadoke-accent);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 28px;
  background: var(--card-bg);
}
.hero-banner {
  background: var(--jadoke-green);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
}
.hero-section .listing-grid {
  grid-template-columns: repeat(3, 1fr);
  padding: 16px;
  margin: 0;
}
.hero-section .hero-fallback {
  margin: 16px;
  border: none;
  padding: 24px;
}
@media (max-width: 700px) {
  .hero-section .listing-grid { grid-template-columns: 1fr; }
}
@media (min-width: 701px) and (max-width: 980px) {
  .hero-section .listing-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Admin section nav — a flat row of buttons shared by every admin/*.html
   page (see admin/_nav.html), one per admin section. Deliberately NOT
   the old arrow-chained "Manage X ->" hint line, which looked like a
   nested breadcrumb hierarchy instead of a set of sibling pages. */
.admin-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.admin-nav a {
  padding: 8px 16px;
  border-radius: 4px;
  border: 1px solid var(--jadoke-green);
  color: var(--jadoke-green);
  font-weight: 600;
  font-size: 0.9rem;
}
.admin-nav a:hover { text-decoration: none; background: #eef3ea; }
.admin-nav a.active { background: var(--jadoke-green); color: #fff; }

/* Featured-ad start-date calendar — see sell.html. */
.calendar {
  max-width: 320px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--card-bg);
}
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.calendar-header .btn { padding: 4px 10px; }
.calendar-header span { font-weight: 600; }
.calendar-weekdays, .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}
.calendar-weekdays span { font-size: 0.75rem; color: var(--text-muted); padding: 2px 0; }
.calendar-day {
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  font-size: 0.85rem;
  cursor: default;
}
.calendar-day-empty { visibility: hidden; }
.calendar-day-disabled { color: var(--text-muted); opacity: 0.4; }
.calendar-day-soldout { background: #f4e6e6; color: var(--danger); opacity: 0.7; text-decoration: line-through; }
.calendar-day-open { background: #eaf3e6; color: var(--success); cursor: pointer; }
.calendar-day-open:hover { border-color: var(--success); }
.calendar-day-selected { background: var(--jadoke-green); color: #fff; }
/* Browse pagination — Previous/Next, nearby page numbers with
   first/last + ellipsis, and a type-a-page-number jump box. Rendered
   identically above and below the results grid (see browse.html). */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
}
.pagination-disabled { opacity: 0.4; pointer-events: none; }
.pagination-numbers { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pagination-numbers a,
.pagination-current,
.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 0.85rem;
}
.pagination-numbers a { border: 1px solid var(--border); color: var(--jadoke-green); }
.pagination-numbers a:hover { background: #f0f0ec; }
.pagination-current { background: var(--jadoke-green); color: #fff; font-weight: 600; }
.pagination-ellipsis { color: var(--text-muted); }
.pagination-jump { display: flex; align-items: center; gap: 6px; margin: 0; }
.pagination-jump label { display: flex; align-items: center; gap: 6px; font-weight: normal; }
.pagination-jump input[type=number] {
  width: 60px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 4px;
}
.pagination-summary { margin-left: auto; }
@media (max-width: 700px) {
  .pagination-summary { margin-left: 0; order: 10; width: 100%; }
}

.listing-card img { width: 100%; height: 150px; object-fit: cover; background: #eee; }
.listing-card .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.listing-card .price { font-size: 1.2rem; font-weight: 700; color: var(--jadoke-accent-dark); }
.listing-card .dropping { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.listing-card .status-pill {
  align-self: flex-start;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef3fb;
  color: #2757a8;
}

/* Listing detail — .listing-info (description, attributes, seller info,
   price/bid box) on the left, .listing-photos (just the image gallery)
   on the right, via named grid areas rather than plain column order.
   That indirection is what lets the mobile stack below reorder to
   photos-then-info without duplicating any markup — title/photo/price
   before you have to scroll into the description, which is also a
   more natural mobile reading order than "info column, then photos"
   would have been. See .price-block's position:sticky below for the
   other half of the fix (Don/Chad: the price box used to scroll out
   of view entirely once you reached the description). */
.listing-detail {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  grid-template-areas: "info photos";
  align-items: start;
  gap: 32px;
}
@media (max-width: 800px) {
  .listing-detail {
    grid-template-columns: 1fr;
    grid-template-areas: "photos" "info";
  }
}
.listing-info { grid-area: info; }
.listing-photos { grid-area: photos; }
.listing-images img { width: 100%; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 8px; }

/* Title banner — the listing title is the one heading on the site that
   gets a solid accent-colored treatment instead of a plain <h1>, since
   it's the first thing noticed on the page and the most important. */
.title-banner {
  background: var(--jadoke-accent);
  border-radius: 8px;
  padding: 12px 18px;
  margin: 8px 0 10px;
}
.title-banner h1 { color: #fff; margin: 0; font-size: 1.5rem; line-height: 1.25; }

/* Boxed info card — a labeled white card used to set off a block of
   content (description, attributes) the same way .price-block already
   does for pricing. */
.info-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.info-card h3 {
  margin: 0 0 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.info-card p { margin: 0; }

.attribute-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.attribute-grid .attr-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
}
.attribute-grid .attr-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.attribute-grid .attr-value { font-weight: 600; }
@media (max-width: 480px) { .attribute-grid { grid-template-columns: 1fr; } }

.reserve-callout {
  border-left: 4px solid var(--jadoke-green-light);
  background: #f4f8f1;
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--text);
}

/* position:sticky is the actual fix for "price scrolls out of view" —
   pins the box near the top of the viewport once you scroll past its
   normal spot, so it's still visible while reading the description
   below it. Sticks within .listing-info (its own containing block),
   so it un-sticks and scrolls away normally once you've scrolled past
   everything else in that column too — not stuck forever. Works the
   same way whether .listing-info is a side column (desktop) or the
   second stacked block (mobile, see .listing-detail above), since
   sticky positioning doesn't care about the grid layout, only the
   normal document scroll. */
.price-block {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  position: sticky;
  top: 16px;
  z-index: 2;
}
.big-price { font-size: 2.4rem; font-weight: 800; color: var(--jadoke-accent-dark); }
.next-drop { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 14px; }
.bid-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.will-buy-form { display: flex; gap: 8px; }
.will-buy-form input { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 4px; }

/* Multi-unit listings (see Listing.quantity/quantity_available) —
   badge sits beside the Buy It Now button rather than above it. */
.qty-available-badge {
  border: 1px solid var(--jadoke-accent);
  color: var(--jadoke-accent-dark);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 4px;
  white-space: nowrap;
  background: #fdf1e4;
}

form.stacked-form { display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
form.stacked-form label { font-weight: 600; font-size: 0.9rem; }
/* Boxed section grouping within a long form (Sell / Edit listing) —
   same white-card treatment used elsewhere on the site, so a long form
   reads as a handful of clear groups instead of one unbroken column. */
form.stacked-form .form-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
form.stacked-form .form-section h2 {
  margin: 0 0 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 1rem;
}
form.stacked-form input[type=text],
form.stacked-form input[type=password],
form.stacked-form input[type=email],
form.stacked-form input[type=number],
form.stacked-form textarea,
form.stacked-form select {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 4px; width: 100%; font-family: inherit;
}
form.stacked-form .form-row { display: flex; gap: 14px; flex-wrap: wrap; }
form.stacked-form .form-row > div { flex: 1; min-width: 180px; }
.field-error { color: var(--danger); font-size: 0.8rem; }
.hint { color: var(--text-muted); font-size: 0.8rem; }

.checkbox-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.checkbox-list li { display: flex; align-items: center; gap: 6px; font-weight: normal; }
.checkbox-list input[type=checkbox] { width: auto; }

/* Boxed page section — the same white-card treatment used for
   .form-section and the listing detail page's .info-card, applied to
   .dashboard-section so every page that uses it (Account Dashboard,
   seller profile, Account Settings, admin pages, How It Works, Terms,
   Privacy) gets the same look site-wide instead of a plain heading
   with no visual boundary. */
.dashboard-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 24px;
}
.dashboard-section h2 {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 1.1rem;
}
table.simple-table { width: 100%; border-collapse: collapse; background: var(--card-bg); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
table.simple-table th, table.simple-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
table.simple-table th { background: #f0f0ec; color: var(--text-muted); font-weight: 600; }

.empty-state { color: var(--text-muted); padding: 24px; text-align: center; border: 1px dashed var(--border); border-radius: 8px; }

.site-footer { border-top: 1px solid var(--border); padding: 20px 0; color: var(--text-muted); font-size: 0.85rem; margin-top: 40px; }
