:root {
    --bg: #ffffff;
    --bg-soft: #eef3ff;
    --text: #12162b;
    --muted: #5a5f75;
    --border: #e3e7f2;
    --navy: #101c46;
    --navy-light: #182a63;
    --yellow: #ffd400;
    --blue: #1a56db;
    --blue-dark: #123f9e;
    --success: #1c7c3c;
    --success-bg: #e8f7ec;
    --error: #b3261e;
    --error-bg: #fdecea;
    --radius: 14px;
}

* { box-sizing: border-box; }

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

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

a { color: var(--blue); }
h1, h2, h3 { letter-spacing: -0.01em; }

/* Top strip banner */
.top-strip {
    display: block; text-align: center; padding: 10px 20px; font-weight: 700; font-size: 0.9rem;
    text-decoration: none;
}
.top-strip span { display: inline-block; }

/* Header */
.site-header {
    background: var(--navy);
    padding: 16px 0;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-decoration: none;
    color: #ffffff;
}
.logo .logo-asta { color: var(--yellow); }
.logo svg { flex-shrink: 0; }

.site-header nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.site-header nav a {
    text-decoration: none;
    font-weight: 600;
    color: #ffffff;
    padding: 9px 14px;
    border-radius: 999px;
    font-size: 0.92rem;
}
.site-header nav a:hover { background: rgba(255,255,255,0.1); }
.site-header nav a.nav-cta { background: var(--yellow); color: var(--navy); }
.site-header nav a.nav-cta:hover { background: #ffe147; }

/* Hero */
.hero {
    background: var(--navy);
    color: #fff;
    padding: 48px 0 56px;
    text-align: center;
}
.hero-banner {
    display: inline-block;
    background: var(--yellow);
    color: var(--navy);
    font-weight: 800;
    padding: 8px 22px;
    border-radius: 999px;
    font-size: 0.95rem;
    margin-bottom: 22px;
}
.hero h1 { font-size: 2.1rem; margin: 0 0 10px; }
.hero p.tagline { color: #cdd6f2; font-size: 1.05rem; margin: 0 0 26px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* Buttons */
.btn {
    display: inline-block;
    background: var(--blue);
    color: #ffffff;
    border: none;
    padding: 13px 24px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.btn:hover { background: var(--blue-dark); }
.btn-block { width: 100%; }
.btn-yellow { background: var(--yellow); color: var(--navy); }
.btn-yellow:hover { background: #ffe147; }
.btn-secondary { background: #fff; color: var(--navy); border: 1px solid var(--border); }
.btn-secondary:hover { background: #f5f7fc; }
.btn-danger { background: var(--error); }
.btn-small { padding: 8px 14px; font-size: 0.85rem; }

/* Eco banner */
.eco-banner { background: #eafaf0; padding: 30px 0; border-top: 1px solid #d6f3e0; border-bottom: 1px solid #d6f3e0; }
.eco-banner-inner { display: flex; align-items: center; gap: 22px; }
.eco-icon {
    width: 52px; height: 52px; flex-shrink: 0; color: #ffffff; padding: 12px;
    background: var(--success); border-radius: 50%;
}
.eco-banner h2 { font-size: 1.25rem; margin: 0 0 2px; color: var(--navy); }
.eco-banner .eco-sub { font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; font-size: 0.82rem; color: var(--success); margin: 0 0 8px; }
.eco-banner p { margin: 0; color: #2f5a3f; font-size: 0.95rem; max-width: 760px; }
@media (max-width: 640px) { .eco-banner-inner { flex-direction: column; text-align: center; gap: 12px; } }

/* Sections */
main.container { padding-top: 32px; padding-bottom: 60px; min-height: 50vh; }
.section { padding: 44px 0; }
.section-soft { background: var(--bg-soft); }
.section-title { font-size: 1.6rem; font-weight: 800; margin: 0 0 28px; text-align: center; }
.page-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 24px; }

/* Flash */
.flash { padding: 14px 18px; border-radius: 10px; margin-bottom: 24px; font-weight: 600; }
.flash-success { background: var(--success-bg); color: var(--success); }
.flash-error { background: var(--error-bg); color: var(--error); }

/* Raised cards */
.card-raised {
    background: #ffffff;
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(16,28,70,0.06), 0 10px 24px rgba(16,28,70,0.10);
    border: 1px solid rgba(16,28,70,0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card-raised:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(16,28,70,0.09), 0 16px 32px rgba(16,28,70,0.15); }

/* Come funziona */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 22px; }
.step { text-align: center; padding: 6px; }
.step .num {
    width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 800; margin: 0 auto 12px;
}
.step h3 { font-size: 1rem; margin: 0 0 6px; }
.step p { color: var(--muted); font-size: 0.9rem; margin: 0; }

/* Category chips / grid */
.category-filters { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 30px; }
.category-filters a {
    text-decoration: none; color: var(--navy); background: #fff; border: 1px solid var(--border);
    padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 0.88rem;
}
.category-filters a.active, .category-filters a:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.category-card {
    display: flex; align-items: center; gap: 10px; padding: 14px 16px; text-decoration: none;
    background: var(--navy); color: #fff; border-radius: 12px; font-weight: 700; font-size: 0.9rem;
}
.category-card:hover { background: var(--blue); }
.category-card .icon { width: 30px; height: 30px; flex-shrink: 0; }
.category-card span { min-width: 0; overflow-wrap: break-word; word-break: break-word; hyphens: auto; }

/* City chips */
#vendi-nella-tua-citta .container { max-width: 900px; }
.city-region { margin-bottom: 22px; text-align: center; }
.city-region h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 10px; }
.city-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.city-chips a {
    text-decoration: none; color: var(--navy); background: var(--bg-soft); border: 1px solid transparent;
    padding: 6px 13px; border-radius: 999px; font-weight: 600; font-size: 0.85rem;
}
.city-chips a:hover { background: var(--navy); color: #fff; }

/* Product grid */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; }
.product-card { overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: var(--text); }
.product-card .thumb { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #f2f2f2; display: block; }
.product-card .info { padding: 16px; }
.product-card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.product-card .price { font-weight: 800; font-size: 1.15rem; }
.product-card .meta { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }
.badge {
    display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; padding: 3px 9px; border-radius: 999px; background: var(--navy); color: #fff;
}
.badge.badge-venduto { background: #999; }
.badge.badge-scaduto { background: #b3261e; }
.badge.badge-buy-now { background: var(--yellow); color: var(--navy); }

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

/* Product detail */
.product-detail { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; }
@media (max-width: 860px) { .product-detail { grid-template-columns: 1fr; } }

.gallery-main { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius); background: #f2f2f2; box-shadow: 0 1px 2px rgba(16,28,70,0.06), 0 10px 24px rgba(16,28,70,0.10); }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gallery-thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.gallery-thumbs img.active { border-color: var(--blue); }

.product-info h1 { font-size: 1.7rem; margin: 10px 0 6px; }
.price-block { padding: 20px; margin: 16px 0; }
.price-current { font-size: 2rem; font-weight: 800; }
.price-label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.price-sub { margin-top: 8px; color: var(--muted); font-size: 0.9rem; }
.description { white-space: pre-line; margin: 20px 0; }
.seller-box { padding: 16px 20px; margin: 16px 0; font-size: 0.92rem; }
.buy-now-box { padding: 20px; margin: 16px 0; background: #fffdf2; border: 1px solid #ffe9a8; }

.bid-history { margin-top: 24px; }
.bid-history table { width: 100%; border-collapse: collapse; }
.bid-history th, .bid-history td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }

/* Forms */
.form-panel { padding: 24px; margin-top: 16px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.9rem; }
.form-row input[type=text], .form-row input[type=email], .form-row input[type=tel],
.form-row input[type=number], .form-row input[type=password], .form-row input[type=date],
.form-row input[type=datetime-local], .form-row textarea, .form-row select {
    width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 1rem; font-family: inherit; background: #fff; color: var(--text);
}
.form-row textarea { resize: vertical; min-height: 100px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
@media (max-width: 700px) { .form-grid-3 { grid-template-columns: 1fr; } }
.form-hint { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.duration-choice { display: flex; gap: 12px; flex-wrap: wrap; }
.duration-choice label {
    flex: 1; min-width: 110px; border: 1px solid var(--border); border-radius: 10px; padding: 12px;
    text-align: center; cursor: pointer; font-weight: 700;
}
.duration-choice input { display: none; }
.duration-choice input:checked + span { color: var(--blue); }
.duration-choice label:has(input:checked) { border-color: var(--blue); background: #eef3ff; }

/* Auth pages */
.auth-page { max-width: 460px; margin: 40px auto; }

/* Account layout */
.account-shell { display: flex; min-height: 60vh; gap: 32px; }
.account-sidebar { width: 220px; flex-shrink: 0; }
.account-sidebar a { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.account-sidebar a.active, .account-sidebar a:hover { background: var(--bg-soft); }
.account-main { flex: 1; min-width: 0; }
@media (max-width: 780px) {
    .account-shell { flex-direction: column; gap: 16px; }
    .account-sidebar { width: 100%; display: flex; overflow-x: auto; gap: 6px; }
    .account-sidebar a { white-space: nowrap; margin-bottom: 0; }
}

/* Admin (reuses account-shell-like layout) */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; border-right: 1px solid var(--border); padding: 24px 16px; flex-shrink: 0; }
.admin-sidebar a { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; font-weight: 600; margin-bottom: 4px; color: var(--text); }
.admin-sidebar a.active, .admin-sidebar a:hover { background: var(--bg-soft); }
.admin-main { flex: 1; padding: 32px; }
@media (max-width: 780px) {
    .admin-shell { flex-direction: column; }
    .admin-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); display: flex; overflow-x: auto; padding: 12px; }
    .admin-sidebar a { margin-bottom: 0; white-space: nowrap; }
    .admin-main { padding: 20px; }
}
.admin-login { max-width: 380px; margin: 80px auto; }

table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th, table.data-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
table.data-table th { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.03em; }
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-top: 10px; }
.photo-grid .photo-item { position: relative; }
.photo-grid img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; }
.photo-grid .remove-photo { position: absolute; top: 4px; right: 4px; background: rgba(16,28,70,0.85); color: #fff; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-size: 0.8rem; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card { padding: 20px; }
.stat-card .num { font-size: 2rem; font-weight: 800; }
.stat-card .label { color: var(--muted); font-size: 0.85rem; }

/* Footer */
.site-footer { background: var(--navy); color: #cdd6f2; padding: 36px 0 28px; font-size: 0.88rem; }
.site-footer a { color: #cdd6f2; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer p { margin: 4px 0; }
.footer-grid { display: grid; grid-template-columns: 1.3fr 0.9fr 0.9fr 1.2fr; gap: 28px; }
@media (max-width: 780px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; gap: 20px; } }

/* Cookie banner */
.cookie-banner {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
    background: var(--navy); color: #cdd6f2; padding: 16px 0;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
}
.cookie-banner-inner {
    max-width: 1180px; margin: 0 auto; padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.cookie-banner-inner p { margin: 0; font-size: 0.88rem; }
.cookie-banner-inner a { color: #fff; text-decoration: underline; }
.cookie-banner-inner .btn { flex-shrink: 0; }
