/*
 * Affiliate Hero – Comparison Tables
 *
 * Kleuren komen als custom properties uit de instellingen (inline op .ahct).
 * Tekstkleur en lettertype erven we van het thema; alleen randen en vlakken
 * zijn van ons, zodat de tabel in elk thema leesbaar blijft.
 */

.ahct {
    --ahct-accent: #1f6feb;
    --ahct-recommended: #1a7f37;
    --ahct-difference: #fff4c2;
    /* Achtergrond en tekstkleur horen bij elkaar: een vaste witte cel met de
       (lichte) tekstkleur van een donker thema is onleesbaar. */
    --ahct-bg: #fff;
    --ahct-text: #1f2328;
    --ahct-line: rgba(127, 127, 127, .22);
    --ahct-zebra: rgba(127, 127, 127, .06);
    --ahct-label-width: 180px;
    --ahct-col-min: 170px;
    --ahct-sticky-offset: 0px;

    position: relative;
    margin: 1.5em 0;
    font-size: .95em;
    line-height: 1.45;
}

.ahct *,
.ahct *::before,
.ahct *::after {
    box-sizing: border-box;
}

.ahct-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Toolbar ---- */

.ahct-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-bottom: 12px;
}

.ahct-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-weight: 500;
}

.ahct-switch input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.ahct-switch__track {
    position: relative;
    flex: none;
    width: 34px;
    height: 20px;
    border-radius: 10px;
    background: rgba(127, 127, 127, .35);
    transition: background .15s;
}

.ahct-switch__track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: transform .15s;
}

.ahct-switch input:checked + .ahct-switch__track {
    background: var(--ahct-accent);
}

.ahct-switch input:checked + .ahct-switch__track::after {
    transform: translateX(14px);
}

.ahct-switch input:focus-visible + .ahct-switch__track {
    outline: 2px solid var(--ahct-accent);
    outline-offset: 2px;
}

.ahct-picker {
    display: none;
}

/* ---- Tabel ---- */

.ahct-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ahct-table {
    color: var(--ahct-text);
    width: 100%;
    min-width: calc(var(--ahct-label-width) + var(--ahct-col-min) * 2);
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    background: var(--ahct-bg);
}

.ahct[data-cols="3"] .ahct-table { min-width: calc(var(--ahct-label-width) + var(--ahct-col-min) * 3); }
.ahct[data-cols="4"] .ahct-table { min-width: calc(var(--ahct-label-width) + var(--ahct-col-min) * 4); }
.ahct[data-cols="5"] .ahct-table { min-width: calc(var(--ahct-label-width) + var(--ahct-col-min) * 5); }

.ahct-table th,
.ahct-table td {
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--ahct-line);
    vertical-align: top;
    text-align: left;
    background: var(--ahct-bg);
}

.ahct-corner,
.ahct-table th[scope="row"] {
    width: var(--ahct-label-width);
}

/* Het rijlabel blijft links staan bij horizontaal scrollen, anders weet je niet meer wat je vergelijkt. */
.ahct-table th[scope="row"],
.ahct-corner {
    position: sticky;
    left: 0;
    z-index: 2;
    font-weight: 600;
}

.ahct-table tbody .ahct-row:nth-child(even) > * {
    background-image: linear-gradient(var(--ahct-zebra), var(--ahct-zebra));
}

/* ---- Kolomkop ---- */

.ahct-col {
    position: relative;
    text-align: center !important;
    vertical-align: bottom !important;
    border-bottom: 2px solid var(--ahct-line) !important;
}

.ahct-col > span {
    display: block;
}

.ahct-col__image {
    height: 110px;
    margin-bottom: 8px;
}

.ahct-col__image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ahct-col__title {
    font-weight: 700;
    line-height: 1.3;
}

.ahct-col__price {
    margin-top: 6px;
    font-size: 1.15em;
    font-weight: 700;
}

.ahct-col__from {
    display: inline !important;
    font-size: .75em;
    font-weight: 400;
    opacity: .75;
}

.ahct-col__merchant {
    margin-top: 4px;
    font-size: .8em;
    font-weight: 400;
    opacity: .75;
}

.ahct-cta {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 14px;
    border-radius: 6px;
    background: var(--ahct-accent);
    color: #fff !important;
    font-weight: 600;
    text-decoration: none !important;
    line-height: 1.2;
    white-space: nowrap;
}

.ahct-cta:hover,
.ahct-cta:focus-visible {
    filter: brightness(.92);
}

.ahct-cta:focus-visible {
    outline: 2px solid var(--ahct-accent);
    outline-offset: 2px;
}

/* ---- Aanbevolen kolom ---- */

