/* Public/SEO pages (home, search, item detail) — Django SSR + htmx/Alpine,
   per the #277 hybrid decision. Builds on tokens.css. See OpenProject #280. */

body { margin: 0; }
[x-cloak] { display: none !important; }

.alert-error {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--danger-soft);
  color: var(--danger-ink);
  font-size: 13.5px;
  margin-bottom: 4px;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ===== Top bar (full-bleed, like the SPA's — see #281's fix for why
   the rounded floating .nav-mock pill is wrong for persistent chrome) ===== */
.app-topbar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border); }
.app-topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; }
.nav-links-public { display: flex; align-items: center; gap: 14px; }
.nav-links-public a { font-size: 14px; font-weight: 600; color: var(--ink-soft); text-decoration: none; }
.nav-links-public a:hover { color: var(--accent); }
.nav-mobile-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--ink); }
@media (max-width: 760px) {
  .nav-mobile-toggle { display: block; }
  .nav-links-public {
    display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--surface);
    border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch; gap: 10px; padding: 16px 24px;
  }
  .nav-links-public.open { display: flex; }
}

/* ===== Footer (shared structure with the SPA's Footer.tsx) ===== */
.app-footer { margin-top: 24px; border-top: 1px solid var(--border); background: var(--surface); padding: 20px 0; }
.app-footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
@media (max-width: 760px) { .app-footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .app-footer-grid { grid-template-columns: 1fr; } }
.app-footer-brand p { margin-top: 10px; font-size: 13px; color: var(--ink-faint); max-width: 32ch; }
.app-footer-col { display: flex; flex-direction: column; gap: 9px; }
.app-footer-heading { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); margin-bottom: 2px; }
.app-footer-col a { font-size: 13.5px; color: var(--ink-soft); text-decoration: none; }
.app-footer-col a:hover { color: var(--accent); }

/* ===== Hero + search (home) ===== */
.hero { background: radial-gradient(760px 320px at 15% -10%, var(--accent-soft) 0%, transparent 60%), var(--bg); padding: 56px 0 40px; border-bottom: 1px solid var(--border); }
.hero h1 { font-size: clamp(30px, 4.5vw, 46px); max-width: 15ch; line-height: 1.06; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero p.lede { color: var(--ink-soft); font-size: 16.5px; max-width: 56ch; margin-top: 14px; }
.searchbar { margin-top: 26px; display: flex; gap: 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 999px; padding: 6px; box-shadow: var(--shadow-sm); max-width: 640px; flex-wrap: wrap; }
.searchbar input[type="text"] { border: none; background: transparent; flex: 1; min-width: 160px; padding: 10px 16px; font-family: var(--font-body); font-size: 15px; color: var(--ink); }
.searchbar input[type="text"]:focus { outline: none; }
.searchbar button { border-radius: 999px; }

/* On narrow viewports the text input + 3 buttons wrap onto multiple
   rows — the full 999px pill radius (meant for a single-row bar) then
   clips/crowds the wrapped rows against the container's rounded corners
   ("nu se încadrează", #293). A smaller radius reads fine wrapped. */
@media (max-width: 480px) {
  .searchbar { border-radius: var(--radius-lg); flex-wrap: wrap; }
  .searchbar input[type="text"] { flex-basis: 100%; min-width: 0; }
  .searchbar > button, .searchbar > div { flex: 1; }
}

.cat-row { display: flex; gap: 10px; overflow-x: auto; padding: 22px 0 4px; margin-top: 6px; }
.cat-chip { flex-shrink: 0; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; cursor: pointer; text-decoration: none; }
.cat-chip.active, .cat-chip:hover { background: var(--accent-soft); color: var(--accent-soft-ink); border-color: transparent; }

/* ===== Results / item grid (shared: home + search) ===== */
.results-head { display: flex; justify-content: space-between; align-items: baseline; margin: 40px 0 18px; flex-wrap: wrap; gap: 10px; }
.results-head h2 { font-size: 22px; }
.results-count { color: var(--ink-faint); font-size: 13.5px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.item-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow .15s ease, transform .15s ease; display: block; text-decoration: none; color: inherit; }
.item-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.item-thumb { height: 150px; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); position: relative; background-color: var(--surface-2); background-size: cover; background-position: center; }
.item-thumb .fav { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 15px; color: var(--ink-faint); box-shadow: var(--shadow-sm); cursor: pointer; }
.item-thumb .fav.is-favorite { color: var(--accent); }
.item-body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.item-cat { font-size: 11.5px; color: var(--teal-ink); background: var(--teal-soft); width: fit-content; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.item-title { font-weight: 700; font-size: 15px; line-height: 1.35; color: var(--ink); }
.item-meta { font-size: 12.5px; color: var(--ink-faint); display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
.item-price { font-size: 11.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; }

/* ===== Search form (search results page) ===== */
.search-panel { padding: 22px; display: flex; flex-direction: column; gap: 14px; margin-top: 24px; }
.search-row { display: flex; gap: 12px; flex-wrap: wrap; }
.search-row .field { flex: 1; min-width: 180px; }

/* ===== Pagination ===== */
.pager { display: flex; justify-content: center; gap: 8px; margin: 36px 0 8px; }
.pager a, .pager span.current { min-width: 36px; height: 36px; padding: 0 10px; border-radius: 999px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); color: var(--ink-soft); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.pager span.current { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pager a:hover { background: var(--surface-2); }

/* ===== Category / location picker (Alpine, replaces the AdminLTE modals) ===== */
.picker-panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 40; width: min(520px, 90vw); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: 16px; }
.picker-crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; font-size: 12.5px; }
.picker-crumbs button { border: none; background: none; padding: 0; cursor: pointer; color: var(--ink-soft); font-family: var(--font-body); }
.picker-crumbs button.current { color: var(--accent); font-weight: 700; }
.picker-options { display: flex; flex-wrap: wrap; gap: 8px; max-height: 280px; overflow-y: auto; }
.searchbar { position: relative; }

/* ===== Item detail page ===== */
.breadcrumb { font-size: 13px; color: var(--ink-faint); padding: 20px 0 0; }
.breadcrumb a { color: var(--ink-faint); text-decoration: none; }
.detail-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 36px; margin: 24px 0 60px; }
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }

