/**
 * HopLink v2.0.1 - Cocoon テーマ互換CSS
 * コンバージョン最適化 + パフォーマンス最適化済み
 */

/* ================== */
/* 基本スタイル       */
/* ================== */
.hoplink-container {
    margin: 2em 0;
    font-size: 16px;
    position: relative;
    overflow: visible;
    height: auto;
}

.hoplink-ad-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    position: relative;
}

/* Cocoon互換: .entry-content内での表示調整 */
.entry-content .hoplink-container {
    clear: both;
}

/* 広告ラベル */
.hoplink-ad-label {
    position: absolute;
    top: -12px;
    right: 20px;
    background: #ff6b6b;
    color: #ffffff;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
}

/* 自動解析タイトル — Cocoon h3スタイルを完全リセット */
.hoplink-auto-title,
.entry-content .hoplink-auto-title,
.article .hoplink-auto-title,
.article-body .hoplink-auto-title,
.entry-content h3.hoplink-auto-title,
h3.hoplink-auto-title {
    font-size: 15px !important;
    font-weight: bold !important;
    margin: 0 0 10px 0 !important;
    padding: 0 0 6px 0 !important;
    color: #555 !important;
    background: none !important;
    border-left: none !important;
    border-top: none !important;
    border-right: none !important;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    background: none;
    text-align: left;
    position: relative;
}

/* Cocoon checkmark/icon pseudo-element 完全除去 */
.hoplink-auto-title::before,
.hoplink-auto-title::after,
.entry-content .hoplink-auto-title::before,
.entry-content .hoplink-auto-title::after,
.entry-content h3.hoplink-auto-title::before,
.entry-content h3.hoplink-auto-title::after,
h3.hoplink-auto-title::before,
h3.hoplink-auto-title::after,
.article h3.hoplink-auto-title::before,
.article h3.hoplink-auto-title::after {
    content: none !important;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
}

/* Cocoon TOC span inside hoplink title */
.hoplink-auto-title span,
.entry-content .hoplink-auto-title span,
h3.hoplink-auto-title span {
    display: inline !important;
}
.hoplink-auto-title span::before,
.hoplink-auto-title span::after,
.entry-content .hoplink-auto-title span::before,
.entry-content .hoplink-auto-title span::after {
    content: none !important;
    display: none !important;
}

/* Product title — Cocoon h3 reset */
.hoplink-product-title,
.entry-content .hoplink-product-title,
h3.hoplink-product-title {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 0 5px 0 !important;
}
.hoplink-product-title::before,
.hoplink-product-title::after,
.entry-content .hoplink-product-title::before,
.entry-content .hoplink-product-title::after {
    content: none !important;
    display: none !important;
}

/* グリッドレイアウト */
.hoplink-products-grid {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    position: relative;
    overflow: visible;
    height: auto;
}

/* レスポンシブ設定 */
@media (min-width: 769px) {
    .hoplink-products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .hoplink-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .hoplink-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* 商品カード */
.hoplink-product {
    background: #ffffff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.hoplink-product:hover {
    border-color: #bbb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ================== */
/* バッジ             */
/* ================== */
.hoplink-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 3px;
    color: #ffffff;
    margin: 0 2px 6px 2px;
    line-height: 1.4;
}

.hoplink-badge-bestseller {
    background: #f39c12;
}

.hoplink-badge-shipping {
    background: #27ae60;
}

/* プラットフォームバッジ */
.hoplink-platform-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 3px;
    color: #ffffff;
    margin-top: 6px;
}

.hoplink-platform-badge.hoplink-rakuten {
    background: #bf0000;
}

.hoplink-platform-badge.hoplink-amazon {
    background: #ff9900;
}

