/* Modern Prodotto CSS */

:root {
    --primary-color: #13499a;
    --primary-hover: #254a70;
    --accent-color: #FF9933;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-color: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --radius: 12px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --input-padding: 12px 16px;
    --success-color: #28a745;
    --danger-color: #dc3545;
}

/* =========================================
   Container & Layout
   ========================================= */

.modern-product-wrapper {
    margin: 0 auto;
    font-family: 'Segoe UI', 'Montserrat', sans-serif;
    color: var(--text-color);
    max-width: 1500px;
    width: 100%;
    box-sizing: border-box;
}

.modern-product-wrapper *,
.modern-product-wrapper *:before,
.modern-product-wrapper *:after {
    box-sizing: border-box;
    border-radius: 15px;
}

.product-grid {
    display: grid;
    /* Gallery | Details | BuyBox - FLUID PERCENTAGES */
    grid-template-columns: 35% minmax(0, 1fr) 25%;
    gap: 30px;
    margin-bottom: 40px;
    align-items: start;
    /* Important for sticky behavior */
}

@media (max-width: 1200px) {
    .product-grid {
        grid-template-columns: 300px minmax(0, 1fr) 280px;
        gap: 20px;
    }
}

@media (max-width: 992px) {
    .product-grid {
        grid-template-columns: 1fr;
        /* Stack everything on mobile/tablet */
        gap: 20px;
    }

    /* Force Reorder for mobile:
       1. Gallery (Image)
       2. BuyBox (Price)
       3. Details (Description)
    */
    .col-gallery {
        order: 1;
    }

    .col-buybox {
        order: 2;
        position: static;
        /* Unstick on mobile */
        margin-bottom: 20px;
    }

    .col-details {
        order: 3;
    }
}

/* =========================================
   Left Column: Gallery & Carousel
   ========================================= */

.product-gallery {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 500px;
}

.main-image-wrapper {
    margin-bottom: 20px;
    text-align: center;
    width: 100%;
    position: relative;
    /* Context for absolute buttons */
}

.product-gallery img.main-product-img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius);
    max-height: 500px;
    max-height: 500px;
    /* Limit height */
}

/* Fix for ASPX inline fixed dimensions */
#ctl00_ContentPlaceHolder1_imgprodotto {
    width: 100% !important;
    height: auto !important;
    max-width: 100%;
}


/* Carousel Navigation Buttons */
.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.3);
    color: white;
    border: none;
    font-size: 24px;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.3s;
    user-select: none;
    z-index: 10;
}

.carousel-nav-btn:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.prev-btn {
    left: 10px;
}

.next-btn {
    right: 10px;
}

/* Thumbnails */
.thumbnails-gallery ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.thumbnails-gallery li {
    display: inline-block;
}

.thumb-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border: 2px solid transparent;
    /* Prepare for active state */
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.thumb-img:hover {
    border-color: #ccc;
}

.thumb-img.active-thumb {
    border-color: var(--primary-color);
}

/* =========================================
   Right Column: Info & Actions
   ========================================= */

.product-main-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.product-header-modern h1 {
    font-size: 1.5rem;
    color: black;
    margin: 0;
    font-weight: 700;
    line-height: 1.2;
}

/* =========================================
   Right Column: Buy Box
   ========================================= */

