/* ============================================================
   Vetrina pubblica — Catalogo Macchine Usate
   Tema: tecnico / industriale, dark
   Font self-hosted in assets/fonts/ (Barlow, Barlow Condensed, Space Mono)
   ============================================================ */

/* --- Font self-hosted (scarica da Google Fonts e metti in assets/fonts/) --- */
@font-face {
    font-family: 'Barlow Condensed';
    src: url('../fonts/BarlowCondensed-Regular.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Barlow Condensed';
    src: url('../fonts/BarlowCondensed-SemiBold.woff2') format('woff2');
    font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Barlow Condensed';
    src: url('../fonts/BarlowCondensed-Bold.woff2') format('woff2');
    font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Barlow';
    src: url('../fonts/Barlow-Regular.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Barlow';
    src: url('../fonts/Barlow-Medium.woff2') format('woff2');
    font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Space Mono';
    src: url('../fonts/SpaceMono-Regular.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}

/* --- Variabili --- */
:root {
    --bg:          #0f0f0f;
    --surface:     #1a1a1a;
    --surface-2:   #222222;
    --border:      #2e2e2e;
    --accent:      #e8b84b;
    --accent-h:    #d4a438;
    --text:        #d4d4d4;
    --text-muted:  #7a7a7a;
    --text-dim:    #555555;
    --font-head:   'Barlow Condensed', 'Arial Narrow', sans-serif;
    --font-body:   'Barlow', system-ui, sans-serif;
    --font-mono:   'Space Mono', 'Courier New', monospace;
    --radius:      4px;
    --radius-lg:   8px;

    /* Toner */
    --toner-k: #555555;
    --toner-c: #00aeef;
    --toner-m: #ec008c;
    --toner-y: #ccbb00;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); }

/* --- Contenitore --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============================================================
   HEADER / NAV
============================================================ */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.site-logo {
    font-family: var(--font-head);
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.site-logo span { color: var(--accent); }

.site-nav a {
    color: var(--text-muted);
    font-family: var(--font-head);
    font-size: 14px;
    letter-spacing: .5px;
    text-transform: uppercase;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: color .2s, border-color .2s;
}

.site-nav a:hover {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* ============================================================
   HERO / INTRO (homepage)
============================================================ */
.catalog-intro {
    padding: 40px 0 28px;
    border-bottom: 1px solid var(--border);
}

.catalog-intro h1 {
    font-family: var(--font-head);
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text);
    line-height: 1.1;
}

.catalog-intro h1 em {
    color: var(--accent);
    font-style: normal;
}

.catalog-intro p {
    color: var(--text-muted);
    margin-top: 10px;
    max-width: 560px;
}

/* ============================================================
   LAYOUT CATALOGO (filtri + griglia)
============================================================ */
.catalog-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 32px;
    padding: 32px 0 60px;
    align-items: start;
}

/* --- Sidebar filtri --- */
.filters-sidebar {
    position: sticky;
    top: 80px;
}

.filters-sidebar h2 {
    font-family: var(--font-head);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    margin-bottom: 16px;
}

.filter-group {
    margin-bottom: 28px;
}

.filter-group-title {
    font-family: var(--font-head);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    transition: color .15s;
}

.filter-group label:hover { color: var(--text); }

.filter-group input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
}

.filter-group input[type="checkbox"]:checked + span { color: var(--text); }

.filter-select {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-body);
    cursor: pointer;
}

.filter-select:focus { outline: none; border-color: var(--accent); }

.filters-apply-btn {
    width: 100%;
    padding: 9px;
    background: var(--accent);
    color: #0f0f0f;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    cursor: pointer;
    margin-top: 8px;
    transition: background .15s;
}

.filters-apply-btn:hover { background: var(--accent-h); }

.filters-reset {
    display: block;
    text-align: center;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-dim);
}

.filters-reset:hover { color: var(--text-muted); }

/* --- Griglia prodotti --- */
.products-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.products-count {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* --- Card prodotto --- */
.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color .2s, transform .2s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.product-card-image {
    position: relative;
    aspect-ratio: 4/3;
    background: var(--surface-2);
    overflow: hidden;
}

.product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s;
}

.product-card:hover .product-card-image img { transform: scale(1.03); }

.product-card-image .placeholder-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 40px;
}

/* Badge sovrapposto all'immagine */
.card-badge-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-family: var(--font-head);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
}

