/**
 * HopLink パフォーマンス最適化CSS
 * スクロール問題修正版
 */

/* スクロール問題の修正 */
html, body {
    overflow-x: hidden !important;
    /* height: auto を明示的に設定 */
    height: auto !important;
    min-height: 100% !important;
}

/* 固定要素によるスクロールブロックを防ぐ */
.hoplink-container,
.hoplink-ad-container,
.hoplink-products-grid {
    position: relative !important;
    overflow: visible !important;
    height: auto !important;
}

/* ================== */
/* 基本スタイル（軽量版） */
/* ================== */
.hoplink-container {
    margin: 2em 0;
    font-size: 16px;
}

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

/* 広告ラベル - 擬似要素の代わりに実要素推奨 */
.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;
}

/* グリッドレイアウト */
.hoplink-products-grid {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

/* レスポンシブ設定 */
@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 #e0e0e0;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    /* transformを使わないホバー効果 */
    transition: box-shadow 0.2s ease;
}

.hoplink-product:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* サービスラベル */
.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;
}

/* 商品名 */
.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;
}

/* 価格 */
.hoplink-product-price {
    font-size: 16px;
    font-weight: bold;
    color: #e60033;
    margin: 8px 0;
}

/* ボタン */
.hoplink-product-button {
    display: block;
    width: 100%;
    padding: 8px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid;
    margin-top: 8px;
}

/* Amazonボタン */
.hoplink-product[data-service="amazon"] .hoplink-product-button {
    background: #ff9900;
    color: #ffffff;
    border-color: #ff9900;
}

/* 楽天ボタン */
.hoplink-product[data-service="rakuten"] .hoplink-product-button {
    background: #bf0000;
    color: #ffffff;
    border-color: #bf0000;
}

/* モバイル最適化 */
@media (max-width: 480px) {
    .hoplink-container {
        font-size: 14px;
    }
    
    .hoplink-product {
        padding: 8px;
    }
    
    .hoplink-product-title {
        font-size: 12px;
    }
    
    .hoplink-product-price {
        font-size: 14px;
    }
    
    .hoplink-product-button {
        padding: 6px;
        font-size: 11px;
    }
}

/* パフォーマンス最適化 */
.hoplink-product * {
    /* will-changeを避ける */
    will-change: auto !important;
}

/* GPU処理を避ける */
.hoplink-product,
.hoplink-product:hover {
    transform: none !important;
    -webkit-transform: none !important;
}

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

/* アニメーションを削除または軽量化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}