/* =========================================================
   製品比較機能 CSS
   対象: 比較ボタン / プレビューバー / 比較ページ
   ========================================================= */

/* -------------------------------------------------------
   1. 比較ボタン（商品カード上 / YITHが付与する a.compare）
------------------------------------------------------- */
a.compare {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #2A3F59;
    border: 1.5px solid #2A3F59;
    border-radius: 20px;
    background: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s;
    line-height: 1.4;
}
a.compare:hover,
a.compare.added {
    background: #2A3F59;
    color: #fff;
}
a.compare input[type="checkbox"] {
    accent-color: #2A3F59;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    cursor: pointer;
}

/* -------------------------------------------------------
   2. プレビューバー（画面下部固定 / YITHが出力）
------------------------------------------------------- */
#yith-woocompare-preview-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2A3F59;
    color: #fff;
    z-index: 9999;
    padding: 10px 20px;
    box-shadow: 0 -2px 12px rgba(0,0,0,.25);
    transform: translateY(100%);
    transition: transform .2s ease;
}
#yith-woocompare-preview-bar.shown {
    transform: translateY(0);
}
#yith-woocompare-preview-bar .container {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
}
#yith-woocompare-preview-bar header p {
    font-size: 12px;
    color: rgba(255,255,255,.8);
    margin: 0;
    white-space: nowrap;
    line-height: 1.4;
}
#yith-woocompare-preview-bar .content {
    flex: 1;
}
#yith-woocompare-preview-bar ul.compare-list {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}
#yith-woocompare-preview-bar ul.compare-list li {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}
#yith-woocompare-preview-bar ul.compare-list li.product-placeholder {
    opacity: .35;
}
#yith-woocompare-preview-bar ul.compare-list li img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
#yith-woocompare-preview-bar ul.compare-list li a.remove {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 16px;
    height: 16px;
    background: rgba(0,0,0,.55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 10px;
    text-decoration: none;
    line-height: 1;
}
#yith-woocompare-preview-bar footer {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}
#yith-woocompare-preview-bar footer a {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    background: #fff;
    color: #2A3F59;
    font-size: 13px;
    font-weight: 700;
    border-radius: 20px;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity .15s;
}
#yith-woocompare-preview-bar footer a:hover {
    opacity: .85;
    color: #2A3F59;
}
@media (max-width: 640px) {
    #yith-woocompare-preview-bar .container {
        flex-wrap: wrap;
        gap: 8px;
    }
    #yith-woocompare-preview-bar header {
        display: none;
    }
}

/* -------------------------------------------------------
   3. 比較ページ本体 (.jade-compare-page)
------------------------------------------------------- */
.jade-compare-page {
    padding: 24px 16px 80px;
    background: #f8f9fa;
    min-height: 60vh;
}
.jade-compare-page__inner {
    max-width: 1080px;
    margin: 0 auto;
}

/* 戻るリンク */
.jade-compare-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #2A3F59;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 16px;
}
.jade-compare-back:hover {
    text-decoration: underline;
}

/* ページタイトル */
.jade-compare-page__title {
    font-size: 22px;
    font-weight: 800;
    color: #2A3F59;
    margin: 0 0 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid #2A3F59;
}

/* 製品が未選択の場合 */
.jade-compare-empty {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 15px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}
.jade-compare-empty p {
    margin: 0 0 20px;
}
.jade-compare-empty .button {
    display: inline-block;
    padding: 10px 28px;
    background: #2A3F59;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
}

/* -------------------------------------------------------
   4. 製品カラム（横並び）
------------------------------------------------------- */
.jade-compare-products {
    display: grid;
    grid-template-columns: repeat(var(--col-count, 3), 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.jade-compare-col {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.jade-compare-col__img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    display: block;
    margin-bottom: 14px;
}
.jade-compare-col__name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    margin: 0 0 8px;
}
.jade-compare-col__name a {
    color: #1a1a1a;
    text-decoration: none;
}
.jade-compare-col__name a:hover {
    color: #2A3F59;
    text-decoration: underline;
}
.jade-compare-col__price {
    font-size: 16px;
    font-weight: 800;
    color: #2A3F59;
    margin: 0 0 14px;
}
.jade-compare-col__cart {
    margin-top: auto;
    width: 100%;
}
.jade-compare-col__cart .button,
.jade-compare-col__cart .add_to_cart_button,
.jade-compare-col__cart a.button {
    display: block !important;
    width: 100% !important;
    background: #2A3F59 !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 16px !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-align: center !important;
    text-decoration: none !important;
    cursor: pointer !important;
    box-sizing: border-box;
}
.jade-compare-col__cart .button:hover,
.jade-compare-col__cart .add_to_cart_button:hover {
    background: #1e2e42 !important;
    color: #fff !important;
}

/* -------------------------------------------------------
   5. スペック比較テーブル
------------------------------------------------------- */
.jade-compare-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.jade-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
    min-width: 500px;
}
.jade-compare-table th,
.jade-compare-table td {
    border: 1px solid #e5e7eb;
    padding: 10px 14px;
    text-align: left;
    vertical-align: top;
    line-height: 1.5;
}
/* ヘッダー行（製品名） */
.jade-compare-table thead th {
    background: #2A3F59;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
}
.jade-compare-table thead th:first-child {
    width: 130px;
    min-width: 100px;
}
/* スペック項目名セル */
.jade-compare-table tbody th {
    background: #f3f4f6;
    font-weight: 700;
    white-space: nowrap;
    color: #333;
}
/* 値セル：偶数行 */
.jade-compare-table tbody tr:nth-child(even) td {
    background: #fafafa;
}
/* 値なし */
.jade-compare-table td.no-value {
    color: #bbb;
}

/* -------------------------------------------------------
   6. レスポンシブ
------------------------------------------------------- */
@media (max-width: 768px) {
    .jade-compare-products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 480px) {
    .jade-compare-products {
        grid-template-columns: 1fr !important;
    }
    .jade-compare-col__img {
        height: 120px;
    }
}

/* -------------------------------------------------------
   7. YITH ビルトイン比較テーブルを非表示（自作ページを使用）
------------------------------------------------------- */
#yith-woocompare-popup,
.yith-woocompare-popup,
.yith_woocompare_popup,
.yith-compare-popup,
#yith-compare-popup {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
