.affl-comparison-table {
    position: relative;
    display: block;
    overflow: visible;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 20px;
    font-family: Arial, sans-serif;
    background-color: #fff;
    max-width: 100%;
    box-sizing: border-box;
}

.affl-comparison-table__title-wrapper {
    position: sticky;
    top: 0;
    left: 0;
    z-index: 90;
    background-color: #fff;
    padding: 10px 20px;
    text-align: left;
    border-bottom: 1px solid var(--affl-border-color, #ddd);
}

.affl-comparison-table__title {
    color: #333;
    font-size: 1.5em;
    margin: 0;
}

.affl-comparison-table__grid {
    display: table;
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    overflow-x: visible;
}

.affl-comparison-table__scroll-container {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.affl-comparison-table__scroll-container::-webkit-scrollbar {
    display: none;
}

.affl-comparison-table__row {
    display: table-row;
}

.affl-comparison-table--mode-simple .affl-comparison-table__row--hidden {
    display: none !important;
}

.affl-comparison-table__cell {
    display: table-cell;
    padding: 12px;
    text-align: center;
    border: 1px solid var(--affl-border-color, #ddd);
    vertical-align: top;
    background-color: #fff;
    box-sizing: border-box;
}

.affl-comparison-table__header-row {
    background-color: #f0f0f0;
    font-weight: bold;
}
.affl-comparison-table__header-cell {
    font-weight: bold;
    background-color: #f0f0f0;
    border: 1px solid var(--affl-border-color, #ddd);
    width: 250px;
    overflow: visible;
    box-sizing: border-box;
}

.affl-comparison-table__header-cell--criteria {
    text-align: left;
    padding-left: 20px;
    position: sticky;
    left: 0;
    z-index: 80;
    background-color: #f0f0f0;
  
}


.affl-comparison-table__criteria-cell {
    text-align: left;
    font-weight: bold;
    padding-left: 20px;
    width: 250px;
    background-color: #f5f5f5;
    position: sticky;
    left: 0;
    z-index: 70;
    background-color: #f5f5f5;
  
}

.affl-comparison-table__sticky-product-header {
    position: fixed;
    top: var(--affililabs-get-wp-admin-bar-height);
    left: 0;
    width: 100%;
    display: flex;
    align-items: center;
    background-color: #fff;
    padding: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 100;
    transform: translateY(-100%);
    transition: transform 0.3s ease-in-out;
    overflow: hidden;
    box-sizing: border-box;
}

.affl-comparison-table__sticky-product-header--visible {
    transform: translateY(0);
}

.affl-comparison-table__sticky-criteria-placeholder {
    width: 250px;
    text-align: left;
    padding-left: 20px;
    font-weight: bold;
    flex-shrink: 0;
    color: var(--affl-text-color, #333);
}

.affl-comparison-table__sticky-products-wrapper {
    display: flex;
    overflow: hidden;
    flex-grow: 1;
    border-left: solid 1px #ccc;
}

.affl-comparison-table__sticky-product-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 250px;
    flex-shrink: 0;
    gap: 5px;
    padding: 0 5px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}


.affl-comparison-table__sticky-product-image {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 3px;
}

.affl-comparison-table__sticky-product-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9em;
    color: var(--affl-text-color, #333);
}


.affl-comparison-table__product-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: auto;
    position: relative;
    justify-content: center;
    overflow: visible;
    padding-top: 40px;
}

.affl-comparison-table__product-image {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    border-radius: 5px;
    object-fit: contain;
}

.affl-comparison-table__product-name {
    font-weight: bold;
    color: #333;
    text-decoration: none;
    overflow-wrap: break-word;
    word-wrap: break-word;
    white-space: normal;
}

.affl-comparison-table__product-name:hover {
    text-decoration: underline;
}

.affl-comparison-table__field-value {
    padding: 4px 0;
    word-break: break-word;
}

.affl-comparison-table__product-cell--price {
    font-weight: bold;
    color: #28a745;
}

.affl-button {
    display: inline-block;
    padding: 8px 15px;
    font-size: 14px;
    background-color: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.affl-button:hover {
    background-color: #0056b3;
    color: white;
}

.affl-comparison-table__tier-badge {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 2;
    white-space: nowrap;
}

.affl-comparison-table__tier-indicator {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 0.8em;
  font-weight: bold;
  margin-top: 5px;
}

:root {
    --affililabs-get-wp-admin-bar-height: 0px;
}

.affl-comparison-table--theme-light {
    --affl-primary-color: #007bff;
    --affl-secondary-color: #28a745;
    --affl-text-color: #333;
    --affl-background-color: #fff;
    --affl-header-background: #f0f0f0;
    --affl-criteria-background: #f5f5f5;
    --affl-border-color: #ddd;
    --affl-tier-best-price-color: var(--affl-secondary-color);
    --affl-tier-best-quality-color: var(--affl-primary-color);
    --affl-tier-best-cost-benefit-color: #ffc107;

    background-color: var(--affl-background-color);
    color: var(--affl-text-color);
    border-color: var(--affl-border-color);
}

.affl-comparison-table--theme-light .affl-comparison-table__title {
    color: var(--affl-text-color);
}

.affl-comparison-table--theme-light .affl-comparison-table__header-cell {
    background-color: var(--affl-header-background);
}

.affl-comparison-table--theme-light .affl-comparison-table__criteria-cell {
    background-color: var(--affl-criteria-background);
}

.affl-comparison-table--theme-light .affl-comparison-table__cell {
    background-color: var(--affl-background-color);
    border-color: var(--affl-border-color);
}

.affl-comparison-table--theme-light .affl-button {
    background-color: var(--affl-primary-color);
}

.affl-comparison-table--theme-dark {
    --affl-primary-color: #2a80b9 !important;
    --affl-secondary-color: #27ae60 !important;
    --affl-text-color: #f5f5f5 !important;
    --affl-background-color: #2c3e50 !important;
    --affl-header-background: #34495e !important;
    --affl-criteria-background: #2c3e50 !important;
    --affl-border-color: #1a252f !important;
    --affl-tier-best-price-color: #27ae60 !important;
    --affl-tier-best-quality-color: #2a80b9 !important;
    --affl-tier-best-cost-benefit-color: #f39c12 !important;

    background-color: var(--affl-background-color) !important;
    color: var(--affl-text-color) !important;
    border-color: var(--affl-border-color) !important;
}

.affl-comparison-table--theme-dark .affl-comparison-table__title {
    color: var(--affl-text-color) !important;
}

.affl-comparison-table--theme-dark .affl-comparison-table__header-cell {
    background-color: var(--affl-header-background) !important;
    color: var(--affl-text-color) !important;
}

.affl-comparison-table--theme-dark .affl-comparison-table__criteria-cell {
    background-color: var(--affl-criteria-background) !important;
    color: var(--affl-text-color) !important;
}

.affl-comparison-table--theme-dark .affl-comparison-table__cell {
    background-color: var(--affl-background-color) !important;
    border-color: var(--affl-border-color) !important;
    color: var(--affl-text-color) !important;
}

.affl-comparison-table__product-image-container {
  height: 150px;
}

.affl-comparison-table--theme-dark .affl-comparison-table__product-name {
    color: var(--affl-text-color) !important;
}

.affl-comparison-table--theme-dark .affl-button {
    background-color: var(--affl-primary-color) !important;
}

.affl-comparison-table--theme-dark .affl-comparison-table__product-cell--price {
    color: var(--affl-secondary-color) !important;
}

.affl-comparison-table--theme-dark .affl-comparison-table__header-cell--best-quality {
    background-color: var(--affl-tier-best-quality-color) !important;
    color: #fff !important;
}

.affl-comparison-table--theme-dark .affl-comparison-table__product-cell--best-quality {
    border: 2px solid var(--affl-tier-best-quality-color) !important;
    background-color: rgba(39, 174, 96, 0.1) !important;
    color: var(--affl-tier-best-quality-color) !important;
}

.affl-comparison-table--theme-dark .affl-comparison-table__header-cell--best-price {
    background-color: var(--affl-tier-best-price-color) !important;
    color: #fff !important;
}

.affl-comparison-table--theme-dark .affl-comparison-table__product-cell--best-price {
    border: 2px solid var(--affl-tier-best-price-color) !important;
    background-color: rgba(39, 174, 96, 0.1) !important;
    color: var(--affl-tier-best-price-color) !important;
}

.affl-comparison-table--theme-dark .affl-comparison-table__header-cell--best-cost-benefit {
    background-color: var(--affl-tier-best-cost-benefit-color) !important;
    color: #fff !important;
}

.affl-comparison-table--theme-dark .affl-comparison-table__product-cell--best-cost-benefit {
    border: 2px solid var(--affl-tier-best-cost-benefit-color) !important;
    background-color: rgba(243, 156, 18, 0.1) !important;
    color: var(--affl-tier-best-cost-benefit-color) !important;
}



.affl-comparison-table--theme-modern-blue {
    --affl-primary-color: #3498db;
    --affl-secondary-color: #2ecc71;
    --affl-text-color: #2c3e50;
    --affl-background-color: #ecf0f1;
    --affl-header-background: #3498db;
    --affl-criteria-background: #bdc3c7;
    --affl-border-color: #bdc3c7;
    --affl-tier-best-price-color: #2ecc71;
    --affl-tier-best-quality-color: #3498db;
    --affl-tier-best-cost-benefit-color: #e67e22;

    background-color: var(--affl-background-color);
    color: var(--affl-text-color);
    border-color: var(--affl-border-color);
}

.affl-comparison-table--theme-modern-blue .affl-comparison-table__title {
    color: var(--affl-primary-color);
    background-color: var(--affl-background-color);
    border-bottom: 2px solid var(--affl-primary-color);
}

.affl-comparison-table--theme-modern-blue .affl-comparison-table__header-cell {
    background-color: var(--affl-header-background);
    color: white;
}

.affl-comparison-table--theme-modern-blue .affl-comparison-table__criteria-cell {
    background-color: var(--affl-criteria-background);
}

.affl-comparison-table--theme-modern-blue .affl-comparison-table__cell {
    background-color: var(--affl-background-color);
    border-color: var(--affl-border-color);
}

.affl-comparison-table--theme-modern-blue .affl-button {
    background-color: var(--affl-primary-color);
    border-radius: 20px;
}

.affl-comparison-table--theme-modern-blue .affl-comparison-table__product-name {
    color: var(--affl-primary-color);
}

.affl-comparison-table__header-cell--best-price,
.affl-comparison-table__product-cell--best-price {
    position: relative;
    background-color: rgba(40, 167, 69, 0.05) !important;
    border: 2px solid var(--affl-tier-best-price-color, #28a745) !important;
    border-top-width: 1px !important;
    border-bottom-width: 1px !important;
}

.affl-comparison-table__header-cell--best-quality,
.affl-comparison-table__product-cell--best-quality {
    position: relative;
    background-color: rgba(0, 123, 255, 0.05) !important;
    border: 2px solid var(--affl-tier-best-quality-color, #007bff) !important;
    border-top-width: 1px !important;
    border-bottom-width: 1px !important;
}

.affl-comparison-table__header-cell--best-cost-benefit,
.affl-comparison-table__product-cell--best-cost-benefit {
    position: relative;
    background-color: rgba(255, 193, 7, 0.05) !important;
    border: 2px solid var(--affl-tier-best-cost-benefit-color, #ffc107) !important;
    border-top-width: 1px !important;
    border-bottom-width: 1px !important;
}

.affl-comparison-table__tier-badge.affl-comparison-table__tier-indicator--best-price,
.affl-comparison-table__tier-indicator--best-price {
    background-color: var(--affl-tier-best-price-color, #28a745);
  color: white;
}

.affl-comparison-table__tier-badge.affl-comparison-table__tier-indicator--best-quality,
.affl-comparison-table__tier-indicator--best-quality {
    background-color: var(--affl-tier-best-quality-color, #007bff);
  color: white;
}

.affl-comparison-table__tier-badge.affl-comparison-table__tier-indicator--best-cost-benefit,
.affl-comparison-table__tier-indicator--best-cost-benefit {
    background-color: var(--affl-tier-best-cost-benefit-color, #ffc107);
  color: #333;
}

.affl-comparison-table__sticky-product-item.affl-comparison-table__header-cell--best-price {
    border: 2px solid var(--affl-tier-best-price-color, #28a745) !important;
    border-top-width: 1px !important;
    border-bottom-width: 1px !important;
}
.affl-comparison-table__sticky-product-item.affl-comparison-table__header-cell--best-quality {
    border: 2px solid var(--affl-tier-best-quality-color, #007bff) !important;
    border-top-width: 1px !important;
    border-bottom-width: 1px !important;
}
.affl-comparison-table__sticky-product-item.affl-comparison-table__header-cell--best-cost-benefit {
    border: 2px solid var(--affl-tier-best-cost-benefit-color, #ffc107) !important;
    border-top-width: 1px !important;
    border-bottom-width: 1px !important;
}



.affl-comparison-table[data-best-price-color] .affl-comparison-table__tier-indicator--best-price,
.affl-comparison-table[data-best-price-color] .affl-comparison-table__tier-badge.affl-comparison-table__tier-indicator--best-price {
    background-color: attr(data-best-price-color);
}

.affl-comparison-table[data-best-quality-color] .affl-comparison-table__tier-indicator--best-quality,
.affl-comparison-table[data-best-quality-color] .affl-comparison-table__tier-badge.affl-comparison-table__tier-indicator--best-quality {
    background-color: attr(data-best-quality-color);
}

.affl-comparison-table[data-best-cost-benefit-color] .affl-comparison-table__tier-indicator--best-cost-benefit,
.affl-comparison-table[data-best-cost-benefit-color] .affl-comparison-table__tier-badge.affl-comparison-table__tier-indicator--best-cost-benefit {
    background-color: attr(data-best-cost-benefit-color);
}

@media (max-width: 768px) {
    .affl-comparison-table__title {
        padding: 10px;
        text-align: center;
    }

    .affl-comparison-table__cell {
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        text-align: center;
        padding: 12px;
        position: relative;
        padding-left: 12px;
        border: 1px solid var(--affl-border-color, #ddd);
    }

    .affl-comparison-table__header-row {
        display: contents;
    }

    .affl-comparison-table__header-cell {
        width: 250px;
        flex-shrink: 0;
    }

    .affl-comparison-table__header-cell--criteria {
        display: none;
    }

    .affl-comparison-table__criteria-cell {
        display: none;
    }

    .affl-comparison-table__cell:before {
        content: none;
    }

    .affl-comparison-table__mobile-criteria-label {
        display: none;
    }

  
    .affl-comparison-table__mobile-criteria-full-row {
        display: block;
        width: 100%;
        text-align: center;
        font-weight: bold;
        background-color: var(--affl-header-background, #f0f0f0);
        padding: 8px;
        margin-top: 10px;
        margin-bottom: 5px;
        border-bottom: 1px solid var(--affl-border-color, #ddd);
        box-sizing: border-box;
    }

  
    .affl-comparison-table__mobile-transposed-content {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

  
    .affl-comparison-table__mobile-product-headers-wrapper {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--affl-border-color, #ddd);
        transition: transform 0.3s ease-out;
    }

    .affl-comparison-table__mobile-product-headers-wrapper::-webkit-scrollbar {
        display: none;
    }

  
    .affl-comparison-table__mobile-product-headers-wrapper .affl-comparison-table__header-cell--product {
        width: 150px;
        flex-shrink: 0;
        border: 1px solid var(--affl-border-color, #ddd);
        background-color: transparent;
        padding: 8px;
    }

  
    .affl-comparison-table__mobile-product-data-row {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        border-bottom: 1px solid var(--affl-border-color, #ddd);
        transition: transform 0.3s ease-out;
    }

    .affl-comparison-table__mobile-product-data-row::-webkit-scrollbar {
        display: none;
    }

  
    .affl-comparison-table__mobile-product-data-row .affl-comparison-table__product-cell {
        width: 150px;
        flex-shrink: 0;
        border: 1px solid var(--affl-border-color, #ddd);
        background-color: transparent;
        padding: 8px;
    }

  
    .affl-comparison-table__sticky-product-header {
        width: 100%;
        display: flex;
    }

    .affl-comparison-table__sticky-criteria-placeholder {
        display: none;
    }

    .affl-comparison-table__sticky-products-wrapper {
        display: flex;
        overflow: hidden;
        flex-grow: 1;
    }

    .affl-comparison-table__sticky-product-item {
        width: 150px;
        flex-shrink: 0;
    }

  
    .affl-comparison-table__tier-badge {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
      
    }

  
    .affl-comparison-table__nav-arrow {
        display: none;
    }

    .affl-comparison-table--mobile-active .affl-comparison-table__scroll-container {
        overflow-x: hidden;
    }
}
.affl-comparison-table__nav-arrow {
    position: absolute;
    top: 10%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background-color 0.3s, opacity 0.3s;
  
}

.affl-comparison-table__nav-arrow:hover {
    background-color: rgba(255, 255, 255, 1);
}
.affl-comparison-table__nav-arrow--left {
    left: -50px;
}

.affl-comparison-table__nav-arrow--right {
    right: -50px;
}

.affl-comparison-table__nav-arrow img {
    width: 16px;
    height: 16px;
    filter: brightness(50%);
}

.affl-comparison-table__nav-arrow--hidden {
    opacity: 0;
    pointer-events: none;
}
