/* ================================================================
   Specification Table Pro — Frontend CSS v5.1
   Professional premium design — GSMArena/PriceOye level quality
   mobilo.pk
   ================================================================ */

/* ── Design tokens (FALLBACK ONLY) ──────────────────────────────
   :where(:root) has ZERO specificity. The PHP-generated <style id=
   "spec-table-native-mode|custom-vars|plugin-vars"> in wp_head uses
   plain :root (specificity 0,1,0,0) and ALWAYS wins over this block,
   regardless of CSS load order. This prevents the plugin's own
   orange (#E84118) from overriding theme-detected colors.          */
:where(:root) {
    --st-accent:        #E84118;
    --st-accent-rgb:    232, 65, 24;
    --st-accent-light:  #fff3f0;
    --st-bg:            #ffffff;
    --st-surface:       #f8f9fa;
    --st-surface2:      #f1f3f5;
    --st-border:        #e9ecef;
    --st-border2:       #dee2e6;
    --st-text:          #212529;
    --st-text2:         #495057;
    --st-muted:         #868e96;
    --st-muted2:        #adb5bd;
    --st-group-bg:      #f1f3f5;
    --st-group-text:    #495057;
    --st-diff-bg:       #fff8f0;
    --st-diff-border:   #fd7e14;
    --st-best-bg:       #f0fff4;
    --st-best-border:   #40c057;
    --st-shadow-sm:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --st-shadow:        0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
    --st-shadow-lg:     0 8px 24px rgba(0,0,0,.12), 0 3px 8px rgba(0,0,0,.06);
    --st-radius:        12px;
    --st-radius-sm:     8px;
    --st-radius-xs:     5px;
    --st-font:          inherit;
    --st-sticky-top:    0px;
    --st-transition:    background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}

/* ── Dark mode ──────────────────────────────────────────────────── */
/* Dark mode auto-switch REMOVED per request — design now uses a single,
   carefully contrast-checked light theme (orange/navy/white) that matches
   the store branding. Users wanting a dark look can configure Custom mode
   with their own colors; we don't auto-flip based on OS preference to
   avoid unexpected contrast issues. */

/* ── Flex gap fallback for Safari < 14.1, Samsung Internet < 14 ──────────
   @supports ensures modern browsers use gap; older browsers get margin.    */
@supports not (gap: 1rem) {
    .spec-tab-bar         > * + * { margin-left: .6rem; }
    .spec-tab-bar-right   > * + * { margin-left: .4rem; }
    .spec-ctrl-bar        > * + * { margin-left: .75rem; }
    .spec-bar-chips       > * + * { margin-left: .4rem; }
    .spec-bar-actions     > * + * { margin-left: .4rem; }
    .spec-filter-bar      > * + * { margin-left: .4rem; }
    .spec-prod-btns       > * + * { margin-top: .35rem; }
    .spec-rec-actions     > * + * { margin-top: .4rem; }
    .spec-summary-highlights > * + * { margin-left: .45rem; margin-bottom: .45rem; }
}



/* ── Dashicons sizing for plugin use ────────────────────────────────
   WordPress Dashicons default to 20px. We scale them to match our UI. */
.spec-single-wrap .dashicons,
.spec-compare-wrap .dashicons,
.spec-summary-highlights .dashicons,
.spec-rec-wrap .dashicons,
#spec-compare-bar .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 16px;
    vertical-align: middle;
    flex-shrink: 0;
}
/* Specific size overrides */
.spec-group-chevron.dashicons    { font-size: 18px; width: 18px; height: 18px; line-height: 18px; transition: transform .22s ease; }
.spec-empty-icon.dashicons       { font-size: 3rem; width: 3rem; height: 3rem; line-height: 3rem; }
.spec-icon-btn .dashicons        { font-size: 15px; width: 15px; height: 15px; line-height: 15px; }
.spec-bar-go .dashicons          { font-size: 15px; width: 15px; height: 15px; line-height: 15px; }
.spec-bar-clear .dashicons       { font-size: 14px; width: 14px; height: 14px; line-height: 14px; }
.spec-ctrl-btn .dashicons        { font-size: 14px; width: 14px; height: 14px; line-height: 14px; }
.spec-chip .dashicons            { font-size: 13px; width: 13px; height: 13px; line-height: 13px; }
.spec-rec-icon .dashicons        { font-size: 22px; width: 22px; height: 22px; line-height: 22px; }
.spec-view-btn .dashicons        { font-size: 14px; width: 14px; height: 14px; line-height: 14px; }
.spec-rm-btn .dashicons          { font-size: 14px; width: 14px; height: 14px; line-height: 14px; }

