/*
 * WooPlus Compare — frontend styles.
 *
 * Three surfaces:
 *   1. .wpl-cmp-btn      — inline button on shop loop / single product
 *   2. .wpl-cmp-pill     — fixed bottom-right floating pill with count
 *   3. .wpl-cmp-table    — full comparison page table
 *
 * @since 6.6.4.0
 */

/* ============ Button (loop / single / block) ============ */
.wpl-cmp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
    line-height: 1;
}
.wpl-cmp-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}
.wpl-cmp-btn.is-active {
    background: #eef2ff;
    border-color: #6366f1;
    color: #4f46e5;
}
.wpl-cmp-btn svg { display: inline-block; flex-shrink: 0; }
.wpl-cmp-ctx-loop {
    margin-top: 8px;
    width: 100%;
    justify-content: center;
}
.wpl-cmp-ctx-single { margin-inline-start: 8px; }

/* ============ Floating pill ============ */
.wpl-cmp-pill {
    position: fixed;
    bottom: 24px;
    inset-inline-end: 24px;
    z-index: 9999;
    background: #111827;
    color: #fff;
    border-radius: 999px;
    padding: 10px 14px 10px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,.15);
    font-family: Vazirmatn, system-ui, sans-serif;
    font-size: 13px;
    animation: wpl-cmp-pill-in .25s ease-out;
}
@keyframes wpl-cmp-pill-in {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.wpl-cmp-pill[hidden] { display: none !important; }
.wpl-cmp-pill-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #6366f1;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
}
.wpl-cmp-pill-label { color: #d1d5db; }
.wpl-cmp-pill-open {
    background: #6366f1;
    color: #fff;
    padding: 6px 14px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    transition: background .15s;
}
.wpl-cmp-pill-open:hover { background: #4f46e5; color: #fff; }
.wpl-cmp-pill-clear {
    background: transparent;
    border: 0;
    color: #9ca3af;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0 4px;
}
.wpl-cmp-pill-clear:hover { color: #fff; }

/* ============ Comparison page ============ */
.wpl-cmp-table th, .wpl-cmp-table td {
    vertical-align: middle;
}
.wpl-cmp-table img {
    max-width: 120px;
    margin: 0 auto;
    display: block;
    border-radius: 8px;
}
.wpl-cmp-table tr:hover {
    background: #fafbfc;
}
.wpl-cmp-table .button {
    display: inline-block;
    padding: 6px 14px;
    background: #6366f1;
    color: #fff !important;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
}

/* ============ Toast ============ */
.wpl-cmp-toast {
    position: fixed;
    bottom: 80px;
    inset-inline-end: 24px;
    background: #111827;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    font-family: Vazirmatn, system-ui, sans-serif;
    font-size: 13px;
    z-index: 10000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .2s, transform .2s;
    pointer-events: none;
}
.wpl-cmp-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============ Mobile tweaks ============ */
@media (max-width: 640px) {
    .wpl-cmp-pill {
        bottom: 12px;
        inset-inline-end: 12px;
        font-size: 12px;
        padding: 8px 10px 8px 14px;
    }
    .wpl-cmp-pill-label { display: none; }
    .wpl-cmp-table img { max-width: 80px; }
}

/* ============================================================
   v6.9.15 — Compare page polish
   ============================================================ */

/* Winner cell highlight */
.wpl-cmp-table .wpl-cmp-winner {
    background: #ecfdf5 !important;
    position: relative;
}

/* Stock status colors */
.wpl-cmp-stock-instock     { color: #16a34a; font-weight: 600; }
.wpl-cmp-stock-onbackorder { color: #f59e0b; }
.wpl-cmp-stock-outofstock  { color: #dc2626; }

/* Mobile + tablet — sticky first column for readability while scrolling */
@media ( max-width: 900px ) {
    .wpl-cmp-table-wrap {
        position: relative;
        padding: 8px !important;
    }
    .wpl-cmp-table th:first-child,
    .wpl-cmp-table td:first-child {
        position: sticky;
        inset-inline-start: 0;
        background: #fafafa;
        z-index: 2;
        box-shadow: 2px 0 4px -2px rgba( 0, 0, 0, 0.08 );
    }
    .wpl-cmp-table thead th { font-size: 12px; padding: 6px !important; }
    .wpl-cmp-table tbody th { font-size: 12px !important; padding: 6px !important; }
    .wpl-cmp-table tbody td { font-size: 12px; padding: 6px !important; }
    .wpl-cmp-table tbody td img { max-width: 80px; height: auto; }
    .wpl-cmp-toolbar { font-size: 12px; padding: 8px 10px !important; gap: 6px !important; }
}

/* Print stylesheet — clean comparison view */
@media print {
    body * { visibility: hidden; }
    .wpl-cmp-page, .wpl-cmp-page * { visibility: visible; }
    .wpl-cmp-page {
        position: absolute; top: 0; left: 0;
        width: 100%; max-width: none !important; padding: 0 !important; margin: 0 !important;
    }
    .wpl-cmp-toolbar,
    .wpl-cmp-remove,
    .wpl-cmp-page .button { display: none !important; }
    .wpl-cmp-table { font-size: 11px; }
    .wpl-cmp-table th, .wpl-cmp-table td {
        padding: 6px !important; border: 1px solid #ddd !important;
    }
    .wpl-cmp-table img { max-width: 100px !important; }
    .wpl-cmp-winner { background: #f0fdf4 !important; -webkit-print-color-adjust: exact; }
    @page { margin: 1cm; }
}
