/**
 * 商品对比 (Compare) 共用样式
 */

/* ── 通用按钮 ── */
.zb-compare-btn {
    background: rgba(255, 255, 255, .92) !important;
    border: none !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #1f2937;
    padding: 0 !important;
    transition: color .2s, transform .2s, background-color .2s, box-shadow .2s;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
    -webkit-user-select: none;
    user-select: none;
    outline: none;
}

.zb-compare-btn:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

.zb-compare-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}

.zb-compare-btn:hover {
    color: #000;
    transform: scale(1.08);
    background: #fff !important;
}

.zb-compare-btn.is-active {
    color: #000;
    background: #fff !important;
}

/* ── 卡片右上角动作竖向堆叠 (heart 在上、compare 在下) ── */
.zb-card-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .25s ease, transform .25s ease;
    pointer-events: none;
}

/* 容器内任意按钮自身具备 pointer-events，方便单击 */
.zb-card-actions .zb-wish-btn,
.zb-card-actions .zb-compare-btn {
    position: static !important;
    top: auto !important;
    right: auto !important;
    pointer-events: auto;
    opacity: 1 !important;
    transform: none !important;
}

/* 卡片悬停 / 任一按钮已激活时显示 */
.item-card:hover .zb-card-actions,
.zb-card-actions:hover,
.zb-card-actions:focus-within,
.zb-card-actions.has-active {
    opacity: 1;
    transform: translateY(0);
}

@media (hover: none) {
    .zb-card-actions { opacity: 1; transform: none; }
}

/* ── PDP 大尺寸 ── */
.zb-compare-pdp {
    width: 44px !important;
    height: 44px !important;
}

.zb-compare-pdp svg {
    width: 22px;
    height: 22px;
}

/* ── 头部计数 (与 wishlist 一致) ── */
.zb-compare-link {
    position: relative;
}

.zb-compare-count {
    position: absolute;
    top: -4px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #b30022;
    color: #fff;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    font-weight: 600;
    transition: opacity .2s;
}

.zb-compare-count.is-zero { display: none; }

/* ────────────────────────────────────────
 * 对比页表格样式
 * ──────────────────────────────────────── */
.zb-compare-table-wrap {
    border: 1px solid #e5e5e5;
    background: #fff;
}

.zb-compare-table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
    font-size: 13px;
    color: #1f2937;
}

.zb-compare-table th,
.zb-compare-table td {
    border: 1px solid #e5e5e5;
    padding: 16px 18px;
    vertical-align: top;
    text-align: center;
}

.zb-compare-table th {
    width: 160px;
    background: #fafafa;
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-size: 11px;
    color: #6b7280;
}

.zb-compare-row-image td {
    background: #f8f8f8;
    padding: 24px;
}

.zb-compare-cell-image {
    max-width: 240px;
    margin: 0 auto;
}

.zb-compare-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #d1d5db;
    color: #6b7280;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .2s, border-color .2s;
    z-index: 2;
}

.zb-compare-remove:hover {
    color: #b30022;
    border-color: #b30022;
}

.zb-compare-name-link {
    font-weight: 600;
    color: #1f2937;
    text-decoration: none;
}

.zb-compare-name-link:hover {
    text-decoration: underline;
}

.zb-compare-instock { color: #047857; }
.zb-compare-outstock { color: #b30022; }

.zb-compare-attrs {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
}

.zb-compare-attrs li {
    padding: 6px 0;
    border-bottom: 1px dashed #f0f0f0;
    line-height: 1.6;
}

.zb-compare-attrs li:last-child { border-bottom: none; }

.zb-compare-attr-key {
    display: inline-block;
    color: #6b7280;
    margin-right: 6px;
}

.zb-compare-attr-val {
    color: #1f2937;
}

.zb-compare-row-actions td {
    background: #fafafa;
    padding: 20px;
}

.zb-compare-view-btn {
    display: inline-block;
    padding: 10px 28px;
    background: #000;
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: .15em;
    font-size: 11px;
    transition: background-color .2s;
}

.zb-compare-view-btn:hover {
    background: #1a120a;
    color: #fff;
}

/* 移动端：简化间距 */
@media (max-width: 768px) {
    .zb-compare-table th,
    .zb-compare-table td { padding: 12px 10px; }
    .zb-compare-table th { width: 110px; font-size: 10px; }
}