/* ── Unicode star ratings ────────────────────────────────────────── */
.spec-star-on  { color: #f59e0b; font-size: .85rem; line-height: 1; }
.spec-star-off { color: #d1d5db; font-size: .85rem; line-height: 1; }
.spec-stars    { display: inline-flex; align-items: center; gap: 1px; justify-content: center; margin-top: .2rem; }
.spec-stars-sm { display: inline-flex; align-items: center; gap: 1px; margin-left: .35rem; vertical-align: middle; }

/* Collapsed chevron — works with dashicons span */
.spec-group-block.spec-collapsed .spec-group-chevron { transform: rotate(-90deg); }

/* Diff randomize icon — smaller */
.spec-diff-icon.dashicons { font-size: 12px; width: 12px; height: 12px; color: var(--st-diff-border, #fd7e14); }

/* Highlight pills — Dashicons */
.spec-hl-pill .dashicons { font-size: 14px; width: 14px; height: 14px; line-height: 14px; }

/* ── Global reset scoped to plugin ─────────────────────────────── */
.spec-single-wrap *,
.spec-compare-wrap *,
.spec-summary-highlights *,
.spec-rec-wrap *,
#spec-compare-bar * {
    box-sizing: border-box;
}

/* ── Toast ──────────────────────────────────────────────────────── */
#spec-toast {
    position: fixed;
    bottom: 28px; left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #212529;
    color: #fff;
    padding: .6rem 1.4rem;
    border-radius: 50px;
    font-family: var(--st-font);
    font-size: .84rem;
    font-weight: 500;
    z-index: 999999;
    opacity: 0;
    transition: opacity .25s ease, transform .25s ease;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: var(--st-shadow-lg);
    letter-spacing: .01em;
}
#spec-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ================================================================
   KEY HIGHLIGHTS — Below Short Description
   ================================================================ */
.spec-summary-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin: 1rem 0 1.25rem;
    padding: .9rem 1rem;
    background: linear-gradient(135deg,
        rgba(var(--st-accent-rgb), .04) 0%,
        rgba(var(--st-accent-rgb), .02) 100%);
    border: 1px solid rgba(var(--st-accent-rgb), .15);
    border-left: 4px solid var(--st-accent);
    border-radius: var(--st-radius-sm);
}
.spec-hl-pill {
    display: inline-flex;
    align-items: center;
    gap: .32rem;
    padding: .3rem .75rem;
    border-radius: 50px;
    font-family: var(--st-font);
    font-size: .8rem;
    font-weight: 600;
    line-height: 1;
    background: rgba(var(--st-accent-rgb), .09);
    border: 1px solid rgba(var(--st-accent-rgb), .2);
    color: var(--st-accent);
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
    cursor: default;
}
.spec-hl-pill i {
    font-size: .9rem;
    flex-shrink: 0;
}
.spec-hl-pill:hover {
    background: rgba(var(--st-accent-rgb), .15);
    transform: translateY(-1px);
}

/* ================================================================
   SINGLE PRODUCT — SPECIFICATIONS TAB
   ================================================================ */
.spec-single-wrap {
    font-family: var(--st-font);
    color: var(--st-text);
    max-width: 100%;
}

/* ── Tab action bar ─────────────────────────────────────────────── */
.spec-tab-bar {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    padding: .6rem .75rem;
    background: var(--st-surface);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-sm);
    box-shadow: var(--st-shadow-sm);
}
.spec-tab-bar-left { flex: 1; min-width: 180px; }
.spec-tab-bar-right { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

/* Search box */
.spec-search-box {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .38rem .75rem;
    background: var(--st-bg);
    border: 1.5px solid var(--st-border);
    border-radius: var(--st-radius-xs);
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
}
.spec-search-box:focus-within {
    border-color: var(--st-accent);
    box-shadow: 0 0 0 3px rgba(var(--st-accent-rgb), .12);
    outline: none;
}
.spec-search-box i { font-size: .95rem; color: var(--st-muted2); flex-shrink: 0; }
.spec-search-box input {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: .86rem;
    color: var(--st-text);
    width: 100%;
    min-width: 160px;
    box-shadow: none !important;
    font-family: inherit;
}

/* Icon buttons */
.spec-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border: 1.5px solid var(--st-border);
    border-radius: var(--st-radius-xs);
    background: var(--st-bg);
    color: var(--st-muted);
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
    flex-shrink: 0;
}
.spec-icon-btn i { font-size: 1rem; }
.spec-icon-btn:hover {
    border-color: var(--st-accent);
    color: var(--st-accent);
    background: rgba(var(--st-accent-rgb), .06);
}
.spec-icon-btn:focus-visible {
    outline: 2px solid var(--st-accent);
    outline-offset: 2px;
}

/* ── Spec group blocks ──────────────────────────────────────────── */
.spec-group-block {
    margin-bottom: .75rem;
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-sm);
    overflow: hidden;
    box-shadow: var(--st-shadow-sm);
    transition: box-shadow .2s ease;
}
.spec-group-block:hover {
    box-shadow: var(--st-shadow);
}

/* Group header toggle */
.spec-group-toggle {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .7rem 1rem;
    border: none;
    background: var(--st-group-bg);
    border-bottom: 1px solid var(--st-border);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: background .15s;
    position: relative;
}
.spec-group-toggle::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
    background: var(--st-accent);
    border-radius: 0 2px 2px 0;
    opacity: .7;
}
.spec-group-toggle:hover { background: var(--st-surface2); }
.spec-group-toggle:focus-visible {
    outline: 2px solid var(--st-accent);
    outline-offset: -2px;
}

.spec-g-emoji {
    font-size: 1.1rem;
    flex-shrink: 0;
    line-height: 1;
}
.spec-group-lbl {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--st-group-text);
    flex: 1;
}
.spec-group-count {
    font-size: .7rem;
    font-weight: 600;
    background: rgba(0,0,0,.07);
    color: var(--st-muted);
    padding: .15rem .5rem;
    border-radius: 50px;
    min-width: 24px;
    text-align: center;
}
.spec-group-chevron {
    font-size: 1.05rem;
    color: var(--st-muted);
    transition: transform .25s ease;
    flex-shrink: 0;
}
.spec-group-block.spec-collapsed .spec-group-chevron {
    transform: rotate(-90deg);
}
.spec-group-block.spec-collapsed .spec-group-toggle {
    border-bottom: none;
}

/* Collapse animation — CSS driven, no scrollHeight bugs */
.spec-group-body {
    overflow: hidden;
    max-height: 4000px;
    transition: max-height .3s ease;
}
.spec-group-block.spec-collapsed .spec-group-body {
    max-height: 0;
}

/* ── Spec table ─────────────────────────────────────────────────── */
.spec-single-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--st-bg);
}
.spec-single-table tr {
    transition: background .1s;
}
.spec-single-table tr:nth-child(even) {
    background: rgba(0,0,0,.018);
}
.spec-single-table tr:hover {
    background: rgba(var(--st-accent-rgb), .04) !important;
}
.spec-single-table tr.spec-row-hidden { display: none; }
.spec-single-table tr:last-child td { border-bottom: none; }

.spec-st-label {
    width: 38%;
    padding: .65rem 1rem;
    font-size: .82rem;
    font-weight: 500;
    color: var(--st-muted);
    border-bottom: 1px solid var(--st-border);
    vertical-align: middle;
    line-height: 1.4;
}
.spec-st-value {
    padding: .65rem 1rem;
    font-size: .88rem;
    font-weight: 600;
    color: var(--st-text);
    border-bottom: 1px solid var(--st-border);
    vertical-align: middle;
    line-height: 1.4;
}
.spec-na {
    color: var(--st-muted2);
    font-weight: 400;
}

/* Stars on product page */
.spec-stars-sm {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    margin-left: .45rem;
    vertical-align: middle;
}

