/* ═══════════════════════════════════════════════════════════
   Comparison Table Styles
   ═══════════════════════════════════════════════════════════ */

.section--comparison {
    padding-bottom: clamp(3rem, 5vw, 5rem);
}

/* ─── Wrapper ───────────────────────────────────────────── */
.comparison {
    position: relative;
}

.comparison__wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}
.comparison__wrapper::-webkit-scrollbar { height: 6px; }
.comparison__wrapper::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

/* Scroll hint gradient */
.comparison__scroll-hint {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(to left, var(--color-surface) 0%, transparent 100%);
    z-index: 2;
    pointer-events: none;
}
.comparison.has-overflow .comparison__scroll-hint { display: block; }

/* ─── Navigation ────────────────────────────────────────── */
.comparison__nav {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.comparison__nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.comparison__nav-btn:hover:not(:disabled) {
    border-color: var(--color-accent);
    color: var(--color-accent);
}
.comparison__nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

/* ─── Table ─────────────────────────────────────────────── */
.comparison__table {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
}
.comparison__table tr {
    border-bottom: 1px solid var(--color-border-light);
}
.comparison__label {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #eef1f6;
    color: var(--color-text);
    min-width: 160px;
    max-width: 180px;
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
    border-right: 1px solid var(--color-border);
}
.comparison__cell {
    min-width: 180px;
    max-width: 220px;
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    text-align: center;
    vertical-align: middle;
    color: var(--color-text);
}
/* Zebra stripe */
.comparison__table tr:nth-child(even) .comparison__cell {
    background: var(--color-surface-alt);
}
.comparison__table tr:nth-child(even) .comparison__label {
    background: #e4e8ef;
}

/* Testsieger column highlight */
.comparison__cell--winner {
    background: rgba(22, 128, 74, 0.04) !important;
    border-left: 2px solid var(--color-result-excellent);
    border-right: 2px solid var(--color-result-excellent);
}
.comparison__table tr:first-child .comparison__cell--winner {
    border-top: 2px solid var(--color-result-excellent);
}
.comparison__table tr:last-child .comparison__cell--winner {
    border-bottom: 2px solid var(--color-result-excellent);
}

/* ─── Cell Renderers ────────────────────────────────────── */

/* Badge */
.comparison__row--badge .comparison__cell {
    text-align: center;
}
.auto-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin: 0 auto;
}
.auto-badge__svg {
    display: block;
    width: 70%;
    height: auto;
    margin: 0 auto;
}
.auto-badge__label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: center;
    line-height: 1.15;
    width: 60%;
}
/* Custom badge images + auto badges */
.badge-img {
    width: 70%;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}
.result-combined__badge {
    width: 100%;
}
.result-combined__badge .auto-badge,
.result-combined__badge .badge-img {
    width: 70%;
    margin: 0 auto;
}

/* Image */
.comparison__row--image .comparison__cell,
.comparison__row--badge .comparison__cell {
    padding: 0.75rem 0.5rem;
}

/* Title */
.cell-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-primary);
    text-decoration: none;
}
.cell-title:hover { color: var(--color-accent); }

/* Result with Badge (combined) */
.result-combined {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.result-combined__badge {}
.result-combined__text {
    text-align: center;
}

/* Result Badge */
.result-badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 4px;
    color: #fff;
}
.result--excellent { background: var(--color-result-excellent); }
.result--good      { background: var(--color-result-good); }
.result--fair       { background: var(--color-result-fair); }
.result--adequate  { background: var(--color-result-adequate); }
.result--poor       { background: var(--color-result-poor); }
.result-date {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.35rem;
}

/* Stars */
.star-rating {
    display: inline-flex;
    gap: 1px;
    align-items: center;
}
.star--full  { color: var(--color-warning); }
.star--half  { color: var(--color-warning); }
.star--empty { color: #d1d5db; }
.star-count {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.2rem;
}

/* Checkmarks */
.check-rating {
    display: inline-flex;
    gap: 2px;
    align-items: center;
}
.check--active  { color: var(--color-accent); }
.check--inactive { color: #d1d5db; }

/* Boolean */
.icon-bool--yes { color: var(--color-success); }
.icon-bool--no  { color: var(--color-danger); }

/* Flag text */
.flag-text {
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Lists */
.cell-list {
    text-align: left;
    font-size: 0.82rem;
    line-height: 1.5;
}
.cell-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    margin-bottom: 0.3rem;
}
.list-icon {
    flex-shrink: 0;
    margin-top: 2px;
}
.list-icon--positive { color: var(--color-success); }
.list-icon--negative { color: var(--color-danger); }

/* Buttons in table */
.comparison__row--button .comparison__cell,
.comparison__row--shop_button .comparison__cell {
    padding: 0.5rem 0.75rem;
}
.comparison__cell .btn {
    width: 100%;
    font-size: 0.78rem;
    padding: 0.45rem 0.75rem;
}

/* Shop-specific button colors */
.btn--amazon {
    background: #ff9900;
    border-color: #ff9900;
    color: #111;
}
.btn--amazon:hover {
    background: #e88a00;
    border-color: #e88a00;
    color: #111;
}
.btn--kaufland {
    background: #e10915;
    border-color: #e10915;
    color: #fff;
}
.btn--kaufland:hover {
    background: #c70812;
    border-color: #c70812;
    color: #fff;
}
.btn--otto {
    background: #d42d1e;
    border-color: #d42d1e;
    color: #fff;
}
.btn--otto:hover {
    background: #b82518;
    border-color: #b82518;
    color: #fff;
}
.btn--ebay {
    background: #0064d2;
    border-color: #0064d2;
    color: #fff;
}
.btn--ebay:hover {
    background: #0053ae;
    border-color: #0053ae;
    color: #fff;
}
.btn--shop {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}
.btn--shop:hover {
    background: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    color: #fff;
}

/* Price */
.cell-price {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--color-primary);
}

/* Highlight text + tested date */
.cell-highlight {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-accent);
}
.cell-tested-date {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--color-success);
    background: rgba(22, 128, 74, 0.08);
    border: 1px solid rgba(22, 128, 74, 0.2);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    margin-top: 0.4rem;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

/* Cell text */
.cell-text {
    font-size: 0.88rem;
    line-height: 1.45;
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .comparison__label {
        min-width: 90px;
        max-width: 100px;
        font-size: 0.75rem;
        padding: 0.5rem 0.4rem;
    }
    .comparison__cell {
        /* calc: (viewport - label - scrollbar) / 2 to fit 2 products */
        min-width: calc((100vw - 100px - 1rem) / 2);
        max-width: calc((100vw - 100px - 1rem) / 2);
        padding: 0.5rem 0.4rem;
        font-size: 0.8rem;
    }
    .comparison__cell .btn {
        font-size: 0.72rem;
        padding: 0.35rem 0.5rem;
    }
    .cell-list { font-size: 0.75rem; }
    .cell-title { font-size: 0.82rem; }
    .result-badge { font-size: 0.65rem; padding: 0.25rem 0.5rem; }
}
