/**
 * Perfecto — Compare Products Page Styles
 * Uses theme CSS variables for full color/font/radius compliance.
 *
 * @package Perfecto
 * @since   1.2.0
 */

/* NOTE: body background is intentionally NOT set here.
   Controlled by Theme Options → page_bg_color via perfecto_theme_color_vars(). */
.pf-cmp-page {
    padding: 36px 0 80px;
    min-height: 70vh;
    background: transparent;
}

/* Hide the floating compare bar on the compare page itself */
.pf-compare-bar { display: none !important; }

/* ── Header bar ──────────────────────────────────────────────────────────── */
.pf-cmp-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding: 18px 22px;
    background: var(--pf-white);
    border-radius: var(--pf-radius-md);
    border: 1px solid var(--pf-border);
    box-shadow: var(--pf-shadow-sm);
}

.pf-cmp-topbar h1 {
    font-size: 21px;
    font-weight: 800;
    color: var(--pf-dark);
    margin: 0 0 2px;
    font-family: var(--pf-font-heading, var(--pf-font));
}

.pf-cmp-topbar p {
    font-size: 13px;
    color: var(--pf-muted);
    margin: 0;
}

.pf-cmp-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Utility buttons ─────────────────────────────────────────────────────── */
.pf-cmp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--pf-radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--pf-transition);
    border: 1.5px solid var(--pf-gray-200);
    background: var(--pf-white);
    color: var(--pf-gray-700);
    font-family: var(--pf-font);
}

.pf-cmp-btn:hover {
    border-color: var(--pf-primary);
    color: var(--pf-dark);
}

.pf-cmp-btn--danger {
    background: var(--pf-accent-light);
    color: var(--pf-danger);
    border-color: var(--pf-accent-border);
}

.pf-cmp-btn--danger:hover {
    background: var(--pf-wishlist-light);
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.pf-cmp-empty {
    text-align: center;
    padding: 100px 20px;
    background: var(--pf-white);
    border-radius: var(--pf-radius-lg);
    border: 1px solid var(--pf-border);
}

.pf-cmp-empty h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--pf-dark);
    margin: 16px 0 8px;
    font-family: var(--pf-font-heading, var(--pf-font));
}

.pf-cmp-empty p {
    font-size: 15px;
    color: var(--pf-muted);
    margin: 0 0 24px;
}

.pf-cmp-shop-btn {
    display: inline-flex;
    align-items: center;
    background: var(--pf-primary);
    color: var(--pf-white);
    font-size: 14px;
    font-weight: 700;
    padding: 13px 30px;
    border-radius: var(--pf-btn-radius);
    text-decoration: none;
    transition: all var(--pf-transition);
}

.pf-cmp-shop-btn:hover {
    background: var(--pf-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--pf-shadow);
}

/* ── Table container ─────────────────────────────────────────────────────── */
.pf-cmp-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--pf-radius-lg);
    border: 1px solid var(--pf-border);
    background: var(--pf-white);
    box-shadow: var(--pf-shadow-sm);
}

.pf-cmp-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 540px;
}

/* ── Label column ────────────────────────────────────────────────────────── */
.pf-cmp-lbl {
    width: 148px;
    min-width: 130px;
    padding: 14px 18px;
    font-size: 11px;
    font-weight: 700;
    color: var(--pf-gray-400);
    background: var(--pf-gray-50);
    border-right: 1px solid var(--pf-gray-200);
    border-bottom: 1px solid var(--pf-gray-100);
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.pf-cmp-table thead .pf-cmp-lbl {
    border-bottom: 2px solid var(--pf-gray-200);
}

.pf-cmp-table tbody tr:last-child .pf-cmp-lbl {
    border-bottom: none;
}

/* ── Product header cells ────────────────────────────────────────────────── */
.pf-cmp-product-th {
    padding: 22px 16px 18px;
    text-align: center;
    vertical-align: top;
    border-right: 1px solid var(--pf-gray-100);
    border-bottom: 2px solid var(--pf-gray-200);
    position: relative;
    min-width: 200px;
}

.pf-cmp-product-th:last-child { border-right: none; }

/* Remove × button */
.pf-cmp-remove {
    position: absolute;
    top: 10px; right: 10px;
    width: 26px; height: 26px;
    background: var(--pf-gray-100);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--pf-transition);
    padding: 0;
}