.ahct-badge {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--ahct-recommended);
    color: #fff;
    font-size: .75em;
    font-weight: 700;
    white-space: nowrap;
}

.ahct-table thead .ahct-col.is-recommended {
    padding-top: 22px;
}

.ahct-table .is-rec {
    box-shadow: inset 2px 0 0 var(--ahct-recommended), inset -2px 0 0 var(--ahct-recommended);
}

.ahct-table thead .is-rec {
    box-shadow: inset 2px 0 0 var(--ahct-recommended), inset -2px 0 0 var(--ahct-recommended), inset 0 2px 0 var(--ahct-recommended);
}

/* Alleen de allerlaatste rij sluit de kolom af, niet de laatste rij van elke groep. */
.ahct-table > :last-child > tr:last-child > .is-rec {
    box-shadow: inset 2px 0 0 var(--ahct-recommended), inset -2px 0 0 var(--ahct-recommended), inset 0 -2px 0 var(--ahct-recommended);
}

.ahct-table .is-rec .ahct-cta {
    background: var(--ahct-recommended);
}

/* Ruimte voor de badge die half boven de kop uitsteekt; overflow-x knipt hem anders af. */
.ahct-scroll {
    padding-top: 12px;
}

/* ---- Cellen ---- */

.ahct-empty {
    opacity: .45;
}

.ahct-unit {
    opacity: .75;
}

.ahct-bool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.ahct-bool--yes {
    background: var(--ahct-accent);
    color: #fff;
}

.ahct-bool--no {
    background: rgba(127, 127, 127, .18);
    opacity: .8;
}

.ahct-table .is-rec .ahct-bool--yes {
    background: var(--ahct-recommended);
}

.ahct-table td.is-best {
    font-weight: 700;
}

.ahct-table td.is-best::after {
    content: "★";
    margin-left: 6px;
    color: var(--ahct-accent);
    font-size: .85em;
}

.ahct-stars {
    position: relative;
    display: inline-block;
    vertical-align: -1px;
    font-size: 1em;
    line-height: 1;
    letter-spacing: 1px;
}

.ahct-stars::before {
    content: "★★★★★";
    opacity: .25;
}

.ahct-stars__fill {
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
    white-space: nowrap;
    color: #e3a008;
}

.ahct-stars__fill::before {
    content: "★★★★★";
}

.ahct-stars__value {
    font-size: .85em;
    opacity: .75;
}

