/* 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; }
/* :not(.btn) so this plain-link color never fights .btn-primary/.btn-secondary's
   own color on the Autentificare/Inregistrare/Contul meu buttons rendered
   inside this same nav (mobile review #292: signup button read as
   grey-on-orange instead of the intended white/dark-brown). */
.nav-links-public a:not(.btn) { font-size: 14px; font-weight: 600; color: var(--ink-soft); text-decoration: none; }
.nav-links-public a:not(.btn):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; }
}

/* Matches the SPA's .icon-btn (frontend/src/app.css) — same square-ish
   footprint for a short label like the RO/EN language switch. */
.icon-btn { padding: 9px 11px; line-height: 1; }

/* ===== Footer — single slim row (brand+tagline · nav links · meta),
   matching the SPA's Footer.tsx. Replaces the old multi-column grid
   per the "Footer Slim" design export. ===== */
.app-footer { margin-top: 24px; border-top: 1px solid var(--border); background: var(--surface); }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 32px; padding: 16px 0; }
.footer-brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.footer-tagline { font-size: 13px; color: var(--ink-faint); }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; font-size: 13.5px; margin-left: auto; }
.footer-links a { color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.footer-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-status { display: flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); flex: none; }
.footer-copyright { font-size: 12px; color: var(--ink-faint); white-space: nowrap; }

@media (max-width: 760px) {
  .footer-links { margin-left: 0; }
}
@media (max-width: 480px) {
  .footer-row { padding: 14px 0; gap: 10px 20px; }
}

/* ===== 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; align-items: center; 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; }
/* The Categorie/Judet picker triggers are wrapped in a positioning div
   (for their dropdown panel) — align-items:center on .searchbar alone
   won't center a *div's* content, so center it explicitly (#315: these
   buttons rendered shorter than Cauta and sat top-aligned, looking
   ragged next to it). */
.searchbar > div { display: flex; align-items: center; }

/* 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; }
}

/* Category chip row: wraps onto multiple rows instead of scrolling
   horizontally — all root-category chips stay visible with no scroll
   gesture needed, on any viewport width. */
.cat-row-wrap { position: relative; }
.cat-row { display: flex; flex-wrap: wrap; gap: 10px; 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: 36px; height: 36px; 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; padding: 0; }
.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); }
.gallery-main.clickable { cursor: zoom-in; }

.image-lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,0.88); display: flex; align-items: center; justify-content: center; }
.lightbox-image { max-width: 90vw; max-height: 88vh; object-fit: contain; border-radius: 6px; }
.lightbox-close { position: absolute; top: 20px; right: 24px; background: none; border: none; color: #fff; font-size: 28px; line-height: 1; cursor: pointer; padding: 8px; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.12); border: none; color: #fff; font-size: 32px; line-height: 1; width: 48px; height: 48px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lightbox-nav:hover { background: rgba(255,255,255,0.24); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.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);
}
@media (max-width: 480px) {
  /* On a short-content page (the auth card) inside a tall mobile
     viewport, vertical-centering the whole shell leaves ~180-200px of
     dead space above the card before the user reaches the form — bias
     toward the top instead of true centering below this width. */
  .auth-shell { justify-content: flex-start; padding-top: 64px; }
}
/* django-simple-captcha's default widget renders a fixed-size image
   (~90x40px) — far too small to read its distorted characters comfortably.
   The .auth-card itself is capped at max-width:420px on every viewport
   (not just mobile), so this isn't gated behind a breakpoint: the image
   always gets its own full-width row above the answer input + refresh
   button, scaled up to fill the card. */
.captcha-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.captcha-row img.captcha { flex-basis: 100%; width: 100%; max-width: 340px; height: auto; margin: 0 auto 6px; display: block; }
.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; }

/* ===== Add-item photo slots (user-tradeitem-add.html / update) =====
   bg_add.png is a white-background asset — on dark theme it renders as a
   glaring white square, so the empty slot swaps to a pre-recolored variant
   (bg_add_dark.png) rather than relying on a CSS filter guess (#310). A
   filled slot's photo is set inline per-item and is unaffected by theme. */
.image-add-empty {
  background: url('/static/assets/img/bg_add.png') no-repeat center center;
  background-size: contain;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .image-add-empty {
    background-image: url('/static/assets/img/bg_add_dark.png');
  }
}
:root[data-theme="dark"] .image-add-empty {
  background-image: url('/static/assets/img/bg_add_dark.png');
}
.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; }
