/* =====================================================
   CONTAINER GENERALE
===================================================== */

.product-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 30px;
    background: var(--color-bg);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.product-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-top: 20px;
}


/* =====================================================
   IMMAGINE
===================================================== */

.product-image-box {
    flex: 0 0 380px;
    min-width: 280px;
}

.product-image-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.product-img-main {
    display: block;
    width: 100%;
    max-height: 420px;
    height: auto;
    object-fit: contain;
    object-position: center;
    background-color: var(--color-bg-soft-3);
    border: 1px solid var(--color-border);
    border-radius: 10px;
}


/* =====================================================
   DETTAGLI PRODOTTO
===================================================== */

.product-details {
    flex: 1;
    min-width: 280px;
}

.product-page-title {
    font-size: 26px;
    margin-bottom: 10px;
    color: var(--color-text);
}

.product-info-row {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.product-label {
    font-weight: 600;
    color: var(--color-text);
    margin-right: 4px;
}

.product-section-title {
    margin-top: 20px;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
}


/* =====================================================
   DESCRIZIONE TESTUALE
===================================================== */

.product-desc {
    font-size: 15px;
    color: var(--color-text-mid);
    line-height: 1.6;
    margin-top: 6px;
}


/* =====================================================
   BOX ACQUISTO
===================================================== */

.buy-box {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.buy-row {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 18px;
    flex-wrap: wrap;
}

.buy-availability {
    font-size: 13px;
    color: var(--color-text-mid);
}

.buy-prices {
    text-align: right;
    min-width: 160px;
}

.buy-price-ex {
    font-weight: 700;
    font-size: 16px;
    color: var(--color-primary-dark);
}

.buy-price-note {
    font-size: 12px;
    color: var(--color-text-soft);
    font-weight: 500;
}

.buy-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--color-border-dark);
    background: var(--color-bg);
    cursor: pointer;
    border-radius: 6px;
    line-height: 26px;
}

.qty-input {
    width: 56px;
    height: 28px;
    border: 1px solid var(--color-border-dark);
    text-align: center;
    padding-right: 0;
    border-radius: 6px;
}


/* =====================================================
   PULSANTE AGGIUNGI AL CARRELLO
===================================================== */

.cart-btn {
    height: 28px;
    padding: 0 14px;
    border: 1px solid var(--color-secondary-border);
    background: var(--color-secondary);
    font-weight: 700;
    cursor: pointer;
    border-radius: 6px;
    white-space: nowrap;
}

.cart-btn:hover {
    background: var(--color-secondary-dark);
}


/* =====================================================
   DESCRIZIONE A PIENA LARGHEZZA
===================================================== */

.product-description-full {
    margin-top: 40px;
}


/* =====================================================
   KIT SECTION
===================================================== */

.product-kit-section {
    margin-top: 36px;
}

.product-kit-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.product-kit-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    transition: background 0.2s ease;
    cursor: pointer;
}

.product-kit-row:hover {
    background: var(--color-bg-soft-2);
}

.product-kit-thumb {
    width: 72px;
    height: 72px;
    flex: 0 0 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-soft);
    border: 1px solid var(--color-border-soft);
    border-radius: 8px;
    overflow: hidden;
}

.product-kit-thumb img {
    max-width: 60px;
    max-height: 60px;
    object-fit: contain;
}

.product-kit-content {
    flex: 1;
}

.product-kit-title {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}

.product-kit-title:hover {
    color: var(--color-secondary-border);
}

.product-kit-title:visited,
.product-kit-title:active {
    color: var(--color-text);
    text-decoration: none;
}

.product-kit-sku {
    font-size: 12px;
    color: var(--color-text-soft);
    margin-top: 2px;
}

.product-kit-meta {
    font-size: 12px;
    color: var(--color-text-mid);
    margin-top: 4px;
    display: flex;
    gap: 12px;
}


/* =====================================================
   GALLERY AGGIUNTIVA
===================================================== */

.product-gallery-section {
    margin-top: 36px;
}

.product-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.product-gallery-item {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 140px;
    padding: 10px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
    cursor: zoom-in;
}

button.product-gallery-item {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
}

.product-gallery-item:hover {
    background: var(--color-bg-soft-2);
    border-color: var(--color-border-dark);
}

.product-gallery-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}


/* =====================================================
   DOCUMENTI / ALLEGATI
===================================================== */

.product-documents-section {
    margin-top: 36px;
}

