/* ============================================================
   ioColleziono.it — Stylesheet (restyling Lotto C)
   Identità "catalogo del collezionista": inchiostro + ottone + pergamena.
   Mantiene TUTTI i nomi di classe esistenti (retrocompatibile).
   ============================================================ */

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

:root {
    /* Palette collezionista */
    --ink:            #1b2430;   /* inchiostro blu-carbone: struttura */
    --ink-2:          #232f3e;
    --brass:          #b0894f;   /* ottone/oro: accento e CTA */
    --brass-dark:     #916f3a;
    --brass-soft:     #ece2cf;
    --parchment:      #f5f1e8;   /* fondo pergamena */
    --parchment-2:    #efe9db;
    --burgundy:       #9c3b3b;   /* saldi / errori */
    --sage:           #4a7c59;   /* successo / disponibile */

    /* Alias retrocompatibili (usati inline nelle altre pagine) */
    --primary-color:   var(--ink);
    --secondary-color: var(--brass);
    --accent-color:    var(--burgundy);
    --success-color:   var(--sage);
    --warning-color:   #c98a2b;
    --text-color:      #2a2f36;
    --light-gray:      var(--parchment);
    --border-color:    #e6ddcc;
    --white:           #ffffff;
    --muted:           #6f6a5f;

    --shadow:     0 8px 30px rgba(27, 36, 48, 0.08);
    --shadow-sm:  0 2px 10px rgba(27, 36, 48, 0.06);
    --transition: all 0.25s ease;

    --serif: 'Fraunces', 'Georgia', 'Times New Roman', serif;
    --sans:  'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--sans);
    line-height: 1.65;
    color: var(--text-color);
    font-size: 16px;
    background:
        radial-gradient(1200px 600px at 100% -10%, #fbf8f1 0, transparent 60%),
        var(--parchment);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; color: var(--ink); letter-spacing: -0.01em; }
a { color: var(--brass-dark); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 18px; }

/* Etichetta "eyebrow" da catalogo */
.eyebrow {
    font-family: var(--sans);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--brass-dark);
}

/* Titoli di sezione con filetto d'ottone */
.section-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem; }
.section-head h2 { font-size: 1.9rem; }
.section-head .rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--brass) 0, transparent 100%); opacity: .5; }

/* ---------- Header ---------- */
.header {
    background: var(--ink);
    color: #fff;
    padding: 0.9rem 0;
    position: sticky; top: 0; z-index: 1000;
    border-bottom: 2px solid var(--brass);
    box-shadow: var(--shadow-sm);
}
.header-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.logo {
    font-family: var(--serif);
    font-size: 1.6rem; font-weight: 700; color: #fff; text-decoration: none; letter-spacing: -0.01em;
}
.logo span { color: var(--brass); }
.nav-toggle { display: block; background: none; border: none; color: #fff; font-size: 1.6rem; cursor: pointer; line-height: 1; }

.main-nav { display: none; width: 100%; margin-top: 0.75rem; }
.main-nav.active { display: block; }
.main-nav ul { list-style: none; display: flex; flex-direction: column; gap: 0.25rem; }
.main-nav a {
    color: #e8e3d9; text-decoration: none; padding: 0.55rem 0.7rem; display: block;
    border-radius: 8px; font-weight: 500; transition: var(--transition);
}
.main-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }

