/* ==========================================
   Global Variables & Reset
   ========================================== */
:root {
    --fcs-sticky-top: 80px;
}

.fcs-comparison-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--fcs-text);
    line-height: 1.5;
}


/* Compare Buttons (Frontend Minimalistic) */
.fcs-compare-btn {
    border: none;
    background: transparent;
    padding: 4px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    box-shadow: none;
    color: #888888;
    transform: none;
}

@media (hover: hover) and (pointer: fine) {
    .fcs-compare-btn:hover {
        background: transparent;
        border-color: transparent;
        color: #00b521;
        transform: none;
        box-shadow: none;
    }
}

.fcs-compare-btn.active {
    background: transparent;
    color: #094F3A;
    border: none;
}

.fcs-compare-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    transition: stroke 0.2s ease;
}

.fcs-compare-btn.active svg {
    stroke: currentColor;
    fill: currentColor;
}


/* ==========================================
   CSS Flex/Grid Responsive Matrix Page
   ========================================== */
.fcs-comparison-matrix-container {
    position: relative;
    width: 100%;
}

.fcs-matrix-nav-track {
    position: absolute;
    top: 50%;
    bottom: 0;
    transform: translateY(-50%);
    width: 44px;
    height: fit-content;
    pointer-events: none;
    z-index: 25;
}

.fcs-matrix-nav-track-prev {
    left: -20px;
}

.fcs-matrix-nav-track-next {
    right: -20px;
}

.fcs-matrix-nav-track-prev .fcs-matrix-nav-btn {
    justify-content: end;
}

.fcs-matrix-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #d20003;
    border: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: start;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
    padding: 0 2px;
    outline: none;
    pointer-events: auto;
}

.fcs-matrix-nav-btn svg {
    width: 24px;
    height: 24px;
}

.fcs-matrix-nav-btn.fcs-disabled,
.fcs-matrix-nav-btn:disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
}

.fcs-comparison-matrix-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 40px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 8px;
}

.fcs-comparison-matrix-wrapper::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.fcs-comparison-matrix-wrapper.fcs-is-draggable {
    cursor: grab;
}

.fcs-comparison-matrix-wrapper.fcs-is-grabbing,
.fcs-sticky-matrix-wrapper.fcs-is-grabbing {
    cursor: grabbing;
    user-select: none;
}

.fcs-comparison-matrix {
    display: grid;
    grid-template-columns: repeat(var(--product-count, 4), minmax(240px, 240px));
    grid-template-rows: repeat(calc(var(--row-count, 10) + 1), auto);
    justify-content: flex-start;
    min-width: 100%;
    box-sizing: border-box;
    column-gap: 16px;
}

.fcs-comparison-product-column {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: 1 / span calc(var(--row-count, 10) + 1);
    width: 100%;
    max-width: 240px;
    padding: 0 12px;
    border: 1px solid #dee2e6;
    background: #ffffff;
}

.fcs-matrix-cell {
    padding: 12px 0;
    gap: 4px;
    font-size: 14px;
    background: #ffffff;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.fcs-comparison-product-column .fcs-matrix-cell.border-top:first-child {
    border-top: none !important;
}

.fcs-matrix-header-cell {
    position: sticky;
    top: 0;
    z-index: 15;
}

.fcs-matrix-header-cell,
.fcs-matrix-value-cell {
    scroll-snap-align: start;
}

.fcs-remove-btn {
    top: 12px;
    right: 0;
    z-index: 6;
    color: #D20002;
    cursor: pointer;
    background: transparent;
}

.fcs-comparison-page .fcs-product-toolbar--top_right {
    top: 48px;
    right: 0;
    z-index: 10;
}

.fcs-matrix-value-cell {
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.fcs-attributes-lable {
    font-weight: 400;
    color: #777777;
}

.fcs-attributes-value {
    color: #333333;
    font-weight: 700;
}

.fcs-attributes-value .custom-price-block {
    min-height: unset;
    flex-direction: row;
    align-items: center;
    gap: 5px;
}

/* Identical & Differences Styling */
.fcs-row-identical.unchecked {
    display: none !important;
}

/* Portrait Image Switcher inside Header Cell */
.fcs-product-image {
    width: 100%;
    max-width: 192px;
    aspect-ratio: 2/3;
    margin-bottom: 12px;
    overflow: hidden;
}

.fcs-product-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.fcs-main-image-display {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.2s ease-in-out;
}

/* Alternate Switcher gallery thumbnails */
.fcs-thumb-selector {
    display: flex;
    justify-content: center;
}

.fcs-thumb-item {
    width: 32px;
    height: 32px;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: all 0.2s ease;
}

.fcs-thumb-item:hover,
.fcs-thumb-item.active {
    border-color: #094F3A;
    transform: scale(1.05);
}


/* Responsive matrix overrides */
@media (max-width: 768px) {
    .fcs-comparison-matrix {
        grid-template-columns: repeat(var(--product-count, 4), 240px);
    }

    .fcs-matrix-cell {
        padding: 12px 0;
        font-size: 14px;
    }

    .fcs-matrix-header-cell {
        padding: 12px 0;
    }

    .fcs-comparison-product-column .card-title a {
        font-size: 16px;
    }
}

/* ==========================================
   Sticky Header for Comparison Products
   (Image & Title Pinned on Vertical Scroll)
   ========================================== */

body.admin-bar {
    --fcs-sticky-top: 112px;
}

@media screen and (max-width: 782px) {
    :root {
        --fcs-sticky-top: 63px;
    }
}

.fcs-comparison-sticky-header {
    position: fixed;
    top: var(--fcs-sticky-top, 80px);
    left: var(--fcs-sticky-left, 0px);
    width: var(--fcs-sticky-width, 100%);
    max-width: var(--fcs-sticky-max-width, 100%);
    z-index: 22;
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.2s ease;
    box-sizing: border-box;
}

.fcs-comparison-sticky-header.fcs-is-active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.fcs-sticky-matrix-wrapper {
    position: relative;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 0;
}

.fcs-sticky-matrix-wrapper.fcs-is-draggable {
    cursor: grab;
}

.fcs-sticky-matrix-wrapper::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.fcs-sticky-matrix {
    display: grid;
    grid-template-columns: repeat(var(--product-count, 4), minmax(240px, 240px));
    column-gap: 16px;
    justify-content: flex-start;
    min-width: 100%;
    box-sizing: border-box;
}

.fcs-sticky-product-column {
    width: 100%;
    max-width: 240px;
    min-width: 240px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #dee2e6;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

.fcs-sticky-product-column:hover {
    background: #fdfdfd;
}

.fcs-sticky-product-image {
    width: 44px;
    height: auto;
    min-width: 44px;
    aspect-ratio: 2/3;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    padding: 2px;
    box-sizing: border-box;
}

.fcs-sticky-image-display {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.15s ease;
}

.fcs-sticky-card-title {
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    margin: 0 !important;
    color: #222222;
    flex: 1;
    min-width: 0;
}

.fcs-sticky-card-title a {
    color: #094f3a !important;
    text-decoration: none !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    transition: color 0.15s ease;
}

.fcs-sticky-card-title a:hover {
    color: var(--fcs-primary, #094F3A) !important;
}

@media (max-width: 768px) {
    .fcs-sticky-matrix {
        grid-template-columns: repeat(var(--product-count, 4), 240px);
    }
}