/**
 * Compare Page & Components Stylesheet
 * 
 * Purpose: Styles the hybrid compare list overlays, tables, controls, and premium sticky column scroll layouts on mobile screen sizes.
 * Pages using it: All pages (header badge, product cards), Compare page, My Account Dashboard (preview widget).
 * Dependencies: base/variables.css, base/typography.css
 * Last updated: July 14, 2026
 */

/* Compare Button Overlay on Product Cards (Default) */
.wpr-compare-btn {
    position: absolute;
    top: var(--wpr-spacing-xs);
    left: var(--wpr-spacing-xs);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--wpr-color-white);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    color: var(--wpr-color-black);
    padding: 0;
    font-size: 15px;
    z-index: 3;
    cursor: pointer;
    transition: var(--wpr-transition-smooth);
}

.wpr-compare-btn:hover,
.wpr-compare-btn.active {
    background-color: var(--wpr-color-white);
    color: var(--wpr-color-accent);
}

/* Compare Button Overlay on Product Cards (Redesigned Hover Fade-in) */
.wpr-compare-btn {
    position: absolute;
    top: 45px;
    right: 10px;
    left: auto; /* Reset default left position */
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--wpr-color-gray-light);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: var(--wpr-color-gray-medium);
    transition: var(--wpr-transition-smooth);
    z-index: 4;
    opacity: 0;
}

.wpr-product-card:hover .wpr-compare-btn {
    opacity: 1;
}

.wpr-compare-btn:hover,
.wpr-compare-btn.active {
    background: var(--wpr-color-black);
    color: #fff;
    border-color: var(--wpr-color-black);
}

/* Single Product Details Action Row Compare Button override */
.wpr-action-buttons-row .wpr-compare-btn {
    position: static !important;
    opacity: 1 !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    background: none !important;
    border: 1px solid #d9d9d9 !important;
    padding: 14px 18px !important;
    cursor: pointer !important;
    color: #111111 !important;
    font-size: 15px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: var(--wpr-transition-smooth) !important;
    box-shadow: none !important;
}

.wpr-action-buttons-row .wpr-compare-btn:hover,
.wpr-action-buttons-row .wpr-compare-btn.active {
    background-color: var(--wpr-color-black) !important;
    color: var(--wpr-color-white) !important;
    border-color: var(--wpr-color-black) !important;
}

/* Compare Layout Tables & Controls */
.wpr-compare-table th {
    font-family: var(--wpr-font-heading);
    color: var(--wpr-color-black);
}

.wpr-compare-table td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--wpr-color-gray-light);
}

.wpr-compare-table tr:hover td {
    background-color: #fbfbfb;
}

.wpr-compare-remove-btn:hover {
    color: var(--wpr-color-accent) !important;
}

/* Compare Mobile & Responsive Layouts */
@media screen and (max-width: 768px) {
    /* Hide compare header icons on mobile screen widths */
    .wpr-compare-icon {
        display: none !important;
    }
}

@media screen and (max-width: 767px) {
    .wpr-compare-table-wrapper {
        margin: 0 -20px !important;
    }
}

@media (max-width: 480px) {
    .wpr-action-buttons-row .wpr-compare-btn {
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .wpr-compare-table td:first-child,
    .wpr-compare-table th:first-child {
        width: 95px !important;
        min-width: 95px !important;
        font-size: 11px !important;
        padding: 8px 6px !important;
    }
}

/* Premium Mobile Compare Table Horizontal Scrolling & Sticky First Column */
@media (max-width: 768px) {
    .wpr-compare-table-wrapper {
        position: relative;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .wpr-compare-table {
        min-width: 750px !important;
        table-layout: fixed;
    }
    .wpr-compare-table td:first-child,
    .wpr-compare-table th:first-child {
        position: -webkit-sticky;
        position: sticky;
        left: 0;
        z-index: 10;
        background-color: var(--wpr-color-bg-light) !important;
        border-right: 2px solid var(--wpr-color-gray-light);
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
        font-weight: 700;
        width: 130px !important;
        min-width: 130px !important;
    }
    .wpr-compare-table td,
    .wpr-compare-table th {
        padding: 10px 12px !important;
        font-size: 12px !important;
        word-wrap: break-word;
        white-space: normal;
    }
    .wpr-compare-image-wrap {
        height: 120px !important;
    }
}

/* Compare Empty State CTA Button Polish */
.wpr-compare-empty-state .wpr-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    max-width: fit-content !important;
    padding: 14px 36px !important;
    margin: 20px auto 0 auto !important;
    text-align: center !important;
    white-space: nowrap !important;
}

/* ==========================================================================
   PREMIUM PRODUCT-PAGE COMPARE MODAL STYLES
   ========================================================================== */
body.wpr-modal-open {
    overflow: hidden !important;
}

.wpr-compare-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.wpr-compare-modal-box {
    background-color: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 960px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: wprModalPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes wprModalPopIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(15px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.wpr-compare-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #eeeeee;
    background-color: #ffffff;
}

.wpr-compare-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #111111;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wpr-compare-modal-title i {
    color: var(--wpr-color-accent);
}

.wpr-compare-modal-subtitle {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: #666666;
}

.wpr-compare-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #888888;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    transition: color 0.2s;
}

.wpr-compare-modal-close:hover {
    color: #111111;
}

.wpr-compare-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background-color: #fafafa;
}

