/* ============================================================
   Mercatino Advetrina — identità visiva "cartellino del prezzo"
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
    --bg: #eceee8;
    --bg-raised: #ffffff;
    --ink: #202a22;
    --ink-soft: #55594f;
    --muted: #8a8d80;
    --line: #d7d9cd;
    --accent: #c6952e;
    --accent-ink: #4a3608;
    --trust: #2f6f5e;
    --trust-bg: #e3ece8;
    --danger: #b23a34;
    --danger-bg: #f6e6e4;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(32, 42, 34, 0.06), 0 8px 24px rgba(32, 42, 34, 0.06);
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); }

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

/* ---------- Header con motivo "cartellino appeso" ---------- */

.site-header {
    padding: 28px 0 20px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-raised);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
}

.brand-tag {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: var(--accent);
    border-radius: 3px 10px 10px 3px;
    transform: rotate(-8deg);
    box-shadow: var(--shadow);
}

.brand-tag::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--bg-raised);
    border-radius: 50%;
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.35rem;
    letter-spacing: -0.01em;
}

.brand-sub {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--muted);
    display: block;
    margin-top: -2px;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.header-nav {
    display: flex;
    gap: 10px;
}

/* ---------- Bottoni ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 11px 20px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--ink);
    color: #fff;
}
.btn-primary:hover { box-shadow: var(--shadow); }

.btn-accent {
    background: var(--accent);
    color: var(--accent-ink);
}
.btn-accent:hover { box-shadow: var(--shadow); }

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--line);
}
.btn-ghost:hover { background: var(--bg); }

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Sezioni generiche ---------- */

main { padding: 36px 0 80px; }

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 8px;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }

.lede {
    color: var(--ink-soft);
    margin: 0 0 28px;
    max-width: 60ch;
}

.card {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ---------- Form ---------- */

.form-grid {
    display: grid;
    gap: 18px;
    padding: 28px;
}

@media (min-width: 640px) {
    .form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
}

.field label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 6px;
}

.field .hint {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 5px;
}

input[type="text"],
input[type="number"],
input[type="url"],
input[type="tel"],
textarea,
select {
    width: 100%;
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
}

textarea { resize: vertical; min-height: 90px; }

input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.radio-group { display: flex; gap: 14px; flex-wrap: wrap; }

.radio-card {
    flex: 1;
    min-width: 200px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    cursor: pointer;
    background: #fff;
}
.radio-card:has(input:checked) {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}
.radio-card input { margin-right: 8px; }
.radio-card .radio-title { font-weight: 600; }
.radio-card .radio-desc { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }

/* honeypot: nascosto ma presente nel DOM per il rilevamento bot */
.hp-field {
    position: absolute !important;
    left: -9999px !important;
    width: 1px; height: 1px; overflow: hidden;
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.form-error, .form-success {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.form-error { background: var(--danger-bg); color: var(--danger); }
.form-success { background: var(--trust-bg); color: var(--trust); }

/* ---------- Ticket del link di gestione (elemento "firma") ---------- */

.ticket {
    background: #fff;
    border: 1px dashed var(--ink);
    border-radius: 10px;
    padding: 24px;
    position: relative;
    margin-top: 8px;
}
.ticket::before, .ticket::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    background: var(--bg);
    border: 1px dashed var(--ink);
    border-radius: 50%;
    transform: translateY(-50%);
}
.ticket::before { left: -10px; }
.ticket::after { right: -10px; }

.ticket-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 600;
}

.ticket-token {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    word-break: break-all;
    background: var(--bg);
    padding: 12px;
    border-radius: 6px;
    margin: 10px 0 14px;
}

/* ---------- Filtri di ricerca ---------- */

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

/* ---------- Elenco annunci ---------- */

.grid-annunci {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.annuncio-card {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.annuncio-foto {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    margin: -18px -18px 0;
    width: calc(100% + 36px);
}

.annuncio-titolo {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0;
}

.annuncio-prezzo {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--accent-ink);
}

.annuncio-meta {
    font-size: 0.82rem;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--trust-bg);
    color: var(--trust);
    width: fit-content;
}

.annuncio-desc {
    font-size: 0.88rem;
    color: var(--ink-soft);
    flex-grow: 1;
}

.stato-pill {
    font-size: 0.72rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
    padding-top: 8px;
    margin-top: 4px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.skeleton {
    padding: 20px;
    color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
    border-top: 1px solid var(--line);
    padding: 24px 0;
    color: var(--muted);
    font-size: 0.82rem;
}