.product-documents-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.product-document-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.product-document-item:hover {
    background: var(--color-bg-soft-2);
    border-color: var(--color-border-dark);
}

.product-document-icon {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-soft);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-mid);
    text-transform: uppercase;
}

.product-document-content {
    flex: 1;
    min-width: 0;
}

.product-document-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.4;
    word-break: break-word;
}

.product-document-filename {
    margin-top: 3px;
    font-size: 12px;
    color: var(--color-text-soft);
    word-break: break-all;
}


/* =====================================================
   LIGHTBOX PRODOTTO
===================================================== */

body.lightbox-open {
    overflow: hidden;
}

.product-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
}

.product-lightbox.is-open {
    display: block;
}

.product-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
}

.product-lightbox-dialog {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
}

.product-lightbox-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 90px 30px;
    box-sizing: border-box;
}

.product-lightbox-content img {
    max-width: 96vw;
    max-height: 82vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.product-lightbox-caption {
    margin-top: 14px;
    font-size: 14px;
    color: var(--color-bg-soft);
    line-height: 1.5;
    text-align: center;
}

.product-lightbox-counter {
    margin-top: 6px;
    font-size: 12px;
    color: var(--color-border-dark);
    text-align: center;
}

.product-lightbox-close {
    position: absolute;
    top: 18px;
    right: 22px;
    z-index: 3;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: var(--color-text-inverse);
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-lightbox-close:hover {
    background: rgba(255,255,255,0.22);
}

.product-lightbox-nav {
    position: absolute;
    top: 50%;
    z-index: 3;
    transform: translateY(-50%);
    width: 54px;
    height: 54px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: var(--color-text-inverse);
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-lightbox-nav:hover {
    background: rgba(255,255,255,0.22);
}

.product-lightbox-prev {
    left: 18px;
}

.product-lightbox-next {
    right: 18px;
}


/* =====================================================
   HTML ERP (titoli + tabelle tecniche)
===================================================== */

.product-desc h1,
.product-desc h2,
.product-desc h3 {
    color: var(--color-text);
    line-height: 1.25;
    margin: 16px 0 10px;
}

.product-desc h2 { font-size: 18px; }
.product-desc h3 { font-size: 16px; }

.product-desc table {
    width: 100%;
    margin: 14px 0 18px;
    font-size: 14px;
}


/* ===== VERSIONE PROFESSIONALE SCHEDA TECNICA ===== */

.product-desc table.generale {
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.product-desc table.generale th,
.product-desc table.generale td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--color-border);
    word-break: break-word;
}

.product-desc table.generale th {
    background: var(--color-bg-soft);
    font-weight: 700;
    color: var(--color-text);
    text-align: left;
}

.product-desc table.generale tr:nth-child(even) td {
    background: var(--color-bg-soft-3);
}

.product-desc table.generale td:first-child {
    width: 38%;
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-bg-soft-2);
}

.product-desc table.generale td:last-child {
    width: 62%;
    overflow-wrap: anywhere;
}

.product-desc table.generale tr:last-child td {
    border-bottom: none;
}

/* =====================================================
   ATTRIBUTES
===================================================== */
.product-attribute-select {
    min-width: 240px;
    max-width: 320px;
    height: 36px;
    padding: 4px 28px 4px 10px;
    margin-left: 10px;

    border: 1px solid var(--color-border-dark);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 13px;

    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.product-attribute-select:hover {
    border-color: var(--color-primary-light);
}

.product-attribute-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(39,114,164,0.15);
}

.product-attribute-group {
    margin-bottom: 6px;
}


/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 768px) {
    .product-container {
        padding: 18px;
        margin: 20px auto;
    }

    .product-image-box,
    .product-details {
        min-width: 100%;
    }

    .buy-box {
        align-items: stretch;
    }

    .buy-row {
        justify-content: flex-start;
        align-items: stretch;
    }

    .buy-prices {
        text-align: left;
        min-width: 0;
    }

    .product-kit-row,
    .product-document-item {
        align-items: flex-start;
    }

    .product-gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .product-lightbox-content {
        padding: 24px 16px 20px;
    }

    .product-lightbox-content img {
        max-width: 94vw;
        max-height: 75vh;
    }

    .product-lightbox-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        font-size: 26px;
    }

    .product-lightbox-nav {
        width: 42px;
        height: 42px;
        font-size: 28px;
    }

    .product-lightbox-prev {
        left: 8px;
    }

    .product-lightbox-next {
        right: 8px;
    }
}