.spec-star-on  { color: #f59e0b; }
.spec-star-off { color: var(--st-border2); }

/* ================================================================
   ADD TO COMPARE BUTTON — Premium styled
   ================================================================ */
.spec-compare-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .52rem 1.1rem;
    border: 1.5px solid var(--btn-color, var(--st-accent));
    border-radius: var(--st-radius-xs);
    background: transparent;
    color: var(--btn-color, var(--st-accent));
    font-family: inherit;
    font-size: .84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
    text-decoration: none;
    letter-spacing: .01em;
    position: relative;
    overflow: hidden;
}
.spec-compare-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--btn-color, var(--st-accent));
    opacity: 0;
    transition: opacity .18s;
}
.spec-compare-btn i {
    font-size: .95rem;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.spec-compare-btn .spec-btn-text {
    position: relative;
    z-index: 1;
}
.spec-compare-btn:hover::before,
.spec-compare-btn.spec-active::before {
    opacity: 1;
}
.spec-compare-btn:hover,
.spec-compare-btn.spec-active {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--st-accent-rgb), .35);
}
.spec-compare-btn:focus-visible {
    outline: 2px solid var(--btn-color, var(--st-accent));
    outline-offset: 2px;
}

/* Loop (shop/homepage) compare button wrapper */
.spec-compare-btn-loop-wrap {
    text-align: center;
    margin: .5rem 0 0;
}
.spec-compare-btn-loop {
    display: inline-flex;
    width: -webkit-fit-content;
    width: -moz-fit-content;
    width: fit-content;
    max-width: 100%;
}
.spec-tab-compare-btn {
    font-size: .8rem;
    padding: .38rem .85rem;
    margin-top: 0;
}

/* ================================================================
   FLOATING COMPARE BAR — Premium dark bar
   ================================================================ */
/* ══════════════════════════════════════════════════════════════════════════
   FLOATING COMPARE BAR — Professional cross-browser implementation
   ══════════════════════════════════════════════════════════════════════════
   ZERO transform on position:fixed — this is the definitive fix.

   transform+position:fixed is broken in Firefox/Incognito because:
   · Firefox creates a new compositor layer for transformed elements
   · Any ancestor with transform (Shoptimizer sticky header uses
     transform:translateZ(0)) makes position:fixed children lose their
     viewport-relative positioning — they stack relative to the ancestor
   · Chrome Incognito and Firefox Private Browsing use stricter compositor
     rules that expose this bug even when normal Chrome hides it

   Solution: opacity+visibility transition (zero layout/position side-effects,
   hardware-accelerated on the opacity layer, identical in all browsers).
   Body gets padding-bottom equal to bar height so content is never obscured.
   ══════════════════════════════════════════════════════════════════════════ */

/* Body padding — prevents content hiding behind bar when visible */
body.spec-bar-visible {
    padding-bottom: 62px !important;
    -webkit-transition: padding-bottom .2s ease;
    transition: padding-bottom .2s ease;
}

#spec-compare-bar {
    /* Positioning — NO transform property whatsoever */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 9998;

    /* Appearance */
    background: #1e2329;
    border-top: 2px solid var(--st-accent, #E84118);
    box-shadow: 0 -2px 20px rgba(0,0,0,.25);
    color: #e9ecef;
    font-family: inherit;
    font-size: .9rem;

    /* Layout */
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;           /* No wrap — keeps bar single row at 62px height */
    gap: .75rem;
    padding: 0 1.5rem;
    height: 62px;
    overflow: hidden;

    /* Show/hide — opacity+visibility, NO transform
       opacity is GPU-accelerated and has zero positioning side-effects    */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    -webkit-transition: opacity .22s ease, visibility .22s ease;
    transition: opacity .22s ease, visibility .22s ease;
}
#spec-compare-bar.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ── Bar inner elements ─────────────────────────────────────────── */
.spec-bar-label {
    font-size: .72rem;
    font-weight: 700;
    color: #868e96;
    white-space: nowrap;
    letter-spacing: .06em;
    text-transform: uppercase;
    -webkit-box-flex: 0;
    -ms-flex: none;
    flex: none;
}
.spec-bar-count {
    display: inline-block;
    background: #E84118;
    color: #fff;
    border-radius: 50px;
    font-size: .65rem;
    font-weight: 700;
    padding: .1rem .4rem;
    margin-left: .3rem;
    min-width: 18px;
    text-align: center;
    vertical-align: middle;
}
.spec-bar-chips {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: .4rem;
    -webkit-box-flex: 1;
    -ms-flex: 1 1 auto;
    flex: 1 1 auto;
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: .1rem 0;
}
.spec-bar-chips::-webkit-scrollbar { display: none; }
.spec-bar-chip {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: .32rem;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    padding: .26rem .58rem;
    font-size: .76rem;
    color: #ced4da;
    white-space: nowrap;
    -webkit-box-flex: 0;
    -ms-flex: none;
    flex: none;
    max-width: 155px;
}
.spec-bar-chip img {
    width: 22px;
    height: 22px;
    border-radius: 3px;
    object-fit: cover;
    -webkit-box-flex: 0;
    -ms-flex: none;
    flex: none;
}
.spec-bar-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.spec-bar-rm {
    background: none;
    border: none;
    color: #fa5252;
    cursor: pointer;
    padding: 0;
    -webkit-box-flex: 0;
    -ms-flex: none;
    flex: none;
    line-height: 1;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    opacity: .75;
    margin-left: .15rem;
}
.spec-bar-rm:hover { opacity: 1; }
.spec-bar-rm i { font-size: .82rem; }
.spec-bar-actions {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: .4rem;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-flex: 0;
    -ms-flex: none;
    flex: none;
    margin-left: auto;
    padding-left: .5rem;
}
.spec-bar-go {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: .35rem;
    background: #E84118;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: .46rem 1.1rem;
    font-family: inherit;
    font-size: .83rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: .01em;
    text-decoration: none;
    -webkit-transition: background .15s;
    transition: background .15s;
}
.spec-bar-go:hover { background: #c93812; }
.spec-bar-clear {
    display: -webkit-inline-box;
    display: -ms-inline-flexbox;
    display: inline-flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: .28rem;
    background: transparent;
    border: 1px solid rgba(255,255,255,.18);
    color: #868e96;
    border-radius: 6px;
    padding: .42rem .8rem;
    font-family: inherit;
    font-size: .78rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    -webkit-transition: color .15s, border-color .15s;
    transition: color .15s, border-color .15s;
}
.spec-bar-clear:hover { color: #ced4da; border-color: rgba(255,255,255,.38); }

/* ================================================================
   COMPARE PAGE — Full premium comparison table
   ================================================================ */
.spec-compare-wrap {
    font-family: var(--st-font);
    color: var(--st-text);
    margin: 1.25rem 0;
}

/* Empty state */
.spec-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5rem 2rem;
    background: var(--st-surface);
    border: 2px dashed var(--st-border);
    border-radius: var(--st-radius);
    min-height: 320px;
}
.spec-empty-icon {
    font-size: 3.5rem;
    color: var(--st-muted2);
    margin-bottom: 1rem;
    display: block;
}
.spec-empty-state h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0 0 .5rem;
    color: var(--st-text);
}
.spec-empty-state p { color: var(--st-muted); font-size: .95rem; margin-bottom: 1.5rem; }
.spec-shop-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--st-accent);
    color: #fff !important;
    text-decoration: none !important;
    padding: .65rem 1.5rem;
    border-radius: var(--st-radius-xs);
    font-weight: 600;
    font-size: .9rem;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
    box-shadow: 0 4px 12px rgba(var(--st-accent-rgb), .3);
}
.spec-shop-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(var(--st-accent-rgb), .4);
}

