/**
 * Mivv 2026 - WooCommerce Product Compare CSS
 * Style per la funzionalità di confronto prodotti (max 5 prodotti)
 */

/* ==========================================================================
   1. Toast Notifications (Avvisi non invasivi)
   ========================================================================== */
.mivv-compare-toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background-color: #343434;
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 4px;
    border-left: 4px solid #D30018;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    z-index: 100010;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mivv-compare-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.mivv-compare-toast i {
    color: #D30018;
    font-size: 16px;
}

/* ==========================================================================
   2. Floating Compare Bar (Barretta in basso)
   ========================================================================== */
#mivv-compare-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #1a1a1a;
    color: #ffffff;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 99990;
    transform: translateY(100%);
    transition: transform 0.35s ease-in-out;
    border-top: 3px solid #D30018;
    padding: 10px 0;
}

#mivv-compare-bar.active {
    transform: translateY(0);
}

.mivv-compare-bar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    gap: 15px;
}

.mivv-compare-bar-left {
    display: flex;
    align-items: center;
    gap: 15px;
    overflow-x: visible;
    padding: 4px 0;
    scrollbar-width: thin;
}

.mivv-compare-bar-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mivv-compare-bar-title .badge {
    background-color: #D30018;
    color: #fff;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
}

.mivv-compare-thumbs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mivv-compare-thumb-item {
    position: relative;
    width: 48px;
    height: 48px;
    background: #ffffff;
    border-radius: 4px;
    padding: 2px;
    border: 1px solid #444;
    flex-shrink: 0;
}

.mivv-compare-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.mivv-compare-thumb-item .remove-thumb {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #D30018;
    color: #ffffff;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    line-height: 1;
    transition: transform 0.2s ease;
}

.mivv-compare-thumb-item .remove-thumb:hover {
    transform: scale(1.15);
    background: #ff1a35;
}

.mivv-compare-bar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.mivv-compare-bar-actions .btn-compare-open {
    background-color: #D30018;
    color: #ffffff;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 13px;
    padding: 8px 18px;
    border: none;
    border-radius: 3px;
    transition: background-color 0.2s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mivv-compare-bar-actions .btn-compare-open:hover {
    background-color: #b50014;
    color: #ffffff;
}

.mivv-compare-bar-actions .btn-compare-clear {
    background: transparent;
    color: #aaaaaa;
    border: 1px solid #555555;
    font-size: 12px;
    padding: 7px 12px;
    border-radius: 3px;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.mivv-compare-bar-actions .btn-compare-clear:hover {
    color: #ffffff;
    border-color: #888888;
    background-color: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   3. Modal Overlay & Modal Window
   ========================================================================== */
#mivv-compare-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    /*padding: 20px;*/
}

#mivv-compare-modal.open {
    opacity: 1;
    visibility: visible;
}

.mivv-compare-modal-content {
    background: #ffffff;
    width: 95%;
    max-width: 1300px;
    max-height: 90vh;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: mivvModalSlide 0.3s ease-out forwards;
}

@keyframes mivvModalSlide {
    from {
        transform: translateY(30px) scale(0.97);
    }

    to {
        transform: translateY(0) scale(1);
    }
}

.mivv-compare-modal-header {
    background-color: #1a1a1a;
    color: #ffffff;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid #D30018;
}

.mivv-compare-modal-title {
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
    margin: 0;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #FFF;
}

.mivv-compare-modal-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Custom Switch Toggle per Evidenzia Differenze */
.mivv-diff-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    color: #dddddd;
    user-select: none;
    cursor: pointer;
}

.mivv-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.mivv-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mivv-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #555555;
    transition: .3s;
    border-radius: 22px;
}

.mivv-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked+.mivv-slider {
    background-color: #D30018;
}

input:checked+.mivv-slider:before {
    transform: translateX(22px);
}

.mivv-compare-modal-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0 8px;
    transition: color 0.2s ease;
}

.mivv-compare-modal-close:hover {
    color: #D30018;
}

.mivv-compare-modal-body {
    padding: 20px;
    overflow: auto;
    flex-grow: 1;
}

