/* ===== Nút "So sánh" dạng viên thuốc (pill) - dùng chung cho trang chi tiết
   sản phẩm và lưới sản phẩm. Cả 2 trạng thái đều nền trắng + viền xanh nhạt,
   CHỈ đổi icon (dấu cộng -> dấu tick) khi đã chọn, không đổi màu nền. ===== */
.sbuy-compare-btn-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #cfe2f3;
    border-radius: 999px;
    color: #2f7fd1;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.sbuy-compare-btn-pill:hover {
    border-color: #2f7fd1;
    background: #f3f9fe;
}

.sbuy-compare-btn-pill.sbuy-compare-active {
    border-color: #2f7fd1;
    background: #f3f9fe;
}

.sbuy-compare-btn-pill .sbuy-compare-icon {
    display: flex;
    flex: 0 0 auto;
}

.sbuy-compare-btn-pill .sbuy-compare-icon svg {
    display: block;
}

.sbuy-compare-btn-pill .sbuy-compare-label {
    font-weight: 500;
}

/* ===== Nút "So sánh" trong trang chi tiết sản phẩm (dưới nút Add to cart) ===== */
.sbuy-compare-single-wrap {
    margin: 12px 0 0;
}

.sbuy-compare-btn-single {
    padding: 9px 18px;
    font-size: 14px;
}

/* ===== Nút "So sánh" trong lưới sản phẩm (trang Shop/Category) =====
   Nằm cùng 1 hàng, sát bên phải giá sản phẩm - đúng vị trí quen thuộc cho các
   hành động phụ (so sánh, yêu thích...) trong lưới sản phẩm WooCommerce. */

.sbuy-compare-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

/* Giá chiếm phần còn lại, không bị đẩy xuống dòng nếu tên tiền tệ dài */
.sbuy-compare-price-row > .price {
    flex: 1 1 auto;
    min-width: 0;
}

.sbuy-compare-btn-loop {
    flex: 0 0 auto;
    padding: 5px 12px;
    font-size: 12.5px;
}

/* ===== Đảm bảo nút không bị tràn trong khung Quick View popup (Flatsome, hẹp hơn trang single) ===== */
.mfp-content .sbuy-compare-single-wrap,
.quick-view .sbuy-compare-single-wrap,
.quick-view-modal .sbuy-compare-single-wrap {
    margin: 10px 0 0;
}

/* ===== Thanh nổi cố định dưới màn hình ===== */
.sbuy-compare-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: -80px;
    z-index: 9999;
    background: #1d2327;
    color: #fff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
    transition: bottom 0.3s ease;
}

.sbuy-compare-bar.is-visible {
    bottom: 0;
}

.sbuy-compare-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding: 14px 20px;
    flex-wrap: wrap;
}

.sbuy-compare-bar-text {
    margin-right: auto;
    font-size: 14px;
    font-weight: 600;
}

.sbuy-compare-bar-clear,
.sbuy-compare-bar-view {
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.sbuy-compare-bar-clear {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
}

.sbuy-compare-bar-view {
    background: #2271b1;
    color: #fff;
}

.sbuy-compare-bar-view:hover {
    background: #135e96;
    color: #fff;
}

.sbuy-compare-bar-view.is-active {
    background: #444;
}

/* ===== Panel mở rộng chứa bảng so sánh, nằm phía trên thanh nổi ===== */
.sbuy-compare-panel {
    max-height: 0;
    overflow: hidden;
    background: #fff;
    color: #222;
    transition: max-height 0.3s ease;
}

.sbuy-compare-panel.is-open {
    max-height: 70vh;
    overflow-y: auto;
    border-bottom: 1px solid #e5e5e5;
}

.sbuy-compare-panel-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px;
}

.sbuy-compare-panel-loading {
    padding: 30px;
    text-align: center;
    color: #777;
    font-size: 14px;
}

/* ===== Bảng so sánh ===== */
.sbuy-compare-wrapper {
    overflow-x: auto;
    margin: 20px 0;
}

.sbuy-compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    background: #fff;
}

.sbuy-compare-table th,
.sbuy-compare-table td {
    border: 1px solid #e5e5e5;
    padding: 12px 14px;
    text-align: center;
    vertical-align: middle;
    font-size: 14px;
}

.sbuy-compare-label-col {
    text-align: left !important;
    font-weight: 600;
    background: #fafafa;
    white-space: nowrap;
    min-width: 140px;
}

.sbuy-compare-product-col {
    position: relative;
    min-width: 180px;
}

.sbuy-compare-product-col img {
    max-width: 100px;
    height: auto;
    display: block;
    margin: 0 auto 8px;
}

.sbuy-compare-product-name {
    display: block;
    font-weight: 600;
    color: #222;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.4;
}

.sbuy-compare-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: #888;
}

.sbuy-compare-remove:hover {
    background: #d63638;
    color: #fff;
    border-color: #d63638;
}

.sbuy-compare-row-attr td {
    color: #444;
}

.sbuy-compare-cell-text {
    text-align: left !important;
    white-space: normal;
    max-width: 220px;
    font-size: 13px;
    line-height: 1.5;
    color: #555;
}

.sbuy-compare-unavailable {
    color: #d63638;
    font-size: 13px;
    font-weight: 600;
}

.sbuy-compare-empty {
    padding: 40px 20px;
    text-align: center;
    background: #fafafa;
    border-radius: 6px;
    color: #555;
    font-size: 15px;
}

/* ===== Responsive cho mobile ===== */
@media (max-width: 768px) {
    .sbuy-compare-bar-inner {
        justify-content: center;
    }

    .sbuy-compare-bar-text {
        width: 100%;
        text-align: center;
        margin-right: 0;
    }

    .sbuy-compare-table th,
    .sbuy-compare-table td {
        padding: 8px 10px;
        font-size: 13px;
    }

    .sbuy-compare-label-col {
        min-width: 110px;
    }

    .sbuy-compare-product-col {
        min-width: 140px;
    }
}