/* Control bar */
.spec-ctrl-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    padding: .75rem 1rem;
    background: var(--st-surface);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-sm);
    margin-bottom: .85rem;
    box-shadow: var(--st-shadow-sm);
}
.spec-ctrl-search {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex: 1;
    min-width: 180px;
    padding: .42rem .8rem;
    background: var(--st-bg);
    border: 1.5px solid var(--st-border);
    border-radius: var(--st-radius-xs);
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
}
.spec-ctrl-search:focus-within {
    border-color: var(--st-accent);
    box-shadow: 0 0 0 3px rgba(var(--st-accent-rgb), .12);
}
.spec-ctrl-search i { font-size: .95rem; color: var(--st-muted2); flex-shrink: 0; }
#spec-table-search {
    border: none !important; outline: none !important;
    background: transparent !important; padding: 0 !important;
    font-size: .86rem; color: var(--st-text); width: 100%;
    box-shadow: none !important; font-family: inherit;
}
.spec-ctrl-toggles { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.spec-ctrl-actions  { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

/* Toggle switch */
.spec-pill-toggle {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    cursor: pointer;
    font-size: .8rem;
    color: var(--st-muted);
    user-select: none;
    white-space: nowrap;
    font-family: inherit;
}
.spec-pill-toggle input { display: none; }
.spec-pt-track {
    position: relative;
    width: 36px; height: 20px;
    background: var(--st-border2);
    border-radius: 10px;
    flex-shrink: 0;
    transition: background .2s;
}
.spec-pt-thumb {
    position: absolute;
    top: 3px; left: 3px;
    width: 14px; height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.spec-pill-toggle input:checked ~ .spec-pt-track {
    background: var(--st-accent);
}
.spec-pill-toggle input:checked ~ .spec-pt-track .spec-pt-thumb {
    transform: translateX(16px);
}

/* Control buttons */
.spec-ctrl-btn {
    display: inline-flex;
    align-items: center;
    gap: .32rem;
    padding: .4rem .85rem;
    border: 1.5px solid var(--st-border);
    border-radius: var(--st-radius-xs);
    background: var(--st-bg);
    color: var(--st-muted);
    font-family: inherit;
    font-size: .78rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
    white-space: nowrap;
    letter-spacing: .01em;
}
.spec-ctrl-btn i { font-size: .9rem; }
.spec-ctrl-btn:hover {
    border-color: var(--st-border2);
    color: var(--st-text);
    background: var(--st-surface);
}
.spec-ctrl-btn:focus-visible {
    outline: 2px solid var(--st-accent);
    outline-offset: 2px;
}
.spec-ctrl-clear {
    color: #fa5252 !important;
    border-color: #ffe0e0 !important;
}
.spec-ctrl-clear:hover {
    background: #fff5f5 !important;
    border-color: #fa5252 !important;
}

/* Filter chips */
.spec-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .85rem;
}
.spec-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .34rem .85rem;
    border-radius: 50px;
    border: 1.5px solid var(--st-border);
    background: var(--st-bg);
    color: var(--st-muted);
    font-family: inherit;
    font-size: .76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
    text-decoration: none;
}
.spec-chip i { font-size: .8rem; }
.spec-chip:hover {
    border-color: var(--st-accent);
    color: var(--st-accent);
    background: rgba(var(--st-accent-rgb), .06);
}
.spec-chip.active {
    background: var(--st-accent);
    color: #fff !important;
    border-color: var(--st-accent);
    box-shadow: 0 2px 8px rgba(var(--st-accent-rgb), .3);
}

/* ── TABLE — Premium comparison layout ──────────────────────────── */
.spec-table-outer {
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    box-shadow: var(--st-shadow);
    overflow: visible;
    position: relative;
    background: var(--st-bg);
}
/* Corner rounding via cells — no overflow:hidden needed */
.spec-table thead tr:first-child th:first-child { border-top-left-radius: var(--st-radius); }
.spec-table thead tr:first-child th:last-child  { border-top-right-radius: var(--st-radius); }
.spec-table tfoot tr:last-child td:first-child   { border-bottom-left-radius: var(--st-radius); }
.spec-table tfoot tr:last-child td:last-child    { border-bottom-right-radius: var(--st-radius); }

.spec-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--st-border2) var(--st-surface);
}
.spec-table-scroll::-webkit-scrollbar { height: 5px; }
.spec-table-scroll::-webkit-scrollbar-track { background: var(--st-surface); }
.spec-table-scroll::-webkit-scrollbar-thumb {
    background: var(--st-border2);
    border-radius: 3px;
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 440px;
    background: var(--st-bg);
    table-layout: fixed;
}

