﻿/* Mantieni gli stili originali semplici */
.accessorio-item, .preview-item {
    transition: transform 0.3s ease;
}

    .accessorio-item:hover, .preview-item:hover {
        transform: translateY(-2px);
    }

    .accessorio-item img, .preview-item img {
        object-fit: contain;
    }

/* Custom checkbox styles - originali */
.custom-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #495057;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

    .custom-checkbox i {
        display: none;
        color: white;
        font-size: 14px;
    }

    .custom-checkbox.checked {
        background-color: #495057;
        border-color: #495057;
    }

        .custom-checkbox.checked i {
            display: block;
        }

/* Custom tabs style - originali */
.custom-tabs {
    gap: 0.5rem;
    border-bottom: none;
}

    .custom-tabs .nav-link {
        background-color: #ffffff;
        color: #212529;
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
        padding: 0.5rem 1.25rem;
        font-weight: 500;
        transition: all 0.2s ease-in-out;
    }

        .custom-tabs .nav-link:hover {
            background-color: #f8f9fa;
            border-color: #adb5bd;
        }

        .custom-tabs .nav-link.active,
        .custom-tabs .nav-link.active:hover {
            background-color: #495057;
            color: #ffffff;
            border-color: #495057;
        }

        .custom-tabs .nav-link:focus {
            box-shadow: 0 0 0 0.2rem rgba(73, 80, 87, 0.25);
            outline: none;
        }

/* Tab content styling */
.tab-content {
    padding-top: 1rem;
}

/* Layout base */
header {
    position: fixed;
    top: 0;
    width: 100%;
    height: 60px;
    z-index: 1100;
}

.content-wrapper {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    overflow: hidden;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    position: relative;
    background-color: #f5f5f5;
}

.page-content {
    width: 100%;
    height: 100%;
}

.ar {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

/* IMPORTANTE: Scrollable columns con overflow corretto */
.scroll-col-left {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
}

.scroll-col-right {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Per Offcanvas su desktop - CRITICO per lo scroll */
.offcanvas-body {
    height: 100%;
    overflow: hidden !important; /* Impedisce doppio scroll */
}

    .offcanvas-body .scroll-col-left,
    .offcanvas-body .scroll-col-right {
        height: 100%;
    }

/* Product header sticky */
.product-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8f9fa !important;
    flex-shrink: 0;
}

.accordion-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
}

    /* Personalizzazione scrollbar */
    .scroll-col-left::-webkit-scrollbar,
    .accordion-container::-webkit-scrollbar {
        width: 8px;
    }

    .scroll-col-left::-webkit-scrollbar-track,
    .accordion-container::-webkit-scrollbar-track {
        background: #f1f1f1;
    }

    .scroll-col-left::-webkit-scrollbar-thumb,
    .accordion-container::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 4px;
    }

        .scroll-col-left::-webkit-scrollbar-thumb:hover,
        .accordion-container::-webkit-scrollbar-thumb:hover {
            background: #555;
        }

/* Stili originali per preview e accessori items */
.preview-item, .accessorio-item {
    color: #444;
    font-weight: bold;
    font-size: 12px;
}

/* Desktop Layout (md and up) */
@media (min-width: 768px) {
    /* Menu sinistro - larghezza fissa con scroll */
    #menuLeft {
        position: relative;
        width: 25%;
        max-width: 350px;
        min-width: 280px;
        height: 100%;
        border-right: 1px solid #dee2e6;
        background-color: #ffffff;
    }

    /* Canvas Container - centro flessibile */
    .canvas-container {
        flex: 1;
    }

    /* Menu destro - larghezza fissa con scroll */
    #menuRight {
        width: 20%;
        max-width: 300px;
        min-width: 250px;
        height: 100%;
        border-left: 1px solid #dee2e6;
        background-color: #ffffff;
    }

        /* IMPORTANTE: Per desktop, gli offcanvas diventano colonne normali */
        #menuLeft.offcanvas-md,
        #menuRight.offcanvas-md {
            position: relative;
            flex-shrink: 0;
            transform: none !important;
            visibility: visible !important;
            background-color: transparent;
            border: 0;
            height: calc(100vh - 60px); /* Altezza corretta sottraendo header */
        }

            /* Assicura che il contenuto sia scrollabile su desktop */
            #menuLeft.offcanvas-md .offcanvas-body,
            #menuRight.offcanvas-md .offcanvas-body {
                padding: 0;
                height: 100%;
                overflow: visible !important;
            }

    .offcanvas-md.offcanvas-start,
    .offcanvas-md.offcanvas-end {
        top: auto;
        bottom: auto;
    }

    .offcanvas-backdrop {
        display: none;
    }
}

/* Mobile Layout (below md) */
@media (max-width: 767.98px) {
    /* Canvas fullscreen su mobile */
    .canvas-container {
        width: 100%;
        height: 100%;
    }

    /* Offcanvas per mobile */
    #menuLeft,
    #menuRight {
        width: 85%;
        max-width: 350px;
    }

        /* Assicura scroll su mobile negli offcanvas */
        #menuLeft .offcanvas-body,
        #menuRight .offcanvas-body {
            height: 100%;
            overflow: hidden !important;
        }

    /* Responsive columns in accordion */
    .accordion-body .row .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .accordion-body .row .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Responsive per dispositivi molto piccoli */
@media (max-width: 575.98px) {
    .accordion-body .row .col-md-6,
    .accordion-body .row .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    header .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* SweetAlert2 QR Code styling */
.swal2-popup img.qr-code {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 10px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Z-index management */
.offcanvas {
    z-index: 1045;
}

.modal {
    z-index: 1055;
}

.swal2-container {
    z-index: 1060;
}

/* Focus states per accessibilità */
button:focus,
.btn:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(73, 80, 87, 0.25);
}

/* Print styles */
@media print {
    header,
    #menuLeft,
    #menuRight,
    .offcanvas {
        display: none !important;
    }

    .canvas-container {
        width: 100% !important;
        height: 100% !important;
        position: static !important;
    }
}