.badge-usato       { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.badge-non-disp    { background: #3a1a1a; border: 1px solid #7a2020; color: #ff6b6b; }
.badge-in-noleggio { background: #2a2200; border: 1px solid #6a5500; color: var(--accent); }

.product-card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card-categoria {
    font-family: var(--font-head);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.product-card-title {
    font-family: var(--font-head);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 12px;
}

.product-card-price {
    font-family: var(--font-mono);
    font-size: 18px;
    color: var(--accent);
    margin-top: auto;
    margin-bottom: 14px;
}

.product-card-price.su-richiesta {
    font-family: var(--font-head);
    font-size: 14px;
    color: var(--text-muted);
    font-weight: normal;
}

.product-card-cta {
    display: block;
    text-align: center;
    padding: 9px;
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: var(--accent);
    font-family: var(--font-head);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    transition: background .15s, color .15s;
}

.product-card-cta:hover {
    background: var(--accent);
    color: #0f0f0f;
}

/* Stato non disponibile: card leggermente opacizzata */
.product-card.non-disponibile { opacity: .75; }
.product-card.non-disponibile:hover { opacity: 1; }

/* --- Nessun risultato --- */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results p { font-size: 14px; margin-top: 8px; }

/* --- Paginazione --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 40px;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
    background: var(--surface);
    transition: border-color .15s, color .15s;
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination span.current { background: var(--accent); border-color: var(--accent); color: #0f0f0f; }
.pagination span.dots { border-color: transparent; background: transparent; }

/* ============================================================
   SCHEDA PRODOTTO
============================================================ */
.product-page {
    padding: 40px 0 80px;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 28px;
}

.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span { margin: 0 6px; }

/* Layout scheda */
.product-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 48px;
    align-items: start;
}

/* --- Galleria --- */
.gallery-main {
    aspect-ratio: 4/3;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 12px;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity .2s;
}

.gallery-thumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.gallery-thumb {
    width: 72px;
    height: 56px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: border-color .15s;
    background: var(--surface);
}

.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumb:hover, .gallery-thumb.active { border-color: var(--accent); }

/* --- Info prodotto (colonna destra) --- */
.product-info { position: sticky; top: 80px; }

.product-categoria {
    font-family: var(--font-head);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.product-title {
    font-family: var(--font-head);
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    line-height: 1.1;
    color: var(--text);
    margin-bottom: 16px;
}

.product-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* Stato non disponibile */
.stato-banner {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.stato-banner.non-disponibile { border-left-color: #7a2020; }

.product-price {
    font-family: var(--font-mono);
    font-size: 28px;
    color: var(--accent);
    margin-bottom: 24px;
}

.product-price.su-richiesta {
    font-family: var(--font-head);
    font-size: 18px;
    color: var(--text-muted);
    font-weight: 400;
}

.product-condizione {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 24px;
}

/* Descrizione */
.product-description {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 28px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

/* --- Sezioni scheda (specs, toner, pdf) --- */
.product-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.product-section-title {
    font-family: var(--font-head);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 16px;
}

/* Tabella specifiche */
.specs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.specs-table tr { border-bottom: 1px solid var(--border); }
.specs-table tr:last-child { border-bottom: none; }

.specs-table td {
    padding: 10px 0;
    vertical-align: top;
}

.specs-table td:first-child {
    color: var(--text-dim);
    width: 45%;
    font-family: var(--font-head);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding-right: 16px;
}

.specs-table td:last-child { color: var(--text); }

/* Contatori */
.counters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.counter-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}

.counter-label {
    font-family: var(--font-head);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.counter-value {
    font-family: var(--font-mono);
    font-size: 22px;
    color: var(--text);
}

.counter-unit {
    font-size: 12px;
    color: var(--text-dim);
    margin-left: 4px;
}

/* Barre toner */
.toner-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.toner-row { display: flex; flex-direction: column; gap: 5px; }

.toner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toner-label {
    font-family: var(--font-head);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-dim);
}

.toner-pct {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
}

.toner-track {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.toner-fill {
    height: 100%;
    border-radius: 3px;
    transition: width .5s ease;
}

.note-consumabili {
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
}

/* PDF allegati */
.pdf-list { display: flex; flex-direction: column; gap: 8px; }

.pdf-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    transition: border-color .15s;
}

.pdf-item:hover { border-color: var(--accent); color: var(--text); }

.pdf-icon {
    font-size: 20px;
    color: var(--text-dim);
    flex-shrink: 0;
}

.pdf-label { flex: 1; font-size: 14px; }

.pdf-download {
    font-family: var(--font-head);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--accent);
}

/* ============================================================
   FORM CONTATTI / DISPONIBILITÀ
============================================================ */
.contact-section {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

.contact-section h2 {
    font-family: var(--font-head);
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px;
}

.contact-section .contact-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-family: var(--font-head);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-body);
    transition: border-color .15s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group textarea { resize: vertical; min-height: 100px; }

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Honeypot — campo invisibile anti-spam */
.hp-field {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
    tab-index: -1;
}

.form-submit-btn {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #0f0f0f;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-head);
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    margin-top: 8px;
    transition: background .15s;
}

.form-submit-btn:hover { background: var(--accent-h); }

.form-privacy {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 10px;
    text-align: center;
}

/* --- Mini-form disponibilità --- */
.availability-form {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.availability-form h3 {
    font-family: var(--font-head);
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.availability-form p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.6;
}

/* ============================================================
   PAGINA CONFERMA
============================================================ */
.confirm-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.confirm-box {
    text-align: center;
    max-width: 480px;
}

.confirm-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.confirm-box h1 {
    font-family: var(--font-head);
    font-size: 32px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
}

.confirm-box p {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 28px;
}

.btn-back {
    display: inline-block;
    padding: 10px 24px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: var(--accent);
    font-family: var(--font-head);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .5px;
    transition: background .15s, color .15s;
}

.btn-back:hover {
    background: var(--accent);
    color: #0f0f0f;
}

/* ============================================================
   FOOTER
============================================================ */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 28px 0;
    margin-top: 40px;
}

.site-footer .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-dim);
}

/* ============================================================
   RESPONSIVE — tablet
============================================================ */
@media (max-width: 1024px) {
    .catalog-layout { grid-template-columns: 180px 1fr; gap: 24px; }
    .products-grid { grid-template-columns: repeat(2, 1fr); }
    .product-layout { grid-template-columns: 1fr; }
    .product-info { position: static; }
}

/* ============================================================
   RESPONSIVE — mobile
============================================================ */
@media (max-width: 680px) {
    .catalog-layout { grid-template-columns: 1fr; }

    .filters-sidebar {
        position: static;
        display: none; /* Attivabile con JS tramite toggle */
    }

    .filters-sidebar.open { display: block; }

    .filters-toggle-btn {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 9px 14px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        color: var(--text-muted);
        font-family: var(--font-head);
        font-size: 13px;
        text-transform: uppercase;
        cursor: pointer;
        margin-bottom: 16px;
    }

    .products-grid { grid-template-columns: 1fr; }

    .counters-grid { grid-template-columns: 1fr; }
    .toner-grid { grid-template-columns: 1fr; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .site-footer .container { flex-direction: column; gap: 8px; text-align: center; }
}