/* Sticky label column */
.spec-sticky-label {
    position: -webkit-sticky; /* iOS Safari < 13 */
    position: sticky;
    left: 0;
    z-index: 4;
    background: var(--st-surface);
}
thead .spec-sticky-label {
    z-index: 8;
    background: var(--st-surface);
}

/* Sticky header row */
thead {
    position: -webkit-sticky;
    position: sticky;
    top: var(--st-sticky-top);
    z-index: 6;
}

/* Label column */
.spec-label-col {
    width: 175px;
    min-width: 140px;
    padding: .65rem 1rem;
    font-size: .76rem;
    font-weight: 600;
    color: var(--st-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    vertical-align: middle;
    border-right: 1px solid var(--st-border);
    border-bottom: 1px solid var(--st-border);
    background: var(--st-surface);
}
.spec-label-text { display: inline; }
.spec-diff-badge {
    display: inline-flex;
    align-items: center;
    margin-left: .3rem;
    vertical-align: middle;
    color: var(--st-diff-border);
    opacity: .8;
}
.spec-diff-badge i { font-size: .78rem; }

/* Product column */
.spec-product-col {
    vertical-align: top;
    padding: 1.25rem .85rem;
    text-align: center;
    border-right: 1px solid var(--st-border);
    background: var(--st-bg);
    position: relative;
    min-width: 165px;
}
.spec-product-col:last-child { border-right: none; }
thead .spec-product-col {
    border-bottom: 2px solid var(--st-border);
    background: var(--st-bg);
}

/* Accent strip on each product column */
.spec-product-col::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent, var(--st-accent));
    border-radius: 0;
}
thead tr:first-child .spec-product-col:first-of-type::before {
    border-radius: 0 var(--st-radius) 0 0;
}

/* Badge */
.spec-badge {
    display: inline-block;
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    padding: .22rem .6rem;
    border-radius: 50px;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

/* Product image */
.spec-prod-img {
    margin: 1.1rem auto .65rem;
    width: 90px; height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.spec-prod-img a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%; height: 100%;
}
.spec-prod-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--st-radius-xs);
    transition: transform .2s ease;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.12));
}
.spec-prod-img img:hover { transform: scale(1.06); }
.spec-no-img {
    width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--st-surface2);
    border-radius: var(--st-radius-xs);
    color: var(--st-muted2);
}
.spec-no-img i { font-size: 2.2rem; }

.spec-prod-name {
    display: block;
    font-size: .88rem;
    font-weight: 700;
    color: var(--st-text) !important;
    text-decoration: none !important;
    line-height: 1.3;
    margin-bottom: .35rem;
    transition: color .15s;
}
.spec-prod-name:hover { color: var(--st-accent) !important; }

.spec-prod-price {
    font-size: 1rem;
    font-weight: 800;
    margin: .3rem 0 .5rem;
    letter-spacing: -.01em;
}
.spec-prod-price ins { text-decoration: none; }

.spec-prod-highlights {
    list-style: none;
    margin: .4rem 0 .6rem;
    padding: 0;
    text-align: left;
    font-size: .75rem;
    color: var(--st-muted);
}
.spec-prod-highlights li {
    display: flex;
    align-items: flex-start;
    gap: .28rem;
    margin-bottom: .22rem;
    line-height: 1.4;
}
.spec-prod-highlights i {
    font-size: .82rem;
    color: var(--st-accent);
    flex-shrink: 0;
    margin-top: .05rem;
}

.spec-prod-btns {
    display: flex;
    flex-direction: column;
    gap: .38rem;
    margin-top: .65rem;
}
.spec-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .32rem;
    color: #fff !important;
    font-size: .79rem;
    font-weight: 600;
    padding: .5rem .85rem;
    border-radius: var(--st-radius-xs);
    text-decoration: none !important;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
    letter-spacing: .01em;
}
.spec-view-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.spec-rm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .28rem;
    background: none;
    border: 1.5px solid #ffe0e0;
    color: #fa5252;
    border-radius: var(--st-radius-xs);
    cursor: pointer;
    font-family: inherit;
    font-size: .74rem;
    font-weight: 500;
    padding: .3rem .65rem;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
}
.spec-rm-btn i { font-size: .82rem; }
.spec-rm-btn:hover {
    background: #fff5f5;
    color: #c0392b;
    border-color: #fa5252;
}

/* Group header rows */
.spec-group-row td,
.spec-group-cell {
    background: linear-gradient(to right, var(--st-surface2), var(--st-surface));
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--st-muted);
    padding: .5rem .9rem;
    border-top: 1px solid var(--st-border);
    border-bottom: 1px solid var(--st-border);
    text-align: left;
    border-left: 3px solid var(--st-accent);
}
.spec-group-row.spec-group-hidden { display: none; }

/* Spec rows */
.spec-spec-row td {
    padding: .62rem .9rem;
    border-bottom: 1px solid var(--st-border);
    vertical-align: middle;
}
.spec-spec-row:nth-child(odd) .spec-value-col,
.spec-spec-row:nth-child(odd) .spec-label-col {
    background: rgba(0,0,0,.013);
}
.spec-spec-row:hover td { background: rgba(var(--st-accent-rgb), .04) !important; }
.spec-spec-row.spec-row-hidden { display: none; }

/* Value column */
.spec-value-col {
    text-align: center;
    font-size: .87rem;
    font-weight: 500;
    color: var(--st-text2);
    border-right: 1px solid var(--st-border);
    background: var(--st-bg);
    transition: background .15s;
}
.spec-value-col:last-child { border-right: none; }
.spec-na { color: var(--st-muted2); font-weight: 400; }
.spec-val { display: block; }

/* Stars in compare */
.spec-stars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    margin-top: .2rem;
}
.spec-stars i { font-size: .76rem; }

/* Best value cell */
.spec-best-val {
    background: var(--st-best-bg) !important;
    border-bottom-color: var(--st-best-border) !important;
}
.spec-best-badge {
    display: inline-flex;
    align-items: center;
    gap: .2rem;
    margin-top: .28rem;
    background: #d3f9d8;
    color: #2b8a3e;
    font-size: .64rem;
    font-weight: 700;
    padding: .12rem .45rem;
    border-radius: 50px;
    letter-spacing: .05em;
}
.spec-best-badge i { font-size: .73rem; }