.pf-cmp-remove:hover { background: var(--pf-danger); }
.pf-cmp-remove:hover svg { stroke: var(--pf-white) !important; }

/* Product image */
.pf-cmp-img-link {
    display: block;
    margin-bottom: 10px;
    overflow: hidden;
    border-radius: var(--pf-radius);
}

.pf-cmp-img {
    width: 350px; height: 350px;
    object-fit: cover;
    display: block;
    margin: 0 auto;
    transition: transform 0.3s ease;
}

.pf-cmp-img-link:hover .pf-cmp-img { transform: scale(1.04); }

.pf-cmp-product-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--pf-dark);
    margin: 8px 0 0;
    line-height: 1.35;
}

.pf-cmp-product-name a            { color: inherit; text-decoration: none; }
.pf-cmp-product-name a:hover      { color: var(--pf-accent); }

/* ── Value cells ─────────────────────────────────────────────────────────── */
.pf-cmp-val {
    padding: 14px 16px;
    font-size: 13.5px;
    color: var(--pf-gray-700);
    border-right: 1px solid var(--pf-gray-100);
    border-bottom: 1px solid var(--pf-gray-100);
    vertical-align: middle;
    text-align: center;
}

.pf-cmp-val:last-child                            { border-right: none; }
.pf-cmp-table tbody tr:last-child .pf-cmp-val    { border-bottom: none; }
.pf-cmp-table tbody tr:nth-child(even) .pf-cmp-val { background: var(--pf-gray-50); }

/* ── Rating stars ────────────────────────────────────────────────────────── */
.pf-cmp-stars { display: inline-flex; align-items: center; gap: 2px; }
.pf-cmp-rcount { font-size: 11px; color: var(--pf-gray-400); margin-left: 4px; }

/* ── Price ───────────────────────────────────────────────────────────────── */
.pf-cmp-val--price .price { font-weight: 800; color: var(--pf-dark); }

.pf-cmp-val--price del,
.pf-cmp-val--price del .woocommerce-Price-amount {
    color: var(--pf-gray-400) !important;
    text-decoration: line-through;
    font-size: 12px !important;
    font-weight: 400 !important;
    display: block;
}

.pf-cmp-val--price ins,
.pf-cmp-val--price ins .woocommerce-Price-amount {
    text-decoration: none !important;
    background: none !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    color: var(--pf-dark) !important;
    display: block;
}

/* ── Stock pill ──────────────────────────────────────────────────────────── */
.pf-cmp-stock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 99px;
}

