/**
 * Custom Compare Logic CSS
 * Color: #894BE2
 */

/* 1. Modal Overlay & Container */
#electro-compare-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 99990;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

#electro-compare-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 1200px;
    height: 90vh;
    background: #fff;
    z-index: 99999;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    display: flex;
    flex-direction: column;
}

#electro-compare-modal-overlay.open,
#electro-compare-modal.open {
    opacity: 1;
    visibility: visible;
}

#electro-compare-modal.open {
    transform: translate(-50%, -50%) scale(1);
}

#close-compare-modal {
    position: absolute;
    top: -15px;
    right: -15px;
    background: #894BE2;
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(137, 75, 226, 0.4);
    transition: transform 0.2s;
    z-index: 2;
}

#close-compare-modal:hover {
    transform: scale(1.1);
}

/* 2. Content & Table */
.compare-modal-content {
    flex: 1;
    overflow: auto;
    padding: 30px;
    border-radius: 12px;
}

.loading-spinner {
    text-align: center;
    padding: 50px;
    font-size: 18px;
    color: #888;
}

.electro-compare-table-wrapper {
    /* Horizontal scroll for overflow */
    overflow-x: auto;
    width: 100%;
    transition: opacity 0.2s;
}

.electro-compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    /* Force scroll */
}

.electro-compare-table th,
.electro-compare-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.electro-compare-table th {
    background: #f9f9f9;
    width: 200px;
    font-weight: 600;
    color: #333;
    position: sticky;
    left: 0;
    z-index: 10;
    border-right: 1px solid #eee;
}

.electro-compare-table td.td-product {
    text-align: center;
    position: relative;
    min-width: 200px;
}

.electro-compare-table td .button {
    display: table;
    /* Fix for some themes centering */
    margin: 0 auto;
    text-align: center;
    width: 100%;
    max-width: 160px;
}

.electro-compare-table td img {
    max-width: 150px;
    height: auto;
    margin: 0 auto;
    display: block;
}

.remove-compare-product {
    color: #ff4444;
    text-decoration: none;
    font-size: 20px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.remove-compare-product:hover {
    background: #ff4444;
    color: #fff;
}

.product-title a {
    color: #333;
    font-weight: 700;
    text-decoration: none;
}

.product-title a:hover {
    color: #894BE2;
}

.product-price {
    font-weight: 700;
    color: #894BE2;
    font-size: 1.1em;
}

.tr-section th {
    background: #894BE2;
    color: #fff;
    text-align: center;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 1px;
}

/* 3. Floating Trigger */
#electro-compare-float-trigger {
    position: fixed;
    bottom: 30px;
    left: 30px;
    background: #894BE2;

    color: #fff;
    padding: 12px 25px;
    border-radius: 50px;
    box-shadow: 0 10px 20px rgba(137, 75, 226, 0.4);
    cursor: pointer;
    z-index: 9990;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    transition: transform 0.2s;
}

#electro-compare-float-trigger:hover {
    transform: translateY(-5px);
}

#electro-compare-float-trigger .count {
    background: #fff;
    color: #894BE2;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* 4. Button in Loop */
.electro-add-to-compare-btn {
    cursor: pointer;
    /* Styles matching typical loop actions or as requested */
    color: #777;
    margin-top: 5px;
    display: inline-block;
    font-size: 0.9em;
}

.electro-add-to-compare-btn:hover {
    color: #894BE2;
}

.electro-add-to-compare-btn.added {
    color: #20c997;
    /* Success green */
}

/* Mobile Adjustments */
@media(max-width: 768px) {
    #electro-compare-modal {
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 0;
    }

    #close-compare-modal {
        top: 10px;
        right: 10px;
    }

    .electro-compare-table th {
        width: 120px;
        font-size: 12px;
    }

    .electro-compare-table td {
        min-width: 150px;
        font-size: 13px;
    }
}