/* Diff highlight */
.spec-compare-wrap.diff-on .spec-spec-row.spec-is-diff .spec-value-col {
    background: var(--st-diff-bg) !important;
}
.spec-compare-wrap.diff-on .spec-spec-row.spec-is-diff .spec-label-col {
    border-left: 3px solid var(--st-diff-border);
    background: var(--st-diff-bg) !important;
}

/* Diff-only */
.spec-compare-wrap.diff-only .spec-spec-row:not(.spec-is-diff) { display: none; }
.spec-compare-wrap.diff-only .spec-group-row.spec-group-all-same { display: none; }

/* Footer row */
.spec-foot-row td {
    padding: .9rem;
    text-align: center;
    border-top: 2px solid var(--st-border);
    background: var(--st-surface);
}

/* No results */
.spec-no-results {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 2rem;
    color: var(--st-muted);
    font-size: .9rem;
    background: var(--st-surface);
    border-radius: var(--st-radius-sm);
    border: 1px solid var(--st-border);
    margin-top: .75rem;
    font-family: inherit;
}
.spec-no-results i { font-size: 1.3rem; }

/* ================================================================
   SMART RECOMMENDATIONS — Premium card grid
   ================================================================ */
.spec-rec-wrap {
    margin-top: 2.5rem;
    font-family: var(--st-font);
    color: var(--st-text);
}
.spec-rec-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--st-border);
}
.spec-rec-title-block { display: flex; align-items: flex-start; gap: .75rem; }
.spec-rec-icon {
    width: 46px; height: 46px;
    border-radius: var(--st-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
        rgba(var(--st-accent-rgb),.12) 0%,
        rgba(var(--st-accent-rgb),.06) 100%);
    flex-shrink: 0;
    border: 1px solid rgba(var(--st-accent-rgb),.15);
}
.spec-rec-icon i { font-size: 1.45rem; color: var(--st-accent); }
.spec-rec-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 .25rem;
    color: var(--st-text);
}
.spec-rec-sub { font-size: .82rem; color: var(--st-muted); margin: 0; }
.spec-rec-badge-cross {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: rgba(var(--st-accent-rgb),.08);
    border: 1.5px solid rgba(var(--st-accent-rgb),.2);
    color: var(--st-accent);
    font-size: .74rem;
    font-weight: 700;
    padding: .32rem .8rem;
    border-radius: 50px;
    white-space: nowrap;
    align-self: flex-start;
}

/* FIX 8: Grid with flex fallback for browsers without CSS Grid */
.spec-rec-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    gap: 1rem;
}
.spec-rec-grid .spec-rec-card {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 215px;
    flex: 1 1 215px;
    max-width: calc(25% - .75rem);
}
@supports (display: grid) {
    .spec-rec-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    }
    .spec-rec-grid .spec-rec-card {
        max-width: none;
        flex: none;
    }
}

/* Recommendation card */
.spec-rec-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--st-bg);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    padding: 1.1rem .9rem .9rem;
    transition: box-shadow .22s ease, transform .22s ease, border-color .22s ease;
    box-shadow: var(--st-shadow-sm);
    overflow: hidden;
}
.spec-rec-card:hover {
    box-shadow: var(--st-shadow-lg);
    transform: translateY(-3px);
    border-color: rgba(var(--st-accent-rgb),.3);
}
.spec-rec-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--rec-accent, var(--st-accent)), transparent);
    opacity: 0;
    transition: opacity .22s;
}
.spec-rec-card:hover::before { opacity: 1; }

.spec-rec-ribbon {
    position: absolute;
    top: 12px; right: -24px;
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    padding: .22rem 2rem .22rem .6rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    transform: rotate(30deg);
    transform-origin: left top;
    white-space: nowrap;
}
.spec-rec-img-link {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 110px;
    margin-bottom: .7rem;
    text-decoration: none;
}
.spec-rec-img-link img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    border-radius: var(--st-radius-xs);
    transition: transform .22s ease;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.1));
}
.spec-rec-card:hover .spec-rec-img-link img { transform: scale(1.05); }
.spec-rec-no-img {
    width: 80px; height: 80px;
    display: flex; align-items: center; justify-content: center;
    background: var(--st-surface2);
    border-radius: var(--st-radius-sm);
}
.spec-rec-no-img i { font-size: 2rem; color: var(--st-muted2); }

.spec-rec-brand {
    display: block;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--st-muted2);
    margin-bottom: .2rem;
}
.spec-rec-name {
    display: block;
    font-size: .9rem;
    font-weight: 700;
    color: var(--st-text) !important;
    text-decoration: none !important;
    line-height: 1.3;
    margin-bottom: .35rem;
    transition: color .15s;
}
.spec-rec-name:hover { color: var(--rec-accent, var(--st-accent)) !important; }
.spec-rec-price {
    font-size: .95rem;
    font-weight: 800;
    margin-bottom: .6rem;
    letter-spacing: -.01em;
}
.spec-rec-price ins { text-decoration: none; }

.spec-rec-specs {
    list-style: none;
    padding: 0;
    margin: 0 0 .75rem;
    border-top: 1px solid var(--st-border);
    padding-top: .5rem;
    flex: 1;
}
.spec-rec-specs li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: .35rem;
    padding: .22rem 0;
    font-size: .76rem;
    border-bottom: 1px solid var(--st-border);
}
.spec-rec-specs li:last-child { border-bottom: none; }
.spec-rec-spec-label { color: var(--st-muted); flex-shrink: 0; }
.spec-rec-spec-val { font-weight: 600; color: var(--st-text2); text-align: right; }

.spec-rec-actions {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-top: auto;
    padding-top: .5rem;
}
.spec-rec-view {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    color: #fff !important;
    font-size: .8rem;
    font-weight: 600;
    padding: .5rem .85rem;
    border-radius: var(--st-radius-xs);
    text-decoration: none !important;
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
    letter-spacing: .01em;
}
.spec-rec-view:hover { filter: brightness(1.1); transform: translateY(-1px); }
.spec-rec-compare-btn {
    margin-top: 0 !important;
    justify-content: center;
    font-size: .78rem;
    padding: .38rem .7rem;
}