/* ==========================================================================
   4. Comparison Table (Tabella di Confronto Mobile Touch Friendly)
   ========================================================================== */
.mivv-compare-table-wrapper {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    width: 100%;
}

.mivv-compare-table {
    width: 100%;
    min-width: 600px;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
    background: #ffffff;
}

.mivv-compare-table th,
.mivv-compare-table td {
    padding: 14px 18px;
    border-bottom: 1px solid #e9ecef;
    border-right: 1px solid #e9ecef;
    vertical-align: middle;
    font-size: 14px;
    color: #343434;
}

/* Prima Colonna Sticky (Attributi) */
.mivv-compare-table th.mivv-sticky-col,
.mivv-compare-table td.mivv-sticky-col {
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: #f8f9fa !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: #1a1a1a;
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
    border-right: 2px solid #D30018;
}

/* Colonne Prodotti */
.mivv-compare-table .product-col {
    min-width: 220px;
    max-width: 260px;
    width: 240px;
    text-align: center;
}

/* Header Prodotto */
.mivv-compare-table .product-header-cell {
    position: relative;
    padding-top: 30px;
    background-color: #fafafa;
}

.mivv-compare-table .btn-remove-product {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e9ecef;
    color: #666;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mivv-compare-table .btn-remove-product:hover {
    background: #D30018;
    color: #ffffff;
}

.mivv-compare-table .product-img-wrapper {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.mivv-compare-table .product-img-wrapper img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.mivv-compare-table .product-img-wrapper img:hover {
    transform: scale(1.05);
}

.mivv-compare-table .product-title-link {
    font-weight: 700;
    color: #1a1a1a;
    text-decoration: none;
    font-size: 15px;
    display: block;
    line-height: 1.3;
    margin-bottom: 6px;
}

.mivv-compare-table .product-title-link:hover {
    color: #D30018;
}

.mivv-compare-table .brand-hierarchy {
    font-size: 11px;
    font-weight: 700;
    color: #D30018;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: block;
}

/* Evidenzia Differenze (Classe .is-different) */
.mivv-compare-table tr.is-different td:not(.mivv-sticky-col) {
    background-color: #fff8e6 !important;
    border-bottom-color: #ffe0b2;
}

.mivv-compare-table tr.is-different th.mivv-sticky-col {
    background-color: #fff3cd !important;
    color: #856404;
}

/* Stato Vuoto */
.mivv-compare-empty {
    text-align: center;
    padding: 50px 20px;
}

.mivv-compare-empty i {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 15px;
}

.mivv-compare-empty h4 {
    font-weight: 700;
    color: #343434;
    margin-bottom: 10px;
}

.mivv-compare-empty p {
    color: #777777;
    font-size: 14px;
}

/* ==========================================================================
   5. UI Triggers (Pulsante "Aggiungi al confronto")
   ========================================================================== */
.mivv-compare-btn {
    transition: all 0.25s ease;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 3px;
    cursor: pointer;
}

.mivv-compare-btn.in-compare {
    background-color: #343434 !important;
    border-color: #343434 !important;
    color: #ffffff !important;
}

.mivv-compare-btn.in-compare:hover {
    background-color: #D30018 !important;
    border-color: #D30018 !important;
}

.mivv-compare-btn i {
    font-size: 14px;
}

/* Single Product Button styling */
.product-compare-single-wrapper {
    margin: 15px 0;
}

/* Card Loop Button styling */
.product-compare-trigger {
    margin-top: 10px;
}

/* Mobile Adjustments */
@media (max-width: 767.98px) {
    .mivv-compare-bar-container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .mivv-compare-bar-actions {
        justify-content: space-between;
    }

    .mivv-compare-modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        position: relative;
    }

    .mivv-compare-modal-close {
        position: absolute;
        top: 12px;
        right: 12px;
    }

    .mivv-compare-table th.mivv-sticky-col,
    .mivv-compare-table td.mivv-sticky-col {
        width: 140px;
        min-width: 140px;
        max-width: 140px;
        font-size: 11px;
        padding: 10px;
    }

    .mivv-compare-table .product-col {
        width: 180px;
        min-width: 180px;
        max-width: 180px;
        padding: 10px;
        font-size: 13px;
    }
}