/* =============================================================
 * Amazon Auto-Compare – frontend styles
 * Colour/size variables (--aac-*) are printed inline by PHP.
 * ============================================================= */

/* ---------- Comparison table (unchanged from 1.3.x) ---------- */
#aac-wrapper { margin: 30px 0; }
.aac-table { width: 100%; border-collapse: collapse; border: 1px solid var(--aac-border); }
.aac-table thead th { background-color: var(--aac-header); color: var(--aac-header-txt); padding: 15px; text-align: center; font-weight: bold; font-size: var(--aac-fs-head); border: 1px solid var(--aac-border); }
.aac-table tbody td { border: 1px solid var(--aac-border); padding: 15px; text-align: center; vertical-align: middle; }
.aac-product-img { height: 110px; width: auto; max-width: 85px; object-fit: contain; display: block; margin: 0 auto; }
.aac-title-link { color: #333333; text-decoration: none; font-weight: bold; font-size: var(--aac-fs-title); line-height: 1.4; }
.aac-star-rating-box { position: relative; display: inline-block; font-size: var(--aac-fs-star); letter-spacing: 2px; line-height: 1; }
.aac-star-background { color: #cccccc; }
.aac-star-foreground { position: absolute; top: 0; left: 0; white-space: nowrap; overflow: hidden; color: var(--aac-star); }

.aac-rating-text { font-size: var(--aac-fs-body); color: #777777; margin-top: 5px; font-style: italic; }

.aac-btn { background-color: var(--aac-btn); color: var(--aac-btn-txt); padding: 10px 20px !important; text-decoration: none; border-radius: 4px; display: flex !important; justify-content: center; align-items: center; text-align: center; text-transform: uppercase; font-weight: bold; font-size: var(--aac-fs-btn); white-space: nowrap; line-height: normal !important; margin: 0 !important; box-shadow: none !important; box-sizing: border-box !important; width: auto !important; height: auto !important; min-height: 0 !important; }
.aac-btn:hover { opacity: 0.9; color: var(--aac-btn-txt); }

/* Mobile Stacked View */
@media screen and (max-width: 768px) {
    .aac-table thead { display: none; }
    .aac-table, .aac-table tbody, .aac-table tr, .aac-table td { display: block; width: 100%; }
    .aac-table tr { margin-bottom: 25px; border: 2px solid var(--aac-border); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08); position: relative; overflow: hidden; background: linear-gradient(to right, var(--aac-header) 0, var(--aac-header) 35%, #ffffff 35%, #ffffff 100%); background-repeat: no-repeat; background-size: 100% 100%; }
    .aac-table td { display: flex; flex-direction: row; padding: 0; border-bottom: 1px solid #bbbbbb; border-top: none; border-left: none; border-right: none; min-height: 80px; background: transparent; align-items: center; position: relative; z-index: 1; }
    .aac-table td:last-child { border-bottom: none; }
    .aac-table td:before { content: attr(data-label); width: 35%; background-color: transparent; color: var(--aac-header-txt); font-weight: bold; font-size: var(--aac-fs-m-head); display: flex; align-items: center; justify-content: flex-start; text-align: left; padding: 10px 8px 10px 18px; box-sizing: border-box; flex-shrink: 0; border-right: none; }
    .aac-mobile-content { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 15px; box-sizing: border-box; background-color: #ffffff; }
    .aac-mobile-content img { max-width: 100%; height: auto; max-height: 110px; }
    .aac-btn { margin: 0 auto !important; }
    .aac-table td .aac-title-link { text-align: left; }
}

/* =============================================================
 * CTA BLOCKS
 * ============================================================= */

.aac-cta, .aac-sticky {
    --_acc: var(--aac-cta-accent, #2563eb);
    --_btn: var(--aac-cta-btn, #ff9900);
    --_btn-txt: var(--aac-cta-btn-txt, #111111);
    --_r: var(--aac-cta-radius, 14px);
    --_ink: #0f172a;
    --_muted: #475569;
    --_line: rgba(15, 23, 42, 0.10);
    --_surface: #ffffff;
}
.aac-cta, .aac-cta *, .aac-sticky, .aac-sticky * { box-sizing: border-box; }
.aac-cta [hidden] { display: none !important; }

.aac-cta {
    position: relative;
    margin: 28px 0;
    padding: 22px;
    border-radius: var(--_r);
    color: var(--_ink);
    font-size: 16px;
    line-height: 1.5;
    background: var(--_surface);
    border: 1px solid var(--_line);
}

/* Theme-proofing resets */
.aac-cta ul, .aac-cta li { list-style: none !important; margin: 0; padding: 0; }
.aac-cta li::marker { content: none; }
.aac-cta li::before { content: none; }
.aac-cta img { max-width: 100%; height: auto; margin: 0; border: 0; box-shadow: none; border-radius: 0; }
.aac-cta a { text-decoration: none !important; box-shadow: none; border-bottom: 0; }

/* ---------- Style presets ---------- */
.aac-style-modern {
    background: #f6f9ff;
    background: linear-gradient(135deg, color-mix(in srgb, var(--_acc) 9%, #ffffff) 0%, #ffffff 62%);
    border-color: #dbe5fb;
    border-color: color-mix(in srgb, var(--_acc) 20%, #ffffff);
    box-shadow: 0 14px 34px -16px rgba(15, 23, 42, 0.22), 0 2px 6px rgba(15, 23, 42, 0.05);
}
.aac-style-bold {
    background: #ffffff;
    border: 2px solid var(--_acc);
    box-shadow: 6px 6px 0 rgba(15, 23, 42, 0.12);
    box-shadow: 6px 6px 0 color-mix(in srgb, var(--_acc) 22%, transparent);
}
.aac-style-minimal {
    --_ink: inherit;
    --_muted: inherit;
    --_line: rgba(127, 127, 127, 0.28);
    --_surface: transparent;
    box-shadow: none;
}
.aac-style-minimal .aac-hero__sub,
.aac-style-minimal .aac-bar__sub,
.aac-style-minimal .aac-end__text,
.aac-style-minimal .aac-trust { opacity: 0.8; }

/* ---------- Badge ---------- */
.aac-cta .aac-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: max-content;
    max-width: 100%;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--_acc);
    background: #e8efff;
    background: color-mix(in srgb, var(--_acc) 13%, #ffffff);
}
.aac-cta .aac-badge--sm { padding: 3px 10px; font-size: 11px; }

/* ---------- Button ---------- */
.aac-cta a.aac-cta-btn,
.aac-sticky a.aac-cta-btn {
    position: relative;
    overflow: hidden;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    min-height: 48px;
    margin: 0;
    padding: 12px 22px !important;
    border: 0;
    border-radius: calc(var(--_r) * 0.7);
    background: var(--_btn) !important;
    color: var(--_btn-txt) !important;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 8px 18px -8px rgba(15, 23, 42, 0.45), inset 0 -2px 0 rgba(0, 0, 0, 0.12) !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.aac-cta a.aac-cta-btn:hover,
.aac-cta a.aac-cta-btn:focus-visible,
.aac-sticky a.aac-cta-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 12px 22px -10px rgba(15, 23, 42, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.12) !important;
}
.aac-cta a.aac-cta-btn:focus-visible { outline: 3px solid var(--_acc); outline-offset: 2px; }
.aac-cta .aac-arrow { display: inline-block; transition: transform 0.2s ease; }
.aac-cta a.aac-cta-btn:hover .aac-arrow { transform: translateX(4px); }
.aac-cta a.aac-cta-btn--lg { min-height: 54px; padding: 14px 28px !important; font-size: 17px; }
.aac-cta a.aac-cta-btn--block { display: flex !important; width: 100%; white-space: normal; }

/* Effects */
.aac-cta a.aac-fx-shine::after {
    content: "";
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    transform: skewX(-20deg);
    animation: aac-shine 3.6s ease-in-out infinite;
    pointer-events: none;
}
@keyframes aac-shine {
    0% { left: -80%; }
    55%, 100% { left: 130%; }
}
.aac-cta a.aac-fx-pulse { animation: aac-pulse 2.4s ease-out infinite; }
@keyframes aac-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 153, 0, 0.55); }
    70% { box-shadow: 0 0 0 14px rgba(255, 153, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 153, 0, 0); }
}
@supports (color: color-mix(in srgb, red 50%, blue)) {
    @keyframes aac-pulse {
        0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--_btn) 55%, transparent); }
        70% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--_btn) 0%, transparent); }
        100% { box-shadow: 0 0 0 0 transparent; }
    }
}

/* ---------- Stars (optional) ---------- */
.aac-cta-stars { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.aac-cta-stars__label { font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--_muted); }
.aac-cta-stars__label[hidden] { display: none; }
.aac-cta-stars .aac-star-rating-box { font-size: 18px; }
.aac-cta-stars__num { font-size: 13px; font-weight: 600; color: var(--_muted); }

/* ---------- F · Disclosure ---------- */
.aac-disclosure {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 18px 0 -10px;
    font-size: 12.5px;
    line-height: 1.45;
    opacity: 0.75;
}
.aac-disclosure__icon {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    font: italic 700 10px/13px Georgia, serif;
    text-align: center;
}

/* ---------- A · Hero card ---------- */
.aac-cta--hero {
    display: grid;
    grid-template-columns: minmax(170px, 240px) 1fr;
    gap: 28px;
    align-items: center;
    padding: 26px;
}
.aac-hero__media a {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    padding: 18px;
    border-radius: calc(var(--_r) * 0.85);
    background: #ffffff;
    box-shadow: inset 0 0 0 1px var(--_line);
}
.aac-hero__media img { max-height: 100%; width: auto; object-fit: contain; transition: transform 0.3s ease; }
.aac-hero__media a:hover img { transform: scale(1.04); }
.aac-hero__body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.aac-hero__title { font-size: 23px; font-weight: 800; line-height: 1.25; letter-spacing: -0.01em; }
.aac-cta .aac-hero__title a { color: var(--_ink) !important; }
.aac-cta .aac-hero__title a:hover { color: var(--_acc) !important; }
.aac-hero__sub { color: var(--_muted); font-size: 15.5px; }
.aac-checks { display: grid; gap: 7px; }
.aac-cta .aac-checks li { position: relative; padding-left: 28px; font-size: 15px; color: var(--_muted); line-height: 1.45; }
.aac-cta .aac-checks li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #16a34a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.aac-cta__actions { margin-top: 4px; }
.aac-trust { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.aac-cta .aac-trust li { position: relative; padding-left: 18px; font-size: 13px; font-weight: 600; color: var(--_muted); }
.aac-cta .aac-trust li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    width: 13px;
    height: 13px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316a34a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- B · Text + button bar ---------- */
.aac-cta--bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
}
.aac-cta--bar.aac-style-bold { border-width: 2px 2px 2px 6px; }
.aac-bar__thumb {
    flex: 0 0 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    padding: 6px;
    border-radius: calc(var(--_r) * 0.6);
    background: #ffffff;
    box-shadow: inset 0 0 0 1px var(--_line);
}
.aac-bar__thumb img { max-height: 100%; width: auto; object-fit: contain; }
.aac-bar__text { flex: 1 1 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.aac-cta .aac-bar__title { color: var(--_ink) !important; font-size: 17px; font-weight: 800; line-height: 1.3; }
.aac-cta .aac-bar__title:hover { color: var(--_acc) !important; }
.aac-bar__sub { font-size: 14px; color: var(--_muted); }
.aac-cta--bar .aac-cta-btn { flex: 0 0 auto; }

/* ---------- C · Comparison cards ---------- */
.aac-cta--cards { padding: 22px; }
.aac-cards__heading { margin: 0 0 16px; font-size: 20px; font-weight: 800; line-height: 1.3; }
.aac-cards__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.aac-cards--2 .aac-cards__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.aac-card {
    --_card-btn: var(--_btn);
    --_card-btn-txt: var(--_btn-txt);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 34px 16px 16px;
    border-radius: calc(var(--_r) * 0.85);
    background: #ffffff;
    border: 1px solid var(--_line);
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.aac-style-minimal .aac-card { background: transparent; }
.aac-card:hover { transform: translateY(-3px); box-shadow: 0 14px 28px -16px rgba(15, 23, 42, 0.3); }
.aac-card--1 { border: 2px solid var(--_acc); }
.aac-card--2 { --_card-btn: var(--_acc); --_card-btn-txt: #ffffff; }
.aac-card--3 { --_card-btn: #16a34a; --_card-btn-txt: #ffffff; }
.aac-cta .aac-card a.aac-cta-btn { background: var(--_card-btn) !important; color: var(--_card-btn-txt) !important; margin-top: auto; padding: 11px 12px !important; font-size: 15px; gap: 0.35em; }
.aac-card .aac-cta-btn .aac-arrow { flex: 0 0 auto; }
.aac-card__badge {
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    color: #ffffff;
    background: var(--_acc);
    box-shadow: 0 4px 10px -4px rgba(15, 23, 42, 0.4);
}
.aac-card--1 .aac-card__badge { background: #d97706; }
.aac-card--2 .aac-card__badge { background: var(--_acc); }
.aac-card--3 .aac-card__badge { background: #16a34a; }
.aac-card__img { display: flex; align-items: center; justify-content: center; width: 100%; height: 150px; }
.aac-card__img img { max-height: 150px; width: auto; object-fit: contain; transition: transform 0.3s ease; }
.aac-card:hover .aac-card__img img { transform: scale(1.05); }
.aac-cta .aac-card__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--_ink) !important;
    font-size: 15.5px;
    font-weight: 700;
    line-height: 1.35;
}
.aac-card__note {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13.5px;
    color: var(--_muted);
}
.aac-card .aac-cta-stars { justify-content: center; }

/* ---------- D · End-of-content box ---------- */
.aac-cta--end {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    gap: 18px;
    padding: 22px 24px;
}
.aac-end__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    color: #16a34a;
    background: #dcfce7;
}
.aac-end__body { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.aac-end__headline { font-size: 20px; font-weight: 800; line-height: 1.25; }
.aac-end__text { font-size: 14.5px; color: var(--_muted); }
.aac-end__thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    padding: 8px;
    border-radius: calc(var(--_r) * 0.7);
    background: #ffffff;
    box-shadow: inset 0 0 0 1px var(--_line);
}
.aac-end__thumb img { max-height: 100%; width: auto; object-fit: contain; }

/* ---------- E · Sticky mobile bar ---------- */
.aac-sticky {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 99990;
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 8px 10px;
    border-radius: var(--_r);
    background: #ffffff;
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 0 16px 40px -12px rgba(15, 23, 42, 0.45);
    transform: translateY(160%);
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.aac-sticky.is-visible { transform: translateY(0); }
.aac-sticky__thumb { flex: 0 0 44px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.aac-sticky__thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.aac-sticky__title { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; font-weight: 700; }
/* Button keeps its full label; the title ellipsizes instead. */
.aac-sticky a.aac-cta-btn {
    flex: 0 0 auto;
    width: auto !important;
    max-width: none !important;
    min-width: max-content;
    min-height: 44px;
    padding: 10px 16px !important;
    font-size: 14px !important;
    letter-spacing: normal !important;
    text-transform: none !important;
}
@media (max-width: 380px) {
    .aac-sticky { gap: 8px; }
    .aac-sticky__thumb { flex-basis: 36px; width: 36px; height: 36px; }
    .aac-sticky a.aac-cta-btn { padding: 10px 12px !important; font-size: 13px !important; }
}
.aac-sticky__close {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.06);
    color: #475569;
    font-size: 18px;
    line-height: 28px;
    cursor: pointer;
}
@media (max-width: 768px) {
    .aac-sticky { display: flex; }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    .aac-cta--end { grid-template-columns: auto 1fr; }
    .aac-end__thumb { display: none; }
    .aac-cta--end .aac-cta-btn { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 640px) {
    .aac-cta { padding: 18px; margin: 22px 0; }

    .aac-cta--hero { grid-template-columns: 1fr; gap: 16px; padding: 20px; }
    .aac-hero__media { width: 100%; max-width: 220px; margin: 0 auto; }
    .aac-hero__title { font-size: 20px; }
    .aac-cta a.aac-cta-btn--lg { display: flex !important; width: 100%; }

    .aac-cta--bar { flex-wrap: wrap; padding: 14px; }
    .aac-bar__text { flex: 1 1 calc(100% - 82px); }
    .aac-cta--bar .aac-cta-btn { flex: 1 1 100%; display: flex !important; }

    .aac-cards__grid,
    .aac-cards--2 .aac-cards__grid {
        display: flex;
        gap: 12px;
        margin: 0 -18px;
        padding: 14px 18px 6px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .aac-cards__grid::-webkit-scrollbar { display: none; }
    .aac-card { flex: 0 0 78%; scroll-snap-align: center; }
    .aac-cards--2 .aac-card { flex-basis: 82%; }
    .aac-cards__heading { margin-bottom: 4px; }

    .aac-cta--end { grid-template-columns: 1fr; justify-items: center; text-align: center; }
    .aac-end__body { align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
    .aac-cta *, .aac-sticky { animation: none !important; transition: none !important; }
    .aac-cta a.aac-fx-shine::after { display: none; }
}