/* ================================================================
   PRINT
   ================================================================ */
@media print {
    #spec-compare-bar, .spec-ctrl-bar, .spec-filter-bar, .spec-tab-bar,
    .spec-prod-btns, .spec-rm-btn, .spec-icon-btn,
    .spec-compare-btn, .spec-rec-actions { display: none !important; }
    .spec-table-scroll { overflow: visible !important; }
    .spec-table-outer  { box-shadow: none !important; border: 1px solid #dee2e6; }
    thead { position: relative !important; }
    .spec-sticky-label { position: relative !important; }
    .spec-product-col::before { display: none; }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
/* ================================================================
   FLUID RESPONSIVE — Complete breakpoint system
   320px  Galaxy A01, budget Androids
   360px  Most common Android small screen
   480px  Large phones portrait
   576px  Large phones / small tablets
   768px  Tablets portrait / small laptops
   900px  Tablets landscape
   1024px iPad / 10" tablets
   1200px Laptops
   ================================================================ */

/* ── 1200px: Large tablets / small laptops ──────────────────────── */
@media (max-width: 1200px) {
    .spec-rec-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    @supports not (display: grid) {
        .spec-rec-grid .spec-rec-card { flex: 1 1 200px; max-width: calc(33.33% - .75rem); }
    }
}

/* ── 1024px: Tablets ────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .spec-rec-grid {
        grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    }
    .spec-label-col { width: 155px; }
    .spec-product-col { min-width: 155px; }
}

/* ── 900px: Tablet landscape ────────────────────────────────────── */
@media (max-width: 900px) {
    .spec-rec-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    }
    @supports not (display: grid) {
        .spec-rec-grid .spec-rec-card { flex: 1 1 170px; max-width: calc(50% - .5rem); }
    }
    .spec-rec-header { flex-direction: column; }
}

/* ── 768px: Tablet portrait ─────────────────────────────────────── */
@media (max-width: 768px) {
    /* Control bar — stack cleanly */
    .spec-ctrl-bar {
        flex-direction: column;
        align-items: stretch;
        gap: .5rem;
    }
    .spec-ctrl-search { min-width: 0; }
    .spec-ctrl-toggles {
        order: 3;
        justify-content: flex-start;
        padding-top: .3rem;
        border-top: 1px solid var(--st-border);
    }
    .spec-ctrl-actions { justify-content: flex-end; }

    /* Tab bar */
    .spec-tab-bar { flex-direction: column; align-items: stretch; gap: .5rem; }
    .spec-tab-bar-left,
    .spec-tab-bar-right { width: 100%; }
    .spec-tab-bar-right { justify-content: flex-end; }
    .spec-search-box input { min-width: 0; }

    /* Single spec table */
    .spec-st-label { width: 44%; font-size: .8rem; padding: .55rem .7rem; }
    .spec-st-value { font-size: .84rem; padding: .55rem .7rem; }
    .spec-group-toggle { padding: .6rem .85rem; }

    /* Compare table */
    .spec-label-col  { width: 115px; min-width: 100px; font-size: .72rem; padding: .5rem .65rem; }
    .spec-product-col { min-width: 145px; padding: 1rem .6rem; }
    .spec-prod-img   { width: 75px; height: 75px; margin: .9rem auto .55rem; }
    .spec-prod-name  { font-size: .84rem; }
    .spec-prod-price { font-size: .88rem; }
    .spec-view-btn   { font-size: .74rem; padding: .44rem .75rem; }
    .spec-group-count { display: none; } /* Save space on mobile */

    /* Filter chips — smaller */
    .spec-filter-bar { gap: .3rem; }
    .spec-chip { font-size: .7rem; padding: .28rem .7rem; letter-spacing: .03em; }

    /* Compare bar — compact on tablet */
    #spec-compare-bar {
        padding: 0 1rem;
        gap: .5rem;
    }
    .spec-bar-label { display: none; } /* Hide label, keep chips + buttons */
    .spec-bar-chips {
        width: 100%;
        max-height: 80px;
        overflow-y: auto;
        overflow-x: hidden;
    }
    .spec-bar-actions {
        width: 100%;
        margin-left: 0;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: .4rem;
    }
    .spec-bar-go,
    .spec-bar-clear { justify-content: center; }

    /* Recommendations */
    .spec-rec-grid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
    @supports not (display: grid) {
        .spec-rec-grid .spec-rec-card { flex: 1 1 calc(50% - .5rem); max-width: calc(50% - .5rem); }
    }
    .spec-rec-img-link { height: 90px; }
}

/* ── 576px: Large phones ────────────────────────────────────────── */
@media (max-width: 576px) {
    /* Highlights — more compact */
    .spec-summary-highlights {
        padding: .7rem .8rem;
        gap: .35rem;
    }
    .spec-hl-pill { font-size: .77rem; padding: .26rem .65rem; }

    /* Spec table groups */
    .spec-group-toggle { padding: .55rem .75rem; gap: .4rem; }
    .spec-g-emoji { font-size: .95rem; }
    .spec-group-lbl { font-size: .74rem; }
    .spec-group-chevron { font-size: .95rem; }

    /* Compare table */
    .spec-label-col  { width: 100px; min-width: 88px; font-size: .7rem; padding: .48rem .55rem; }
    .spec-product-col { min-width: 130px; padding: .85rem .45rem; }
    .spec-prod-img   { width: 65px; height: 65px; margin: .75rem auto .5rem; }
    .spec-prod-name  { font-size: .8rem; }
    .spec-badge      { font-size: .56rem; padding: .18rem .45rem; }
    .spec-prod-highlights { display: none; } /* Hidden at 576px — too crowded */

    /* Compare bar chips — more compact */
    .spec-bar-chip { max-width: 140px; padding: .24rem .5rem; font-size: .74rem; }
    .spec-bar-chip img { width: 20px; height: 20px; }

    /* Control bar actions */
    .spec-ctrl-btn { font-size: .74rem; padding: .35rem .65rem; }
}