.pf-cmp-stock--in  { background: var(--pf-green-light); color: #065f46; }
.pf-cmp-stock--out { background: var(--pf-accent-light); color: #991b1b; }

.pf-cmp-stock-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.pf-cmp-stock--in  .pf-cmp-stock-dot { background: var(--pf-success); }
.pf-cmp-stock--out .pf-cmp-stock-dot { background: var(--pf-danger); }

/* ── Description ─────────────────────────────────────────────────────────── */
.pf-cmp-val--desc { text-align: left; font-size: 13px; color: var(--pf-muted); line-height: 1.6; }

/* ── N/A placeholder ─────────────────────────────────────────────────────── */
.pf-cmp-na { color: var(--pf-gray-200); font-size: 22px; font-weight: 200; }

/* ── Action row ──────────────────────────────────────────────────────────── */
.pf-cmp-val--atc { padding: 18px 14px; }
.pf-cmp-actions  { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.pf-cmp-atc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%; max-width: 190px;
    background: var(--pf-btn-atc-bg);
    color: var(--pf-btn-atc-text);
    border: none;
    border-radius: var(--pf-radius-sm);
    padding: 11px 14px;
    font-size: 12px; font-weight: 700;
    cursor: pointer;
    transition: all var(--pf-transition);
    text-transform: uppercase;
    letter-spacing: .4px;
    font-family: var(--pf-font);
}

.pf-cmp-atc-btn:hover {
    background: var(--pf-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--pf-shadow);
}

.pf-cmp-atc-btn.loading { opacity: .6; pointer-events: none; }
.pf-cmp-atc-btn.added   { background: var(--pf-green); pointer-events: none; }

.pf-cmp-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%; max-width: 190px;
    background: var(--pf-primary);
    color: var(--pf-white);
    border-radius: var(--pf-radius-sm);
    padding: 11px 14px;
    font-size: 12px; font-weight: 700;
    text-decoration: none;
    transition: all var(--pf-transition);
    text-transform: uppercase;
}

.pf-cmp-view-btn:hover { background: var(--pf-primary-hover); }

.pf-cmp-full-link {
    font-size: 12px;
    color: var(--pf-gray-400);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--pf-transition);
}

.pf-cmp-full-link:hover { color: var(--pf-dark); text-decoration: underline; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 900px) {
    .pf-cmp-img            { width: 160px; height: 160px; }
    .pf-cmp-product-th     { min-width: 160px; }
}

/* Mobile */
@media (max-width: 640px) {

    /* Page padding */
    .pf-cmp-page           { padding: 16px 0 60px; }

    /* Topbar — stack vertically, tighten up */
    .pf-cmp-topbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
        gap: 10px;
        margin-bottom: 16px;
    }
    .pf-cmp-topbar h1      { font-size: 17px; }
    .pf-cmp-topbar-right   { width: 100%; }
    .pf-cmp-btn            { flex: 1; justify-content: center; padding: 9px 12px; font-size: 12px; }

    /* Table scroll container — remove side borders that cause visual bleed */
    .pf-cmp-table-scroll {
        border-left: none;
        border-right: none;
        border-radius: 0;
        margin: 0 -20px;
        width: calc(100% + 40px);
    }

    /* Table itself */
    .pf-cmp-table          { min-width: 0; }

    /* Label column — narrow + sticky so it stays visible while scrolling */
    .pf-cmp-lbl {
        width: 86px;
        min-width: 80px;
        padding: 12px 10px;
        font-size: 10px;
        position: sticky;
        left: 0;
        z-index: 2;
        background: var(--pf-gray-50);
        box-shadow: 2px 0 6px rgba(0,0,0,0.06);
    }

    /* Product header cells */
    .pf-cmp-product-th {
        min-width: 130px;
        max-width: 150px;
        padding: 14px 8px 12px;
    }

    /* Product image — small on mobile */
    .pf-cmp-img            { width: 90px; height: 90px; }

    /* Product name */
    .pf-cmp-product-name   { font-size: 12px; }

    /* Value cells */
    .pf-cmp-val            { padding: 10px 8px; font-size: 12px; }
    .pf-cmp-val--desc      { font-size: 11px; }

    /* Action buttons */
    .pf-cmp-atc-btn,
    .pf-cmp-view-btn       { max-width: 100%; font-size: 11px; padding: 9px 10px; }

    /* Price */
    .pf-cmp-val--price ins .woocommerce-Price-amount { font-size: 14px !important; }

    /* Remove button — smaller */
    .pf-cmp-remove         { width: 22px; height: 22px; top: 6px; right: 6px; }

    /* Stars */
    .pf-cmp-stars svg      { width: 11px; height: 11px; }

    /* Empty state */
    .pf-cmp-empty          { padding: 60px 20px; }
    .pf-cmp-empty h2       { font-size: 18px; }
}