.col-buybox {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.price-box {
    background: transparent;
    /* Remove nested bg */
    border: none;
    /* Remove nested border */
    padding: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.main-price-display {
    font-size: 2rem;
    font-weight: 800;
    color: var(--danger-color);
    /* Amazon red/price color */
}

.old-price-display {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 1rem;
}

.price-row {
    display: flex;
    flex-direction: column;
    /* Stack prices in buy box */
    align-items: flex-start;
}

/* Controls: Options & Quantity */
.product-controls-box {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    margin-top: 20px;
}

.price-iva-info {
    width: 100%;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.discount-badge {
    background-color: #13499a;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
}

/* Controls: Options & Quantity */
.product-controls-box {
    background: var(--card-bg);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: 0 8px 24px rgba(19, 73, 154, 0.1);
}

.control-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.modern-select {
    width: 100%;
    padding: var(--input-padding);
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #fff;
    cursor: pointer;
    color: black
}

.action-row {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-input-modern {
    width: 70px;
    padding: 12px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
}

.cart-btn-wrapper {
    flex-grow: 1;
}

.add-to-cart-btn-modern-img {
    width: 100%;
    max-width: 250px;
    height: auto;
    cursor: pointer;
    transition: transform 0.2s;
}

.add-to-cart-btn-modern-img:hover {
    transform: scale(1.05);
}

/* Availability */
.availability-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-weight: 600;
    flex-wrap: wrap;
}

/* =========================================
   Center Column: Details
   ========================================= */

.col-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-tabs-container {
    margin-top: 20px;
    width: 100%;
}

.tab-header {
    background-color: #f8f9fa;
    color: var(--text-color);
    padding: 10px 15px;
    border-bottom: 2px solid var(--primary-color);
    border-radius: 0;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
}

.tab-content {
    background: transparent;
    padding: 15px 0;
    border: none;
    border-radius: 0;
    line-height: 1.6;
}

/* =========================================
   Thresholds / Soglie Section
   ========================================= */

.modern-table-panel {
    margin-top: 30px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 5px;
    box-shadow: var(--shadow);
}

.threshold-container .h2 {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
}

/* Outer layout table corrections */
#tabellaSoglie {
    width: 100%;
    margin-bottom: 0;
}

#tabellaSoglie>tbody>tr>td {
    vertical-align: top;
    border: none;
}

/* Inner GridViews (Actual Data) */
.datatable_opt {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
}

.datatable_opt td {
    padding: 8px 4px;
    border-bottom: 1px solid #eee;
    text-align: center;
    color: var(--text-color);
    width: auto !important;
    /* Override inline styling from ASPX */
}

.datatable_opt th {
    background-color: #f8f9fa;
    color: var(--primary-color);
    font-weight: 700;
    padding: 10px 4px;
    text-align: center;
    border-bottom: 2px solid #ddd;
    text-transform: uppercase;
    font-size: 0.8rem;
    width: auto !important;
    /* Override inline styling from ASPX */
}

.datatable_opt tr:last-child td {
    border-bottom: none;
}

.datatable_opt tr:nth-child(even) {
    background-color: #fafafa;
}

/* Responsive: stack tables on mobile */
@media (max-width: 768px) {

    #tabellaSoglie,
    #tabellaSoglie tbody,
    #tabellaSoglie tr,
    #tabellaSoglie td {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
    }

    #tabellaSoglie>tbody>tr>td {
        padding: 0 0 20px 0;
    }
}

/* =========================================
   Ricambi / Spare Parts (DataList) Responsive
/* =========================================
   Ricambi / Spare Parts (Grid Layout)
   ========================================= */

.ricambi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Force 3 cols as requested/implied */
    gap: 20px;
    width: 100%;
}

.celleofferte {
    width: 100% !important;
    height: 100%;
    margin-bottom: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.celleofferte img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 992px) {
    .ricambi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .ricambi-grid {
        grid-template-columns: 1fr;
    }
}

/* Active Thumbnail State */
.active-thumb {
    border-color: var(--primary-color) !important;
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.product-code {
    font-weight: 700;
    font-size: 1.2rem;
    color: #FFD700;
    background-color: #13499a;
    padding: 5px;
}

@media only screen and (max-width: 1700px) {

    /* Hide Sidebars from Master Page */
    #colonna_sx,
    #colonna_dx {
        display: none !important;
    }

    /* Expand Central Column */
    #colonna_centrale {
        width: 100% !important;
        float: none !important;
    }

    #centrale {
        margin: 0 !important;
        padding: 0 !important;
    }
}