/**
 * Story 2.3 · 产品对比样式
 *
 * - 详情页/卡片「加入对比」按钮
 * - 全站浮动对比工具栏 #compareBar
 * - 对比页 .page-compare（表格 sticky 列 + 差异高亮）
 */

/* ── 卡片小对比按钮 ───────────────────────── */
.btn-compare-mini {
    position: absolute;
    top: 8px;
    right: 48px;   /* 给收藏角标留位 */
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8a96a3;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: color .2s, background .2s, transform .15s;
    z-index: 2;
    padding: 0;
    font-size: 13px;
}
.btn-compare-mini:hover { background: #fff; color: #2c5fa0; transform: scale(1.08); }
.btn-compare-mini.is-active { background: #2c5fa0; color: #fff; }

/* ── 详情页「加入对比」按钮（接力 .btn-compare 原有结构）── */
.detail-actions .btn-compare {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: #fff;
    border: 1px solid #d3d9e1;
    border-radius: 4px;
    color: #5a6776;
    font-size: 14px;
    cursor: pointer;
    transition: color .2s, border-color .2s, background .2s;
    font-family: inherit;
}
.detail-actions .btn-compare:hover { border-color: #2c5fa0; color: #2c5fa0; }
.detail-actions .btn-compare.is-active {
    border-color: #2c5fa0;
    background: #eaf0f8;
    color: #2c5fa0;
}

/* ── 浮动工具栏 ──────────────────────────── */
.hosemall-compare-bar {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(0);
    z-index: 99;
    background: #fff;
    border: 1px solid #e3e7ee;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(28, 50, 80, 0.18);
    padding: 8px 16px 8px 20px;
    max-width: calc(100vw - 32px);
}
.hosemall-compare-bar[hidden] { display: none; }
.cbar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}
.cbar-items {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.cbar-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px 4px 10px;
    background: #f3f5f9;
    border-radius: 12px;
    font-size: 12px;
    color: #2b3a4d;
}
.cbar-item-remove {
    background: transparent;
    border: none;
    color: #8a96a3;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}
.cbar-item-remove:hover { color: #d9534f; }
.cbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cbar-count {
    font-size: 13px;
    color: #5a6776;
}
.cbar-count em {
    color: #2c5fa0;
    font-weight: 600;
    font-style: normal;
}
.cbar-go {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 18px;
    background: linear-gradient(135deg, #2c5fa0, #1a3a5f);
    color: #fff;
    border-radius: 50px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: transform .15s, box-shadow .15s;
}
.cbar-go:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(44, 95, 160, 0.3); }
.cbar-clear {
    background: transparent;
    border: 1px solid #e3e7ee;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    color: #8a96a3;
    cursor: pointer;
    transition: color .2s, border-color .2s;
}
.cbar-clear:hover { border-color: #d9534f; color: #d9534f; }

/* ── 对比页 ──────────────────────────────── */
.page-compare {
    padding: 40px 0 80px;
}
.compare-header {
    text-align: center;
    margin-bottom: 32px;
}
.compare-header h1 {
    font-size: 26px;
    color: #1a3a5f;
    margin: 0 0 6px;
}
.compare-tip {
    color: #8a96a3;
    font-size: 13px;
    margin: 0 0 20px;
}
.compare-actions {
    display: inline-flex;
    gap: 12px;
}
.compare-actions .btn {
    padding: 8px 18px;
    font-size: 14px;
    border-radius: 4px;
    border: 1px solid #d3d9e1;
    background: #fff;
    color: #2b3a4d;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.compare-actions .btn:hover { border-color: #2c5fa0; color: #2c5fa0; }

.compare-empty {
    text-align: center;
    padding: 80px 20px;
    color: #8a96a3;
}
.compare-empty i {
    font-size: 64px;
    color: #d3d9e1;
    margin-bottom: 16px;
    display: block;
}
.compare-empty p { margin: 4px 0; }
.compare-empty .muted { font-size: 13px; color: #b3bbc4; }
.compare-empty .btn-primary {
    margin-top: 20px;
    padding: 10px 28px;
    background: #2c5fa0;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
}

.compare-table-wrap {
    overflow-x: auto;
    border: 1px solid #e3e7ee;
    border-radius: 8px;
    background: #fff;
}
.compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}
.compare-table th,
.compare-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #eef1f5;
    vertical-align: top;
    font-size: 14px;
}
.compare-table thead th {
    background: #fbfcfd;
    border-bottom: 2px solid #e3e7ee;
    position: relative;
}
.compare-table .col-label {
    width: 130px;
    font-weight: 500;
    color: #5a6776;
    background: #fbfcfd;
    position: sticky;
    left: 0;
    z-index: 1;
}
.compare-table .col-product {
    text-align: center;
    width: 200px;
    min-width: 180px;
}
.compare-table .col-product .col-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: #b3bbc4;
    cursor: pointer;
    font-size: 14px;
}
.compare-table .col-product .col-remove:hover { color: #d9534f; }
.compare-table .col-product .col-thumb {
    display: block;
    margin: 0 auto 8px;
    width: 100px;
    height: 100px;
}
.compare-table .col-product .col-thumb img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
}
.compare-table .col-product .col-thumb .thumb-fallback {
    width: 100px;
    height: 100px;
    background: #f3f5f9;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b3bbc4;
    font-size: 32px;
}
.compare-table .col-product .col-title {
    display: block;
    color: #1a3a5f;
    font-weight: 500;
    margin-bottom: 4px;
    text-decoration: none;
    line-height: 1.4;
}
.compare-table .col-product .col-brand {
    font-size: 12px;
    color: #8a96a3;
}
.compare-table .col-product .col-inquiry {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 14px;
    background: #2c5fa0;
    color: #fff;
    border-radius: 3px;
    text-decoration: none;
    font-size: 12px;
}
.compare-table .col-product .col-inquiry:hover { background: #1a3a5f; }

/* 差异高亮：整行 */
.compare-table tr.is-diff td { background: #fff8e6; }
.compare-table tr.is-diff th.col-label { background: #fff8e6; color: #b56a00; }

.compare-table .muted { color: #b3bbc4; }

/* 打印优化 */
@media print {
    body * { visibility: hidden; }
    .page-compare, .page-compare * { visibility: visible; }
    .page-compare { position: absolute; top: 0; left: 0; padding: 0; }
    .compare-actions, .col-remove, .col-inquiry, .hosemall-compare-bar, .site-footer { display: none !important; }
    .compare-table { font-size: 11px; }
    .compare-table thead th { background: #fff !important; }
}

@media (max-width: 768px) {
    .hosemall-compare-bar { left: 8px; right: 8px; transform: none; border-radius: 12px; }
    .compare-actions { flex-wrap: wrap; }
}