/* ── 480px: Standard phones portrait ───────────────────────────── */
@media (max-width: 480px) {
    /* Use auto table layout for better text wrap */
    .spec-table { table-layout: auto; }
    .spec-label-col  { width: 95px; min-width: 82px; font-size: .68rem; padding: .44rem .5rem; }
    .spec-product-col { min-width: 118px; padding: .75rem .4rem; }
    .spec-prod-img   { width: 58px; height: 58px; }
    .spec-prod-name  { font-size: .77rem; }
    .spec-view-btn   { font-size: .68rem; padding: .36rem .55rem; }

    /* Compare bar — ultra compact */
    .spec-bar-chip  { max-width: 110px; font-size: .7rem; }
    .spec-bar-go    { font-size: .76rem; padding: .42rem .8rem; }
    .spec-bar-clear { display: none; }  /* Hide clear on very small screens */

    /* Recommendations — 2 columns */
    .spec-rec-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
    .spec-rec-card  { padding: .85rem .7rem .7rem; }
    .spec-rec-img-link { height: 75px; margin-bottom: .5rem; }
    .spec-rec-name  { font-size: .82rem; }
    .spec-rec-price { font-size: .88rem; }
    .spec-rec-specs { display: none; } /* Too small — hide spec list */
    .spec-rec-view  { font-size: .74rem; padding: .42rem .7rem; }
    .spec-rec-compare-btn { font-size: .72rem; }

    /* Filter chips wrap on 2 rows, smaller */
    .spec-chip { font-size: .67rem; padding: .25rem .6rem; letter-spacing: .02em; }
}

/* ── 360px: Small budget phones (Samsung A01, Redmi 9A) ─────────── */
@media (max-width: 360px) {
    /* Highlights */
    .spec-hl-pill { font-size: .73rem; padding: .22rem .55rem; }
    .spec-hl-pill i { display: none; } /* Icon too crowded — hide at 360px */

    /* Compare table */
    .spec-label-col  { width: 82px; min-width: 75px; font-size: .64rem; padding: .4rem .4rem; }
    .spec-product-col { min-width: 105px; padding: .7rem .35rem; }
    .spec-prod-img   { width: 50px; height: 50px; }
    .spec-prod-name  { font-size: .73rem; }
    .spec-value-col  { font-size: .78rem; }
    .spec-spec-row td { padding: .5rem .4rem; }

    /* Group toggle — ultra compact */
    .spec-g-emoji { display: none; } /* Save width on 360px */
    .spec-group-lbl { font-size: .7rem; }

    /* Compare bar — single column, minimal */
    .spec-bar-chip  { max-width: 90px; }
    .spec-bar-clear { display: none; }

    /* Recommendations — single column */
    .spec-rec-grid { grid-template-columns: 1fr; }

    /* Filter chips — single line scroll */
    .spec-filter-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none;
    }
    .spec-filter-bar::-webkit-scrollbar { display: none; }
    .spec-chip { flex-shrink: 0; font-size: .65rem; }
}

/* ── 320px: Minimum viable — iPhone 5/SE gen1, Galaxy J2 ────────── */
@media (max-width: 320px) {
    .spec-tab-bar { padding: .5rem .6rem; }
    .spec-label-col  { width: 74px; min-width: 68px; font-size: .62rem; padding: .38rem .35rem; }
    .spec-product-col { min-width: 95px; padding: .65rem .3rem; }
    .spec-prod-img   { width: 44px; height: 44px; }
    .spec-prod-name  { font-size: .68rem; }
    .spec-badge      { display: none; }
    .spec-prod-price { font-size: .78rem; }
    .spec-bar-go     { font-size: .78rem; padding: .44rem .9rem; }
    .spec-bar-clear  { font-size: .74rem; padding: .4rem .7rem; }
    #spec-compare-bar { padding: .6rem .75rem; }
}

/* ── Landscape orientation fix for phones ───────────────────────── */
/* Landscape: bar already single-row, no override needed */

/* ================================================================
   PRINT
   ================================================================ */
@media print {
    #spec-compare-bar, .spec-ctrl-bar, .spec-filter-bar, .spec-tab-bar,
    .spec-prod-btns, .spec-rm-btn, .spec-icon-btn,
    .spec-compare-btn, .spec-rec-actions { display: none !important; }
    .spec-table-scroll { overflow: visible !important; }
    .spec-table-outer  { box-shadow: none !important; border: 1px solid #dee2e6; }
    thead { position: relative !important; }
    .spec-sticky-label { position: relative !important; }
    .spec-product-col::before { display: none; }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 900px) {
    .spec-rec-grid { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); }
}
@media (max-width: 768px) {
    .spec-ctrl-bar { gap: .5rem; }
    .spec-ctrl-toggles { order: 3; width: 100%; }
    .spec-label-col { width: 110px; min-width: 95px; font-size: .7rem; padding: .5rem .6rem; }
    .spec-product-col { min-width: 130px; padding: .9rem .5rem; }
    .spec-prod-img { width: 70px; height: 70px; }
    .spec-prod-name { font-size: .82rem; }
    .spec-view-btn { font-size: .72rem; padding: .42rem .7rem; }
    #spec-compare-bar { flex-direction: column; align-items: flex-start; gap: .5rem; padding: .8rem 1rem; }
    .spec-bar-actions { width: 100%; }
    .spec-bar-go, .spec-bar-clear { flex: 1; justify-content: center; }
    .spec-tab-bar { flex-direction: column; align-items: stretch; }
    .spec-tab-bar-left, .spec-tab-bar-right { width: 100%; }
    .spec-st-label { width: 44%; font-size: .8rem; padding: .5rem .65rem; }
    .spec-st-value { font-size: .84rem; padding: .5rem .65rem; }
    .spec-filter-bar { gap: .3rem; }
    .spec-chip { font-size: .7rem; padding: .3rem .7rem; }
    .spec-rec-header { flex-direction: column; }
}
@media (max-width: 480px) {
    .spec-table { table-layout: auto; }
    .spec-label-col { width: 95px; min-width: 80px; font-size: .68rem; padding: .45rem .5rem; }
    .spec-product-col { min-width: 115px; padding: .75rem .4rem; }
    .spec-prod-img { width: 58px; height: 58px; }
    .spec-prod-name { font-size: .78rem; }
    .spec-view-btn { font-size: .68rem; padding: .36rem .55rem; }
    .spec-rec-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 360px) {
    .spec-rec-grid { grid-template-columns: 1fr; }
}
