/* ══════════════════════════════════════════════════════════════════════════════
   VERSUS BLOCK (affiliate-booster/ab-versus-block)
   Premium comparison table with rigid column layout, consistent spacing,
   polished product card tops, and universally styled CTA buttons.

   DESIGN STRATEGY: AB's legacy markup has DIFFERENT HTML structures per
   column (product 1 has more nested divs than product 2+). To make columns
   look identical, we:
   1. Use table-layout: fixed to force equal-width columns
   2. Strip ALL AB inner container styling (backgrounds/borders/padding)
   3. Let our flex layout on .affiliate-sp-inner reassemble content uniformly
   4. Hide empty/placeholder-only elements to prevent column-specific gaps
   ══════════════════════════════════════════════════════════════════════════════ */

/* Focus ring via CSS class (set/removed by JS) — no inline styles that stick */
.ab-versus-block .lwp-focused {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35) !important;
    border-radius: 3px;
}

.ab-versus-block {
    font-family: var(--ab-font);
    border: none;
    border-radius: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    overflow-x: auto;
    margin: 28px 0;
    background: #fff;
    position: relative;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

/* Gradient accent bar at top */
.ab-versus-block::before {
    content: "";
    display: block;
    height: 5px;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 50%, #6366f1 100%);
}

.ab-versus-block:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 12px 40px rgba(0, 0, 0, 0.1);
}

.ab-versus-block .affiliate-sp-wrapper {
    width: 100%;
}

/* ── Table: FIXED column layout so both product columns are identical width ─ */
.ab-versus-block table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 560px;
    table-layout: fixed !important;
}

/* Force label column to 160px, remaining columns split equally */
.ab-versus-block table col:first-child,
.ab-versus-block th:first-child,
.ab-versus-block td.affiliate-sp-row3,
.ab-versus-block td:first-child {
    width: 160px !important;
}

