/* =========================================
   1. KONTENER MODALA I TŁO (INTELIGENTNE DOPASOWANIE)
   ========================================= */

#v8-compare-overlay {
    position: fixed;
    top: 0; left: 0; 
    width: 100%; height: 100%;
    background: rgba(18, 18, 18, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 2147483647;
    display: none;
    align-items: center;
    justify-content: center;
}

#v8-compare-overlay.active {
    display: flex;
}

.v8-compare-modal {
    background: #ffffff;
    width: auto; 
    min-width: 320px;
    max-width: 95vw;
    height: auto;
    max-height: 90vh;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    animation: v8PopIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes v8PopIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* =========================================
   2. PRZYCISKI (ZAMKNIJ I USUŃ)
   ========================================= */

.v8-close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: #f8f9fa;
    color: #495057;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2147483647;
    border: 1px solid #dee2e6;
}

.v8-close-modal:hover {
    background: #fa5252;
    color: white;
    transform: rotate(90deg);
}

.remove-comp {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ffffff;
    color: #e03131;
    border: 1px solid #ffc9c9;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* =========================================
   3. TABELA I UJEDNOLICENIE ZDJĘĆ
   ========================================= */

#adscode-compare-table-container {
    overflow: auto;
    padding: 20px;
    padding-top: 45px;
}

.adscode-compare-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.adscode-compare-table thead th {
    background: #ffffff;
    padding: 20px 15px;
    position: relative;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid #f1f3f5;
    vertical-align: top;
    text-align: center;
    min-width: 220px;
}

/* KLUCZOWA POPRAWKA: Ujednolicenie zdjęć */
.adscode-compare-table thead img {
    display: block;
    margin: 0 auto 12px auto;
    /* Stałe wymiary kontenera zdjęcia */
    width: 150px !important; 
    height: 150px !important;
    /* object-fit: contain zapobiega rozciąganiu - zdjęcie wpisze się w kwadrat 150x150 */
    object-fit: contain; 
    background-color: #fff; /* Opcjonalnie: białe tło pod spodem */
    border-radius: 8px;
}

.adscode-compare-table thead th:first-child,
.adscode-compare-table tbody td:first-child {
    background: #f8f9fa;
    left: 0;
    z-index: 20;
    text-align: left;
    min-width: 180px;
    border-right: 1px solid #f1f3f5;
}

.adscode-compare-table thead th:first-child {
    color: #adb5bd;
    font-size: 11px;
    text-transform: uppercase;
}

.adscode-compare-table thead strong {
    display: block;
    font-size: 13px;
    color: #212529;
    line-height: 1.4;
    margin-bottom: 5px;
    /* Ograniczenie nazwy do 2 linii, aby nagłówek był równy */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 36px;
}

.adscode-compare-table .price {
    font-size: 16px;
    font-weight: 800;
    color: #000;
}

.adscode-compare-table tbody td {
    padding: 14px 20px;
    border-bottom: 1px solid #f1f3f5;
    font-size: 14px;
    color: #495057;
    text-align: center;
    background: #ffffff;
}

.adscode-compare-table tbody td:first-child {
    font-weight: 600;
    color: #212529;
}

.adscode-compare-table tr.is-different td {
    background-color: #fff9db !important;
}

.adscode-compare-table tbody tr:hover td {
    background-color: #f1f3f5 !important;
}

/* =========================================
   4. STYLIZACJA DYMKA
   ========================================= */

.v8-compare-badge {
    position: fixed;
    bottom: 160px; 
    right: 20px;
    background: #111;
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    z-index: 9990;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    font-weight: 600;
    font-size: 14px;
    display: none;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 2px solid rgba(255,255,255,0.1);
}

.v8-compare-badge .count {
    background: #e10000;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    margin-right: 8px;
    font-size: 12px;
}

/* =========================================
   5. RESPONSIVE
   ========================================= */

@media (max-width: 768px) {
    .v8-compare-modal {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .adscode-compare-table thead img {
        width: 100px !important;
        height: 100px !important;
    }

    .v8-compare-badge {
        bottom: 140px;
        right: 15px;
    }
}