.gallery-main { height: 380px; border-radius: var(--radius-lg); background-color: var(--surface-2); background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; color: var(--ink-faint); font-family: var(--font-mono); font-size: 13px; box-shadow: var(--shadow-sm); }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.gallery-thumbs img { width: 72px; height: 56px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.gallery-thumbs img.active { border-color: var(--accent); }

.title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-top: 24px; }
.title-row h1 { font-size: 28px; max-width: 26ch; }
.meta-line { display: flex; gap: 18px; margin-top: 12px; color: var(--ink-soft); font-size: 13.5px; flex-wrap: wrap; }
.desc { margin-top: 26px; font-size: 15.5px; line-height: 1.7; color: var(--ink); max-width: 62ch; }

.owner-card { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.owner-head { display: flex; align-items: center; gap: 12px; }
.owner-name { font-weight: 700; font-size: 15px; }
.owner-sub { font-size: 12.5px; color: var(--ink-faint); }
.stat-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 10px 0; border-top: 1px solid var(--border); }
.stat-row .k { color: var(--ink-faint); }
.stat-row .v { font-weight: 600; }
.swap-hint { background: var(--accent-soft); color: var(--accent-soft-ink); border-radius: var(--radius-md); padding: 16px; font-size: 13.5px; line-height: 1.55; }

.detail-tabs { display: flex; gap: 6px; margin-top: 40px; border-bottom: 1px solid var(--border); }
.detail-tab { padding: 10px 16px; font-size: 14px; font-weight: 600; color: var(--ink-faint); cursor: pointer; border-bottom: 2px solid transparent; }
.detail-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.detail-tab-panel { padding: 20px 0; }

/* ===== Auth pages (#286) — login, signup, password reset/change, email
   verification. Minimal chrome via layouts/base-auth.html. ===== */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 40px 20px;
  background: radial-gradient(640px 280px at 50% -10%, var(--accent-soft) 0%, transparent 60%), var(--bg);
}
.auth-brand { font-size: 20px; text-decoration: none; color: var(--ink); }
.auth-card { width: 100%; max-width: 420px; padding: 32px 30px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-size: 22px; }
.auth-card p { color: var(--ink-soft); font-size: 14px; }
.auth-footnote { font-size: 13px; }
.auth-footnote a { color: var(--ink-faint); }

.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-input-icon { position: relative; }
/* #297: a long email/password value ran right up against the icon —
   give it clearly more room than the icon's own footprint needs. */
.auth-input-icon input { padding-right: 46px; }
.auth-input-icon .icon { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: 14px; pointer-events: none; }
.auth-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.auth-check input { margin-top: 3px; }
.auth-switch { text-align: center; font-size: 13.5px; color: var(--ink-soft); }

/* Generic styling for allauth's default {{ form.as_p }} output (password
   reset/change/set — simple enough that hand-rolled markup like login/
   signup's isn't worth it) — scoped so it doesn't leak into the rest of
   the site. */
.auth-card form p { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.auth-card form label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.auth-card form input[type="text"],
.auth-card form input[type="email"],
.auth-card form input[type="password"] {
  font-family: var(--font-body); font-size: 14.5px; padding: 10px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg); color: var(--ink); width: 100%;
}
.auth-card form input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.auth-card form ul.errorlist { list-style: none; margin: 0 0 6px; padding: 0; color: var(--danger); font-size: 12.5px; }
/* :not(.btn) so this fallback never fights the real .btn-secondary/.btn-danger
   classes on deliberately-styled buttons (e.g. email_change.html's action
   buttons) — this rule exists only for bare {{ form.as_p }} submit inputs
   (password reset/set) that have no class at all. */
.auth-card form input[type="submit"], .auth-card form button:not(.btn) {
  font-family: var(--font-body); font-weight: 600; font-size: 14.5px; border-radius: 999px; border: none;
  padding: 11px 22px; cursor: pointer; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-sm);
}
.auth-card form input[type="submit"]:hover, .auth-card form button:not(.btn):hover { background: var(--accent-hover); }

.email-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.email-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13.5px; }