.ahct-stock--in { color: #1a7f37; font-weight: 600; }
.ahct-stock--out { color: #cf222e; font-weight: 600; }

.ahct-stores {
    display: block;
    font-size: .85em;
    opacity: .75;
}

.ahct-list {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.ahct-list li {
    position: relative;
    margin: 0 0 4px !important;
    padding-left: 20px;
}

.ahct-list li::before {
    position: absolute;
    left: 0;
    font-weight: 700;
}

.ahct-list--pros li::before { content: "+"; color: #1a7f37; }
.ahct-list--cons li::before { content: "−"; color: #cf222e; }

/* ---- Winkels ---- */

.ahct-logo {
    display: inline-block;
    max-width: 72px;
    max-height: 22px;
    width: auto;
    height: auto;
    vertical-align: middle;
    object-fit: contain;
}

.ahct-col__merchant .ahct-logo {
    max-height: 18px;
    margin: 0 2px;
}

.ahct-col__merchant-name {
    overflow-wrap: anywhere;
}

.ahct-shops {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.ahct-shop {
    margin: 0 0 6px !important;
    padding: 0;
}

.ahct-shop:last-child {
    margin-bottom: 0 !important;
}

.ahct-shop__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 5px 8px;
    border: 1px solid var(--ahct-line);
    border-radius: 6px;
    color: inherit !important;
    text-decoration: none !important;
    line-height: 1.2;
}

a.ahct-shop__link:hover,
a.ahct-shop__link:focus-visible {
    border-color: var(--ahct-accent);
}

a.ahct-shop__link:focus-visible {
    outline: 2px solid var(--ahct-accent);
    outline-offset: 1px;
}

.ahct-shop__name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .9em;
}

.ahct-shop__price {
    flex: none;
    font-weight: 700;
    white-space: nowrap;
}

.ahct-shop.is-cheapest .ahct-shop__link {
    border-color: var(--ahct-accent);
    box-shadow: inset 3px 0 0 var(--ahct-accent);
}

.ahct-shop.is-out .ahct-shop__link {
    opacity: .6;
}

.ahct-shop__note {
    display: block;
    margin-top: 2px;
    font-size: .75em;
    opacity: .75;
}

/* ---- Groepen ---- */

.ahct-group__head th {
    padding: 14px 12px 6px !important;
    position: static !important;
    border-bottom: 2px solid var(--ahct-line) !important;
}

.ahct-group__toggle {
    all: unset;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: .8em;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.ahct-group__toggle::before {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .15s;
}

.ahct-group__toggle[aria-expanded="false"]::before {
    transform: rotate(-45deg);
}

.ahct-group__toggle:focus-visible {
    outline: 2px solid var(--ahct-accent);
    outline-offset: 2px;
}

.ahct-group.is-collapsed .ahct-row,
.ahct-group.is-empty {
    display: none;
}

/* ---- Tooltips ---- */

.ahct-help {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    border-radius: 50%;
    border: 1px solid currentColor;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    opacity: .6;
    cursor: help;
    vertical-align: 1px;
}

.ahct-help:hover,
.ahct-help[aria-expanded="true"] {
    opacity: 1;
}

.ahct-help:focus-visible {
    outline: 2px solid var(--ahct-accent);
    outline-offset: 2px;
}

.ahct-tip {
    display: block;
    margin-top: 6px;
    padding: 6px 8px;
    border-radius: 4px;
    background: rgba(127, 127, 127, .12);
    font-size: .85em;
    font-weight: 400;
}

.ahct-tip[hidden] {
    display: none;
}

/* ---- Verschillen en "at a glance" ---- */

.ahct.is-highlight tr[data-differs="1"] > td {
    background-image: linear-gradient(var(--ahct-difference), var(--ahct-difference));
}

.ahct.is-only-diff tr[data-differs="0"] {
    display: none;
}

.ahct:not(.is-expanded) tr.is-extra {
    display: none;
}

.ahct-more {
    display: block;
    margin: 12px auto 0;
    padding: 8px 16px;
    border: 1px solid var(--ahct-line);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.ahct-more:focus-visible {
    outline: 2px solid var(--ahct-accent);
    outline-offset: 2px;
}

/* ---- Sticky kop (gekloond door JS) ---- */

.ahct-sticky {
    position: fixed;
    top: var(--ahct-sticky-offset);
    z-index: 50;
    display: none;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .08);
}

.ahct-sticky.is-visible {
    display: block;
}

.ahct-sticky .ahct-table {
    min-width: 0;
}

.ahct-sticky .ahct-col {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    vertical-align: middle !important;
}

.ahct-sticky .ahct-col__price {
    margin-top: 2px;
    font-size: 1em;
}

/* ---- Mobiel: twee kolommen naast elkaar ---- */

/*
 * De twee-koloms weergave leunt op JS: die kiest welke twee kolommen zichtbaar
 * zijn. Draait het script niet (bijv. een kapotte gecombineerde JS-bundel), dan
 * blijft de gewone tabel staan, horizontaal scrollbaar met de labels vast links.
 * Anders lopen vijf waarden per rij door elkaar in een raster van twee breed.
 */
@media (max-width: 767px) {

    .ahct.is-js .ahct-picker {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 10px;
    }

    .ahct-picker select {
        width: 100%;
        max-width: 100%;
        padding: 6px 8px;
        font: inherit;
    }

    .ahct.is-js .ahct-table,
    .ahct.is-js .ahct-table thead,
    .ahct.is-js .ahct-table tbody {
        display: block;
        min-width: 0 !important;
        width: 100%;
    }

    /* minmax(0, …): anders duwt een lange producttitel de tweede kolom buiten beeld. */
    .ahct.is-js .ahct-table tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ahct-table th,
    .ahct-table td {
        overflow-wrap: anywhere;
    }

    .ahct.is-js[data-cols="1"] .ahct-table tr { grid-template-columns: 1fr; }

    .ahct.is-js .ahct-corner {
        display: none;
    }

    /* Het label wordt een volle regel boven de twee waarden: geen horizontaal scrollen nodig. */
    .ahct.is-js .ahct-table th[scope="row"] {
        grid-column: 1 / -1;
        width: auto;
        position: static;
        padding-bottom: 2px;
        border-bottom: 0;
        font-size: .85em;
        opacity: .85;
    }

    .ahct.is-js .ahct-table th[scope="colgroup"] {
        grid-column: 1 / -1;
    }

    .ahct.is-js .ahct-table [data-col].is-hidden {
        display: none;
    }

    .ahct.is-js .ahct-table tbody .ahct-row:nth-child(even) > * {
        background-image: none;
    }

    .ahct-col__image {
        height: 80px;
    }

    .ahct-cta {
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ahct *,
    .ahct *::before,
    .ahct *::after {
        transition: none !important;
    }
}