/* Loading Spinner */
.wpr-compare-loading-spinner {
    text-align: center;
    padding: 60px 20px;
    color: #666666;
}

.wpr-compare-loading-spinner i {
    font-size: 32px;
    color: var(--wpr-color-accent);
    margin-bottom: 14px;
}

/* Selection Cards Grid / Scroll */
.wpr-compare-cards-scroll-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.wpr-compare-select-card {
    background-color: #ffffff;
    border: 2px solid #e5e5e5;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wpr-compare-select-card:hover {
    border-color: #bbbbbb;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.wpr-compare-select-card.selected {
    border-color: var(--wpr-color-accent);
    background-color: #fff9fa;
}

.wpr-compare-select-card.current-prod-card {
    border-color: #111111;
    cursor: default;
    background-color: #ffffff;
}

.wpr-compare-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #111111;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 2;
}

.wpr-compare-card-thumb {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
    border-radius: 6px;
    background-color: #f5f5f5;
}

.wpr-compare-card-thumb img {
    max-height: 100%;
    width: auto;
    object-fit: contain;
}

.wpr-compare-card-brand {
    font-size: 11px;
    text-transform: uppercase;
    color: #888888;
    margin-bottom: 4px;
}

.wpr-compare-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #111111;
    line-height: 1.4;
    margin: 0 0 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 38px;
}

.wpr-compare-card-price {
    font-size: 14px;
    font-weight: 700;
    color: #111111;
    margin-bottom: 12px;
}

.wpr-compare-card-check {
    margin-top: auto;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    background-color: #f0f0f0;
    color: #444444;
    transition: all 0.2s ease;
}

.wpr-compare-select-card.selected .wpr-compare-card-check {
    background-color: var(--wpr-color-accent);
    color: #ffffff;
}

.wpr-compare-select-card.current-prod-card .wpr-compare-card-check {
    background-color: #111111;
    color: #ffffff;
}

/* Modal Footer Action Row */
.wpr-compare-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid #eeeeee;
    background-color: #ffffff;
}

.wpr-compare-selection-count {
    font-size: 13px;
    color: #555555;
}

.wpr-compare-footer-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wpr-compare-submit-btn {
    background-color: var(--wpr-color-accent) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    cursor: pointer;
    transition: opacity 0.2s;
}

.wpr-compare-submit-btn:hover {
    opacity: 0.9;
}

/* Comparison Matrix Styling */
.wpr-compare-matrix-wrap {
    overflow-x: auto;
    background-color: #ffffff;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.wpr-compare-matrix-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 650px;
}

.wpr-compare-matrix-table th,
.wpr-compare-matrix-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid #eeeeee;
    border-right: 1px solid #eeeeee;
    vertical-align: top;
    font-size: 13px;
}

.wpr-compare-matrix-table th:last-child,
.wpr-compare-matrix-table td:last-child {
    border-right: none;
}

.wpr-matrix-label-col,
.wpr-matrix-label-cell {
    width: 160px;
    min-width: 160px;
    background-color: #f9f9f9;
    font-weight: 700;
    color: #333333;
    font-size: 12px;
    text-transform: uppercase;
}

.wpr-matrix-prod-header {
    width: 25%;
    background-color: #ffffff;
}

.wpr-matrix-prod-header.wpr-matrix-current-col {
    background-color: #fffafb;
}

.wpr-matrix-prod-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.wpr-matrix-current-badge {
    display: inline-block;
    background-color: #111111;
    color: #ffffff;
    font-size: 9px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.wpr-matrix-remove-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: #f0f0f0;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: #666666;
    transition: all 0.2s;
}

.wpr-matrix-remove-btn:hover {
    background: var(--wpr-color-accent);
    color: #ffffff;
}

.wpr-matrix-thumb {
    width: 100px;
    height: 100px;
    margin-bottom: 10px;
}

.wpr-matrix-thumb img {
    max-height: 100%;
    width: auto;
    object-fit: contain;
}

.wpr-matrix-title {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.wpr-matrix-title a {
    color: #111111;
    text-decoration: none;
}

.wpr-matrix-price {
    font-size: 14px;
    font-weight: 700;
    color: #111111;
    margin-bottom: 10px;
}

.wpr-matrix-add-cart-btn,
.wpr-matrix-select-options-btn {
    font-size: 11px !important;
    padding: 8px 14px !important;
    width: 100% !important;
    text-align: center !important;
}

.wpr-stock-in {
    color: #2e7d32;
    font-weight: 600;
}

.wpr-stock-out {
    color: #c62828;
    font-weight: 600;
}

/* Mobile Bottom Sheet Responsive Layout */
@media (max-width: 767px) {
    .wpr-compare-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .wpr-compare-modal-box {
        max-width: 100%;
        max-height: 88vh;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
    }

    .wpr-compare-cards-scroll-container {
        display: flex;
        overflow-x: auto;
        padding-bottom: 12px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .wpr-compare-select-card {
        min-width: 200px;
        max-width: 200px;
        scroll-snap-align: start;
        flex-shrink: 0;
    }

    .wpr-compare-modal-footer {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .wpr-compare-selection-count {
        text-align: center;
    }

    .wpr-compare-footer-right {
        flex-direction: column;
        width: 100%;
    }

    .wpr-compare-submit-btn,
    #wpr-compare-back-btn {
        width: 100% !important;
        text-align: center;
    }
}