.header-actions { display: flex; gap: 1.1rem; align-items: center; }
.header-icon { position: relative; color: #f0ebe1; font-size: 1.25rem; text-decoration: none; display: inline-flex; transition: var(--transition); }
.header-icon:hover { color: var(--brass); }
.cart-icon { position: relative; color: #f0ebe1; font-size: 1.25rem; text-decoration: none; }
.cart-icon:hover { color: var(--brass); }
.cart-count, .wish-count {
    position: absolute; top: -9px; right: -11px;
    background: var(--brass); color: var(--ink); font-weight: 700;
    border-radius: 999px; min-width: 19px; height: 19px; padding: 0 4px;
    display: flex; align-items: center; justify-content: center; font-size: 0.68rem;
}
.wish-count { background: var(--burgundy); color: #fff; }

/* ---------- Hero ---------- */
.hero {
    background:
        linear-gradient(180deg, rgba(27,36,48,.92), rgba(27,36,48,.96)),
        radial-gradient(700px 300px at 15% 0%, rgba(176,137,79,.28), transparent 70%);
    color: #f3efe6; padding: 4rem 0 3.5rem; text-align: center;
    border-bottom: 1px solid rgba(176,137,79,.35);
}
.hero .eyebrow { color: var(--brass); }
.hero h1 { font-size: 2.3rem; color: #fff; margin: 0.6rem 0 0.8rem; }
.hero p { font-size: 1.1rem; opacity: 0.85; max-width: 620px; margin: 0 auto; }

/* ---------- Search ---------- */
.search-bar { background: transparent; padding: 1.6rem 0; margin-top: -1.4rem; }
.search-form {
    display: flex; gap: 0; max-width: 620px; margin: 0 auto;
    background: #fff; border: 1px solid var(--border-color); border-radius: 999px;
    box-shadow: var(--shadow); overflow: hidden;
}
.search-form input { flex: 1; padding: 0.9rem 1.3rem; border: none; font-size: 1rem; background: transparent; }
.search-form input:focus { outline: none; }
.search-form button {
    padding: 0.9rem 1.8rem; background: var(--brass); color: var(--ink); border: none;
    cursor: pointer; font-weight: 600; transition: var(--transition);
}
.search-form button:hover { background: var(--brass-dark); color: #fff; }

/* ---------- Categorie ---------- */
.categories { padding: 2.6rem 0 1rem; }
.categories h2 { margin-bottom: 1.4rem; font-size: 1.9rem; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
.category-card {
    background: #fff; padding: 1.4rem 1rem; text-align: center; border-radius: var(--radius);
    text-decoration: none; color: var(--text-color); border: 1px solid var(--border-color);
    transition: var(--transition);
}
.category-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brass-soft); }
.category-card h3 { font-size: 1rem; margin-top: 0.6rem; }

/* ---------- Prodotti / card ---------- */
.products { padding: 2.6rem 0; }
.products h2 { margin-bottom: 1.4rem; font-size: 1.9rem; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.5rem; }

.product-card {
    position: relative; background: #fff; border: 1px solid var(--border-color);
    border-radius: var(--radius); overflow: hidden; transition: var(--transition);
    display: flex; flex-direction: column;
}
.product-card:hover { box-shadow: var(--shadow); transform: translateY(-4px); border-color: var(--brass-soft); }

.product-media { position: relative; display: block; background: var(--parchment-2); }
.product-image { width: 100%; height: 240px; object-fit: cover; display: block; background: var(--parchment-2); }

.product-info { padding: 1rem 1.1rem 1.2rem; flex: 1; display: flex; flex-direction: column; }
.product-eyebrow { font-size: 0.68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.35rem; }
.product-title { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--ink); text-decoration: none; }
.product-title:hover { color: var(--brass-dark); }
.product-description { font-size: 0.9rem; color: var(--muted); margin-bottom: 1rem; flex: 1; }

.product-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; gap: .5rem; }
.product-price { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; color: var(--ink); }
.product-price small { font-family: var(--sans); font-size: .68rem; color: var(--muted); font-weight: 500; display: block; margin-top: -2px; }
.compare-price { font-size: 0.9rem; color: #a49a89; text-decoration: line-through; margin-left: 0.45rem; }

/* Chip grado di conservazione */
.grade-chip {
    display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: .06em;
    padding: 0.18rem 0.5rem; border-radius: 6px; text-transform: uppercase;
    background: var(--brass-soft); color: var(--brass-dark); border: 1px solid #e0d2b6;
}

/* Riga stock (punto 9) */
.stock-line { font-size: 0.82rem; font-weight: 600; display: inline-flex; align-items: center; gap: .4rem; }
.stock-line::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.stock-ok  { color: var(--sage); }
.stock-low { color: var(--warning-color); }
.stock-out { color: var(--burgundy); }

/* Bottone preferiti (punto 8) */
.wish-btn {
    position: absolute; top: 10px; right: 10px; z-index: 2;
    width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
    background: rgba(255,255,255,.92); box-shadow: var(--shadow-sm);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.15rem; line-height: 1; color: var(--muted); transition: var(--transition);
}
.wish-btn:hover { transform: scale(1.08); color: var(--burgundy); }
.wish-btn.is-active { color: var(--burgundy); background: #fff; }
.wish-btn .heart-o { display: inline; }
.wish-btn .heart-f { display: none; }
.wish-btn.is-active .heart-o { display: none; }
.wish-btn.is-active .heart-f { display: inline; }

/* Variante "inline" del bottone preferiti (scheda prodotto) */
.wish-btn-inline { display: inline-flex; align-items: center; gap: .45rem; }
.wish-btn-inline .heart-o { display: inline; }
.wish-btn-inline .heart-f { display: none; }
.wish-btn-inline.is-active { color: var(--burgundy); border-color: var(--burgundy); background: #fff; }
.wish-btn-inline.is-active .heart-o { display: none; }
.wish-btn-inline.is-active .heart-f { display: inline; }

/* ---------- Buttons ---------- */
.btn {
    padding: 0.75rem 1.5rem; border: none; border-radius: 8px; cursor: pointer;
    font-family: var(--sans); font-size: 1rem; font-weight: 600; transition: var(--transition);
    text-decoration: none; display: inline-block; text-align: center;
}
.btn-primary { background: var(--brass); color: var(--ink); }
.btn-primary:hover { background: var(--brass-dark); color: #fff; }
.btn-success { background: var(--sage); color: #fff; }
.btn-success:hover { background: #3c6749; }
.btn-danger { background: var(--burgundy); color: #fff; }
.btn-danger:hover { background: #7f2f2f; }
.btn-outline { background: transparent; border: 1.5px solid var(--brass); color: var(--brass-dark); }
.btn-outline:hover { background: var(--brass); color: var(--ink); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--ink-2); }
.btn-small { padding: 0.5rem 1rem; font-size: 0.9rem; }
.btn-block { width: 100%; }

/* ---------- Product Detail (scheda, punto 5) ---------- */
.pd { padding: 2.2rem 0 1rem; }
.pd-grid { display: grid; grid-template-columns: 1fr; gap: 2.5rem; }
.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 1.1rem; }
.breadcrumb a { color: var(--brass-dark); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

.gallery { position: relative; }
.gallery-main {
    width: 100%; aspect-ratio: 1/1; object-fit: contain; border-radius: var(--radius);
    background: #fff; border: 1px solid var(--border-color); padding: 1rem;
}
.thumbs { display: flex; gap: 0.6rem; overflow-x: auto; margin-top: 0.8rem; padding-bottom: 4px; }
.thumb {
    width: 74px; height: 74px; object-fit: cover; border-radius: 8px; cursor: pointer;
    border: 2px solid transparent; background: var(--parchment-2); flex: 0 0 auto; transition: var(--transition);
}
.thumb.active, .thumb:hover { border-color: var(--brass); }

.pd-title { font-size: 2rem; margin-bottom: 0.5rem; }
.pd-meta { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 1.1rem; }

.buybox {
    background: #fff; border: 1px solid var(--border-color); border-left: 3px solid var(--brass);
    padding: 1.4rem 1.5rem; border-radius: var(--radius); margin-bottom: 1.6rem; box-shadow: var(--shadow-sm);
}
.buybox .price { font-family: var(--serif); font-size: 2.1rem; font-weight: 600; color: var(--ink); }
.buybox .price small { font-family: var(--sans); font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.buybox .free-ship-hint { font-size: 0.85rem; color: var(--brass-dark); margin: 0.5rem 0 0; }

.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
.qty-stepper button { width: 40px; height: 44px; border: none; background: var(--parchment); font-size: 1.2rem; cursor: pointer; color: var(--ink); }
.qty-stepper button:hover { background: var(--parchment-2); }
.qty-stepper input { width: 54px; height: 44px; text-align: center; border: none; border-left: 1px solid var(--border-color); border-right: 1px solid var(--border-color); font-size: 1rem; }

.spec-table { width: 100%; border-collapse: collapse; }
.spec-table td { padding: 0.6rem 0; border-bottom: 1px solid var(--border-color); }
.spec-table td:first-child { font-weight: 600; color: var(--ink); width: 40%; }
.spec-table tr:last-child td { border-bottom: none; }

.pd-section-title { font-size: 1.3rem; margin: 1.8rem 0 0.7rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border-color); }

.similar-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }

/* ---------- Cart ---------- */
.cart-page { padding: 2rem 0; min-height: 60vh; }
.cart-items { margin-bottom: 2rem; }
.cart-item { display: flex; gap: 1rem; padding: 1rem; border: 1px solid var(--border-color); border-radius: var(--radius); margin-bottom: 1rem; align-items: center; background: #fff; }
.cart-item-image { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; background: var(--parchment-2); }
.cart-item-info { flex: 1; }
.cart-item-title { font-family: var(--serif); font-weight: 600; margin-bottom: 0.25rem; }
.cart-item-variant { font-size: 0.9rem; color: var(--muted); }
.cart-item-quantity { display: flex; align-items: center; gap: 0.5rem; }
.quantity-btn { background: var(--parchment); border: none; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; font-size: 1.1rem; }
.quantity-input { width: 52px; text-align: center; padding: 0.25rem; border: 1px solid var(--border-color); border-radius: 6px; }
.cart-item-price { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; }
.cart-summary { background: #fff; border: 1px solid var(--border-color); padding: 1.5rem; border-radius: var(--radius); position: sticky; top: 90px; box-shadow: var(--shadow-sm); }
.cart-summary-row { display: flex; justify-content: space-between; margin-bottom: 0.75rem; }
.cart-summary-total { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; border-top: 2px solid var(--border-color); padding-top: 0.75rem; margin-top: 0.75rem; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.4rem; }
.form-group label { display: block; margin-bottom: 0.45rem; font-weight: 600; color: var(--ink); }
.form-control { width: 100%; padding: 0.75rem 0.85rem; border: 1px solid var(--border-color); border-radius: 8px; font-size: 1rem; font-family: var(--sans); background: #fff; transition: var(--transition); }
.form-control:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(176,137,79,.15); }
textarea.form-control { min-height: 120px; resize: vertical; }
.form-error { color: var(--burgundy); font-size: 0.9rem; margin-top: 0.25rem; }

/* ---------- Alerts ---------- */
.alert { padding: 0.95rem 1.1rem; border-radius: 8px; margin-bottom: 1rem; border-left: 3px solid transparent; }
.alert-success { background: #eaf3ec; color: #2f5137; border-left-color: var(--sage); }
.alert-error { background: #f6e9e9; color: #6f2626; border-left-color: var(--burgundy); }
.alert-info { background: var(--brass-soft); color: var(--brass-dark); border-left-color: var(--brass); }

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: #e8e3d9; padding: 3rem 0 1.4rem; margin-top: 3.5rem; border-top: 2px solid var(--brass); }
.footer-content { display: grid; grid-template-columns: 1fr; gap: 2rem; margin-bottom: 1.4rem; }
.footer-section h3 { font-family: var(--serif); margin-bottom: 1rem; color: #fff; font-size: 1.15rem; }
.footer-section p { opacity: 0.75; }
.footer-section ul { list-style: none; }
.footer-section li { margin-bottom: 0.4rem; }
.footer-section a { color: #d9d3c6; text-decoration: none; opacity: 0.85; transition: var(--transition); }
.footer-section a:hover { opacity: 1; color: var(--brass); }
.footer-bottom { text-align: center; padding-top: 1.2rem; border-top: 1px solid rgba(255,255,255,0.1); opacity: 0.7; font-size: 0.9rem; }

/* ---------- Loading ---------- */
.loading { display: inline-block; width: 40px; height: 40px; border: 4px solid var(--parchment-2); border-top-color: var(--brass); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Badge ---------- */
.badge { display: inline-block; padding: 0.25rem 0.7rem; border-radius: 999px; font-size: 0.82rem; font-weight: 600; text-decoration: none; }
.badge-success { background: var(--sage); color: #fff; }
.badge-warning { background: var(--warning-color); color: #fff; }
.badge-danger { background: var(--burgundy); color: #fff; }
.badge-info { background: var(--brass-soft); color: var(--brass-dark); }

/* ---------- Responsive ---------- */
@media (min-width: 768px) {
    .nav-toggle { display: none; }
    .main-nav { display: block; width: auto; margin-top: 0; }
    .main-nav ul { flex-direction: row; }
    .hero h1 { font-size: 3.2rem; }
    .cart-item { flex-direction: row; }
    .cart-item-image { width: 110px; height: 110px; }
    .footer-content { grid-template-columns: 2fr 1fr 1fr; }
    .pd-grid { grid-template-columns: 1.05fr 1fr; }
    .similar-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
    .product-grid { grid-template-columns: repeat(4, 1fr); }
    .category-grid { grid-template-columns: repeat(6, 1fr); }
}

/* ---------- Admin (rinfrescato, invariato strutturalmente) ---------- */
.admin-header { background: var(--ink-2); }
.admin-sidebar { background: var(--ink); min-height: calc(100vh - 60px); padding: 1rem; }
.admin-sidebar ul { list-style: none; }
.admin-sidebar a { color: #e8e3d9; text-decoration: none; padding: 0.75rem; display: block; margin-bottom: 0.4rem; border-radius: 8px; transition: var(--transition); }
.admin-sidebar a:hover, .admin-sidebar a.active { background: rgba(176,137,79,.18); color: #fff; }
.admin-content { padding: 2rem; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; box-shadow: var(--shadow-sm); border-radius: var(--radius); overflow: hidden; }
.data-table th { background: var(--ink); color: #fff; padding: 0.9rem 1rem; text-align: left; font-family: var(--sans); font-weight: 600; }
.data-table td { padding: 0.9rem 1rem; border-bottom: 1px solid var(--border-color); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: var(--parchment); }

/* Accessibilità */
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