/* サービスラベル（JS data-service属性による） */
.hoplink-product[data-service="amazon"]::before {
    content: "Amazon";
    display: block;
    background: #ff9900;
    color: #ffffff;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 3px;
    margin-bottom: 8px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.hoplink-product[data-service="rakuten"]::before {
    content: "楽天";
    display: block;
    background: #bf0000;
    color: #ffffff;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    border-radius: 3px;
    margin-bottom: 8px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

/* 商品画像 */
.hoplink-product-image {
    width: 100%;
    aspect-ratio: 1;
    background: #f8f8f8;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.hoplink-product-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    height: auto;
}

/* 商品名 */
.hoplink-product-title {
    font-size: 13px;
    font-weight: bold;
    color: #333333;
    margin: 8px 0;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    border: none;
    background: none;
    padding: 0;
}

/* Cocoon互換: 商品タイトルのh3リセット */
.entry-content .hoplink-product-title {
    font-size: 13px;
    border-bottom: none;
    padding-left: 0;
    background: none;
    margin: 8px 0;
}

/* 商品情報 */
.hoplink-product-info {
    text-align: center;
}

/* 価格・レビュー */
.hoplink-product-meta {
    margin: 6px 0;
}

.hoplink-price {
    font-size: 16px;
    font-weight: bold;
    color: #e60033;
}

.hoplink-review {
    font-size: 13px;
    color: #f5a623;
    margin-left: 6px;
}

/* ショップ名 */
.hoplink-product-shop {
    font-size: 11px;
    color: #888;
    margin: 4px 0;
}

/* ================== */
/* CTAボタン          */
/* ================== */
.hoplink-button {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 12px 8px;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    margin-top: 8px;
    background: #e74c3c;
    color: #ffffff;
    cursor: pointer;
    box-sizing: border-box;
    line-height: 1.4;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hoplink-button:hover {
    transform: scale(1.03);
    box-shadow: 0 3px 10px rgba(231, 76, 60, 0.35);
    text-decoration: none;
    color: #ffffff;
}

.hoplink-button:active {
    transform: scale(0.98);
}

/* プラットフォーム別ボタン色 */
.hoplink-button-rakuten {
    background: #bf0000;
}

.hoplink-button-rakuten:hover {
    box-shadow: 0 3px 10px rgba(191, 0, 0, 0.35);
}

.hoplink-button-amazon {
    background: #ff9900;
    color: #111111;
}

.hoplink-button-amazon:hover {
    box-shadow: 0 3px 10px rgba(255, 153, 0, 0.35);
    color: #111111;
}

/* Cocoon互換: aタグの色リセット */
.entry-content .hoplink-button,
.entry-content .hoplink-button:visited {
    color: #ffffff;
    text-decoration: none;
}

.entry-content .hoplink-button-amazon,
.entry-content .hoplink-button-amazon:visited {
    color: #111111;
}

/* 比較リンク: v2.0.1で削除（バウンス率悪化のため） */

/* ================== */
/* PR開示バッジ       */
/* ================== */
.hoplink-disclosure {
    font-size: 11px;
    color: #999999;
    text-align: right;
    margin-top: 8px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.hoplink-pr-badge {
    display: inline-block;
    background: #ddd;
    color: #999;
    font-size: 8px;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 2px;
    line-height: 1.3;
    vertical-align: middle;
}

/* 読み込み中の表示 */
.hoplink-loading {
    text-align: center;
    padding: 20px;
    color: #666666;
}

/* ================== */
/* モバイル最適化     */
/* ================== */
@media (max-width: 480px) {
    .hoplink-container {
        font-size: 14px;
    }

    .hoplink-ad-container {
        padding: 12px;
    }

    .hoplink-product {
        padding: 8px;
    }

    .hoplink-product-title,
    .entry-content .hoplink-product-title {
        font-size: 12px;
    }

    .hoplink-price {
        font-size: 14px;
    }

    .hoplink-button {
        min-height: 48px;
        padding: 10px 6px;
        font-size: 12px;
    }

    .hoplink-badge {
        font-size: 9px;
        padding: 1px 5px;
    }
}

/* アクセシビリティ: モーション軽減 */
@media (prefers-reduced-motion: reduce) {
    .hoplink-product {
        transition: none;
    }

    .hoplink-button {
        transition: none;
    }

    .hoplink-button:hover {
        transform: none;
    }
}