.ab-versus-block th,
.ab-versus-block td {
    padding: 14px 18px;
    text-align: center;
    vertical-align: middle;
    font-size: 14px;
    border-bottom: 1px solid #eef2f7;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Product header columns — equal width (split remaining space evenly) */
.ab-versus-block th:not(:first-child) {
    width: auto !important;
}

.ab-versus-block tr:last-child td {
    border-bottom: none;
}

/* ── Product header cells — premium polished tops ─────────────────── */
/* Vertical-align: top keeps content aligned regardless of row height.
   CRITICAL: force identical background on BOTH product columns so AB's
   :nth-child / legacy column-specific styling doesn't tint one side. */
.ab-versus-block th,
.ab-versus-block thead th,
.ab-versus-block tr:first-child th {
    background: linear-gradient(180deg, #fafbfc 0%, #f5f7fa 100%) !important;
    background-color: #fafbfc !important;
    padding: 32px 20px 28px !important;
    border-bottom: 2px solid #e2e8f0 !important;
    vertical-align: top !important;
}

.ab-versus-block th:first-child,
.ab-versus-block thead th:first-child,
.ab-versus-block tr:first-child th:first-child {
    width: 160px !important;
    background: linear-gradient(180deg, #eef2f7 0%, #e2e8f0 100%) !important;
    background-color: #eef2f7 !important;
    border-bottom: 2px solid #cbd5e1 !important;
    padding: 0 !important;
}

/* Force inner container backgrounds to be transparent so the cell's
   background isn't overridden by AB's nested container styling. */
.ab-versus-block th > *,
.ab-versus-block th .affiliate-sp-inner,
.ab-versus-block th .affiliate-sp-content,
.ab-versus-block th div[class*="affiliate-sp"]:not([class*="image"]):not([class*="btn"]) {
    background: transparent !important;
    background-color: transparent !important;
}

/* Vertical separators between product columns — crisp and consistent */
.ab-versus-block th + th,
.ab-versus-block td + td {
    border-left: 1px solid #e2e8f0 !important;
}

.ab-versus-block td.affiliate-sp-row3 + td,
.ab-versus-block .affiliate-sp-row3 + td {
    border-left: 1px solid #e2e8f0 !important;
}

/* Ensure each product column has equal horizontal padding so content
   doesn't feel offset — applies the same 32px breathing room on both sides */
.ab-versus-block th:not(:first-child) {
    padding-left: 32px !important;
    padding-right: 32px !important;
}

/* ── Product header inner layout — RIGID column with equal spacing ──
   Use flex `gap` (NOT margin) for spacing so empty children don't bloat
   the rhythm. Empty elements are hidden below so gap between visible
   elements is always identical regardless of AB's injected wrappers. */
.ab-versus-block .affiliate-sp-inner {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 18px !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Every direct child of .affiliate-sp-inner has zero margin — spacing
   is entirely controlled by the `gap` above for perfect symmetry. */
.ab-versus-block .affiliate-sp-inner > * {
    margin: 0 !important;
}

/* Hide empty elements so the `gap` never reserves space for "nothing".
   AB's HTML frequently has an extra empty <p>/<div> in one column but
   not the other — that asymmetry was the root of the spacing mismatch. */
.ab-versus-block .affiliate-sp-inner > p:empty,
.ab-versus-block .affiliate-sp-inner > div:empty,
.ab-versus-block .affiliate-sp-inner > span:empty,
.ab-versus-block .affiliate-sp-content > div:empty,
.ab-versus-block .affiliate-sp-content > p:empty,
.ab-versus-block .affiliate-sp-content:empty,
.ab-versus-block p.affiliate-sp-subtitle:empty,
.ab-versus-block .affiliate-sp-img-wrapper:empty {
    display: none !important;
}

/* Elements that contain only a <br> are effectively empty — hide them */
.ab-versus-block .affiliate-sp-inner > p:has(> br:only-child),
.ab-versus-block .affiliate-sp-inner > div:has(> br:only-child),
.ab-versus-block .affiliate-sp-content > p:has(> br:only-child) {
    display: none !important;
}

/* Strip all nested container chrome + spacing that AB injects around content */
.ab-versus-block .affiliate-sp-inner > div,
.ab-versus-block .affiliate-sp-content > div {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100%;
}

/* The inner content/discount+button wrapper — same flex gap rhythm as
   .affiliate-sp-inner so nested AB wrappers inherit consistent spacing. */
.ab-versus-block .affiliate-sp-content,
.ab-versus-block .affiliate-sp-cntn-wrapper,
.ab-versus-block div[class*="affiliate-sp-cntn"] {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 18px !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}

/* Zero out margins on nested content children too */
.ab-versus-block .affiliate-sp-content > *,
.ab-versus-block .affiliate-sp-cntn-wrapper > *,
.ab-versus-block div[class*="affiliate-sp-cntn"] > * {
    margin: 0 !important;
}

/* Re-apply styling for the image wrapper only (the exception) */
.ab-versus-block .affiliate-sp-image,
.ab-versus-block .affiliate-sp-image1,
.ab-versus-block div[class*="affiliate-sp-image"] {
    background: #fff !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 8px 20px rgba(0, 0, 0, 0.04) !important;
    padding: 10px !important;
    width: 96px !important;
    max-width: 96px !important;
}

/* Hide empty elements (description/subtitle/content when blank) so they
   don't create awkward gaps between title and button */
.ab-versus-block .affiliate-sp-inner > p:empty,
.ab-versus-block .affiliate-sp-inner > div:empty,
.ab-versus-block .affiliate-sp-content > div:empty,
.ab-versus-block .affiliate-sp-cntn-wrapper:empty,
.ab-versus-block p.affiliate-sp-subtitle:empty,
.ab-versus-block .affiliate-sp-img-wrapper:empty {
    display: none !important;
}

/* AB sometimes uses <br> or zero-width text to "fake" content — hide nodes
   that contain only whitespace/br */
.ab-versus-block .affiliate-sp-inner > p > br:only-child,
.ab-versus-block .affiliate-sp-content > p > br:only-child {
    display: none;
}

/* Product image wrapper — unified white card, same shape in every column.
   Uses :not(:empty) to ensure we only style wrappers that actually contain an img. */
.ab-versus-block .affiliate-sp-image,
.ab-versus-block .affiliate-sp-image1,
.ab-versus-block div[class*="affiliate-sp-image"]:not([class*="-wrapper"]) {
    margin: 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 110px !important;
    height: 110px !important;
    padding: 12px !important;
    background: #fff !important;
    border-radius: 16px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 8px 20px rgba(0, 0, 0, 0.04) !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    border: none !important;
}

.ab-versus-block .affiliate-sp-image img,
.ab-versus-block .affiliate-sp-image1 img,
.ab-versus-block div[class*="affiliate-sp-image"] img {
    width: 100% !important;
    height: 100% !important;
    max-width: 86px !important;
    max-height: 86px !important;
    object-fit: contain !important;
    border-radius: 6px !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.04));
}

/* Hide empty image-wrapper div that sometimes appears in only one column */
.ab-versus-block .affiliate-sp-img-wrapper:empty,
.ab-versus-block div[class*="affiliate-sp-img-wrapper"]:empty {
    display: none !important;
}

/* Product titles — bold, uniform, with a symmetric divider beneath */
.ab-versus-block .affiliate-sp-inner > p,
.ab-versus-block p[class*="affiliate-sp-title"] {
    font-size: 17px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    margin: 0 auto !important;
    letter-spacing: -0.01em !important;
    line-height: 1.3 !important;
    text-align: center !important;
    width: 100% !important;
    padding: 0 0 16px 0 !important;
    position: relative !important;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* Consistent divider under EVERY product title — guarantees both columns
   match regardless of whether AB injected an <hr> in one but not the other. */
.ab-versus-block .affiliate-sp-inner > p::after,
.ab-versus-block p[class*="affiliate-sp-title"]::after {
    content: "" !important;
    position: absolute !important;
    left: 50% !important;
    bottom: 0 !important;
    transform: translateX(-50%) !important;
    width: 70% !important;
    max-width: 180px !important;
    height: 1px !important;
    background: linear-gradient(90deg, transparent 0%, #cbd5e1 50%, transparent 100%) !important;
}

/* Kill any stray horizontal rules / dividers AB injected into ONE column
   (they were the root cause of asymmetry). Our ::after replaces them. */
.ab-versus-block hr,
.ab-versus-block .affiliate-sp-inner hr,
.ab-versus-block .affiliate-sp-inner > div[class*="divider"],
.ab-versus-block .affiliate-sp-inner > div[class*="separator"] {
    display: none !important;
}

/* Strip top/bottom borders from nested AB containers that create
   rogue divider lines in only one column */
.ab-versus-block .affiliate-sp-inner *,
.ab-versus-block .affiliate-sp-content *,
.ab-versus-block th > div,
.ab-versus-block th > div * {
    border-top: none !important;
    border-bottom: none !important;
}

/* Re-allow our divider (the ::after above doesn't use borders, so this
   blanket rule doesn't affect it). Re-allow image wrapper borders if any. */

/* Content / button wrapper — sits right below title, not stretched */
.ab-versus-block .affiliate-sp-content,
.ab-versus-block div[class*="affiliate-sp-content"] {
    width: 100%;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0;
    margin: 0;
}

/* Discount text + button pair — grouped visually */
.ab-versus-block .affiliate-sp-cntn-wrapper,
.ab-versus-block div[class*="affiliate-sp-cntn-wrapper"] {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.ab-versus-block .affiliate-sp-btn-wrapper,
.ab-versus-block div[class*="affiliate-sp-btn-wrapper"] {
    width: 100%;
    display: flex !important;
    justify-content: center;
    align-items: center;
    margin: 0 !important;
    padding: 0 !important;
}

/* ── Buttons — CTA styling for product-column anchors only ──────────── */
/* Strictly scoped to product headers (<th>) and known button classes.
   Comparison data cells (<td>) are EXCLUDED so inline decorations inside
   pros/cons lists and feature cells (e.g. <a>✅</a> emoji wrappers) are
   never forced into pill buttons. */
.ab-versus-block th a[class*="affiliate-sp-btn"],
.ab-versus-block th a[class*="affiliate-compr-btn"],
.ab-versus-block th .affiliate-sp-inner > a[href],
.ab-versus-block th .affiliate-sp-inner > div > a[href],
.ab-versus-block th .affiliate-sp-content > a[href],
.ab-versus-block a[class*="affiliate-sp-btn"]:not(td a),
.ab-versus-block a[class*="affiliate-compr-btn"]:not(td a),
.ab-versus-block th .affiliate-sp-btn,
.ab-versus-block th .affiliate-sp-btn1,
.ab-versus-block th .affiliate-sp-btn2 {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 200px !important;
    padding: 12px 22px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #fff !important;
    text-align: center !important;
    text-decoration: none !important;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
    border: none !important;
    border-radius: 50px !important;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.28) !important;
    letter-spacing: 0.01em !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    transition: all 0.25s ease !important;
    position: relative !important;
    overflow: hidden !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    min-height: 42px !important;
}

.ab-versus-block th a[class*="affiliate-sp-btn"]:hover,
.ab-versus-block th a[class*="affiliate-compr-btn"]:hover,
.ab-versus-block th .affiliate-sp-inner > a[href]:hover,
.ab-versus-block th .affiliate-sp-inner > div > a[href]:hover,
.ab-versus-block th .affiliate-sp-content > a[href]:hover,
.ab-versus-block th .affiliate-sp-btn:hover,
.ab-versus-block th .affiliate-sp-btn1:hover,
.ab-versus-block th .affiliate-sp-btn2:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4) !important;
    transform: translateY(-1px) !important;
    color: #fff !important;
    text-decoration: none !important;
}

/* Hide empty decorative icons in AB buttons */
.ab-versus-block a i.affiliate-abbtn-icon:empty,
.ab-versus-block a i[class*="af-icon"]:empty,
.ab-versus-block a i.dashicons:empty {
    display: none !important;
}

/* ── Data-cell anchor reset ─────────────────────────────────────────
   Anchors that live inside comparison data cells (pros/cons/features)
   are inline decorations or inline links — NEVER CTA buttons. This
   reset makes sure nothing in this stylesheet (or any overly broad
   selector) accidentally renders them as purple pills. */
.ab-versus-block td a[href],
.ab-versus-block td.affiliate-sp-row3 a[href],
.ab-versus-block .affiliate-compr-conts a[href],
.ab-versus-block td a[class*="affiliate-sp-btn"],
.ab-versus-block td a[class*="affiliate-compr-btn"] {
    display: inline !important;
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    color: inherit !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    width: auto !important;
    min-width: 0 !important;
    font-weight: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    letter-spacing: normal !important;
    text-align: inherit !important;
    text-decoration: underline;
    text-transform: none !important;
    white-space: normal !important;
    gap: 0 !important;
    transform: none !important;
    transition: none !important;
    overflow: visible !important;
    cursor: pointer !important;
}

/* Emoji-only anchors inside data cells should render as plain text
   (no underline at all). We can't detect "emoji-only" in CSS, but
   anchors marked by our JS sanitizer get `data-lwp-icon` so we can
   strip the underline cleanly. The JS sanitizer also unwraps these
   entirely so this rule is mostly a safety net for older content. */
.ab-versus-block td a[href][data-lwp-icon] {
    text-decoration: none !important;
}

/* ── Discount text: "Get X% OFF Now!" — styled pill badge ──────── */
.ab-versus-block th p:not([class*="affiliate-sp-title"]):not([class*="title"]):not(:empty) {
    font-size: 13px;
    font-weight: 700;
    color: #c2410c !important;
    margin: 0 !important;
    padding: 8px 16px;
    line-height: 1.4;
    text-align: center;
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border-radius: 50px;
    border: 1px solid #fed7aa;
    width: auto;
    max-width: 100%;
    align-self: center;
    display: inline-block;
    letter-spacing: 0.01em;
}

.ab-versus-block th p strong,
.ab-versus-block th p b {
    color: #9a3412;
    font-weight: 800;
}

/* Hide stray divider elements AB sometimes injects between sections.
   This is critical — AB's default CSS adds a vertical pipe divider that
   looks odd in our layout. */
.ab-versus-block hr,
.ab-versus-block .affiliate-sp-inner > hr,
.ab-versus-block .affiliate-sp-content > hr,
.ab-versus-block .affiliate-sp-inner::after,
.ab-versus-block .affiliate-sp-inner::before {
    display: none !important;
}

/* AB plugin default adds a vertical-line divider via pseudo-element
   on .affiliate-sp-content in some themes — suppress it */
.ab-versus-block .affiliate-sp-content::before,
.ab-versus-block .affiliate-sp-content::after,
.ab-versus-block div[class*="affiliate-sp-cntn"]::before,
.ab-versus-block div[class*="affiliate-sp-cntn"]::after {
    display: none !important;
    content: none !important;
}

/* ── Row label (first cell of each comparison row) ───────────────── */
.ab-versus-block .affiliate-sp-row3 {
    font-weight: 700 !important;
    color: #0f172a !important;
    text-align: left !important;
    background: #f8fafc !important;
    border-right: 1px solid #e2e8f0;
    font-size: 14px;
    letter-spacing: -0.005em;
    padding-left: 24px !important;
}

.ab-versus-block .affiliate-sp-row3 p {
    margin: 0 !important;
    color: inherit !important;
    font-weight: inherit !important;
}

/* ── Row values (comparison cells) ───────────────────────────────── */
.ab-versus-block td:not(.affiliate-sp-row3) {
    color: #334155;
    font-weight: 500;
}

.ab-versus-block td p {
    margin: 0 !important;
}

/* Hide empty <p> inside <td> — creates phantom gray rectangles otherwise.
   This is the root cause of "empty gray rectangle" in ZonGuru column. */
.ab-versus-block td p:empty,
.ab-versus-block td p > br:only-child,
.ab-versus-block td:empty {
    display: none !important;
}

/* If a <td> contains only whitespace or a single <br>, collapse it */
.ab-versus-block td > p:only-child:empty {
    display: none;
}

/* Neutralize nested container backgrounds in data cells that create
   phantom rectangles — AB sometimes wraps text in styled divs */
.ab-versus-block td > div {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* Ensure data cells have a minimum consistent visual */
.ab-versus-block tbody td {
    min-height: 48px;
}

/* ── Alternating row backgrounds — subtle, modern ────────────────── */
.affiliate-sp-row1,
.ab-versus-block .affiliate-sp-row1 {
    background: #fff;
}

.affiliate-sp-row2,
.ab-versus-block .affiliate-sp-row2 {
    background: #fafbfc;
}

.ab-versus-block tr.affiliate-sp-row1:hover td:not(.affiliate-sp-row3),
.ab-versus-block tr.affiliate-sp-row2:hover td:not(.affiliate-sp-row3) {
    background: #f5f7ff;
    transition: background 0.2s ease;
}

/* ── Responsive: tablet ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .ab-versus-block th,
    .ab-versus-block td {
        padding: 12px 14px;
    }
    .ab-versus-block th {
        padding: 22px 12px;
    }
    .ab-versus-block .affiliate-sp-image,
    .ab-versus-block .affiliate-sp-image1,
    .ab-versus-block div[class*="affiliate-sp-image"] {
        width: 76px;
        height: 76px;
        padding: 8px;
        border-radius: 12px;
    }
    .ab-versus-block .affiliate-sp-image img,
    .ab-versus-block .affiliate-sp-image1 img,
    .ab-versus-block div[class*="affiliate-sp-image"] img {
        max-width: 60px;
        max-height: 60px;
    }
    .ab-versus-block .affiliate-sp-inner > p,
    .ab-versus-block p[class*="affiliate-sp-title"] {
        font-size: 14px;
    }
    .ab-versus-block th a,
    .ab-versus-block .affiliate-sp-inner a {
        padding: 10px 16px !important;
        font-size: 13px !important;
        max-width: none !important;
        min-height: 38px !important;
    }
    .ab-versus-block th p:not([class*="affiliate-sp-title"]):not([class*="title"]) {
        font-size: 12px;
        padding: 4px 10px;
    }
}

/* ── Responsive: mobile ──────────────────────────────────────────── */
@media (max-width: 480px) {
    .ab-versus-block {
        margin: 20px 0;
        border-radius: 12px;
    }
    .ab-versus-block th,
    .ab-versus-block td {
        padding: 10px 10px;
        font-size: 12px;
    }
    .ab-versus-block th:first-child,
    .ab-versus-block .affiliate-sp-row3 {
        width: 90px;
        padding-left: 12px !important;
    }
}

