/**
 * 商品リスト型スタイル
 * responsive-test-v2.html ベースの実装
 * 
 * @package FurusatoNanae
 * @since v0.4.0
 */

/* ========================================
   0. 基本設定
   ======================================== */
* {
    box-sizing: border-box;
}

body {
    font-family: 'メイリオ', 'Meiryo', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f8f8;
}

/* ========================================
   1. レイアウト基本構造
   ======================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-content,
.henreihin-content {
    display: flex;
    gap: 30px;
    margin-top: 30px;
}

.content,
.henreihin-main {
    flex: 1;
}

.sidebar,
.henreihin-sidebar {
    width: 300px;
}

/* ========================================
   2. 商品アイテムスタイル（リスト型）
   ======================================== */
.henreihin-list-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: white;
    border: 1px solid #e0e0e0;
    margin: 0 auto;
    max-width: 100%;
    transition: box-shadow 0.3s;
       scroll-margin-top: 60px; 
    flex-wrap:wrap;   
}

/* products-gridコンテナ内では margin-bottom を無効化してgapで制御 */
.products-grid .henreihin-list-item {
    margin-bottom: 0;
}

/* 従来のレイアウト（products-grid以外）では margin-bottom を維持 */
.henreihin-list-item:not(.products-grid .henreihin-list-item) {
    margin-bottom: 20px;
}

.henreihin-list-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* 商品画像エリア */
.henreihin-list-item .product-image {
    flex-basis: 180px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    flex-grow:1;
}

.henreihin-list-item .product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* No Image フォールバック - v2.htmlと同じ */
.henreihin-list-item .product-image.no-image {
    background: #f0f0f0;
    color: #666;
    font-size: 14px;
    text-align: center;
}

/* ========================================
   3. バッジ系（v2では不使用）
   ======================================== */
/* v2デザインではバッジを使用しない */

/* ========================================
   4. 商品情報エリア
   ======================================== */
.henreihin-list-item .product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* min-width: 524px; */
    padding-left:0;
    padding-right:0;
    /* width: 60%; */
    flex-basis: 400px;
}

.henreihin-list-item .product-info-top {
    /* 上部コンテンツ（タイトル・説明） */
}

.henreihin-list-item .product-info-bottom {
    /* 下部コンテンツ（価格・ボタン） */
}

/* 商品タイトル */
.henreihin-list-item .product-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--color-primary);
}

.henreihin-list-item .product-name a {
    color: var(--color-primary);
    text-decoration: none;
}

/* 商品説明 */
.henreihin-list-item .product-description {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
}

.henreihin-list-item .product-description p {
    margin: 0;
    font-size:16px;
    -webkit-line-clamp:none;
}

/* 価格表示 */
.henreihin-list-item .product-price {
    font-size: 24px;
    color: #d32f2f;
    font-weight: bold;
    margin-bottom: 15px;
}

/* ========================================
   5. ポータルリンクボタン
   ======================================== */
.henreihin-list-item .portal-links {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.henreihin-list-item .henreihin-portal-button {
    background: transparent;
    color: white;
    padding: 0;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0;
    transition: opacity 0.3s;
    width: 120px;
    height: 40px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    text-indent: -9999px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.henreihin-list-item .henreihin-portal-button:hover {
    opacity: 0.8;
}

/* ポータルサイト別SVG画像設定 */
.henreihin-list-item .henreihin-portal-button.furusato-choice {
    background-image: url('../svg/portal/choise.svg');
}

.henreihin-list-item .henreihin-portal-button.rakuten {
    background-image: url('../svg/portal/rakuten.svg');
}

.henreihin-list-item .henreihin-portal-button.satofull {
    background-image: url('../svg/portal/satofuru.svg');
}

.henreihin-list-item .henreihin-portal-button.furunavi {
    background-image: url('../svg/portal/furunavi.svg');
}

.henreihin-list-item .henreihin-portal-button.au-paymarket {
    background-image: url('../svg/portal/au.svg');
}

.henreihin-list-item .henreihin-portal-button.other {
    background-image: url('../svg/portal/choise.svg');
}

/* ========================================
   6. セクションタイトル
   ======================================== */
.section-title {
    font-size: 28px;
    color: var(--color-primary);
    margin-bottom: 30px;
    font-weight: bold;
}

/* サブカテゴリタイトル */
.subcategory-title {
    font-size: 24px;
    color: var(--color-primary);
    margin: 40px 0 20px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
    font-weight: bold;
}

/* ========================================
   7. 関連カテゴリセクション（v2.htmlベース）
   ======================================== */
.related-categories {
    background: white;
    padding: 40px 0;
    margin-bottom: 100px;
}

.related-categories .section-title {
    margin-bottom: 20px;
    text-align: left; /* v2.htmlに合わせて左寄せ */
    font-size: 18px;
}

.category-links {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.category-link {
    text-decoration: none;
    color: inherit;
}

.category-card {
    background: #f0f0f0;
    border: 1px solid #ddd;
    padding: 20px;
    text-align: center;
    color: #666;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.category-card:hover {
    background: #e8f5e8;
}

.category-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.category-name {
    font-size: 16px;
    font-weight: bold;
    margin: 10px 0 5px 0;
    color: #333;
}

.category-count {
    font-size: 12px;
    color: #666;
    margin: 0;
    font-family: 'メイリオ', 'Meiryo', sans-serif;
}

/* ========================================
   7. サイドバー
   ======================================== */
.sidebar-widget {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.widget-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
}

/* 人気ランキング */
.ranking-list {
    list-style: none;
    padding: 0;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.ranking-item:last-child {
    border-bottom: none;
}

.rank-number {
    background: var(--color-primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.rank-content {
    flex: 1;
}

.rank-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 4px;
    line-height: 1.3;
}

.rank-price {
    font-size: 12px;
    color: #d32f2f;
    font-weight: bold;
}

/* カテゴリメニュー */
.category-menu {
    list-style: none;
    padding: 0;
}

.category-item {
    border-bottom: 1px solid #f0f0f0;
}

.category-item:last-child {
    border-bottom: none;
}

.category-item a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.category-item a:hover {
    color: var(--color-primary);
}

.category-item.current a {
    color: var(--color-primary);
    font-weight: bold;
}

.count {
    color: #666;
    font-size: 12px;
}

/* ========================================
   8. レスポンシブ対応
   ======================================== */
@media (max-width: 768px) {
    .main-content,
    .henreihin-content {
        flex-direction: column;
    }
    
    .sidebar,
    .henreihin-sidebar {
        width: 100%;
    }
    
    .henreihin-list-item {
        flex-direction: column;
    }
    
    .henreihin-list-item .product-image {
        width: 100%;
    }
    
    .henreihin-list-item .product-name {
        font-size: 18px;
    }
    
    .henreihin-list-item .product-price {
        font-size: 20px;
    }
    
    .henreihin-list-item .henreihin-portal-button {
        width: 100px;
        height: 32px;
    }
    
    .henreihin-list-item .portal-links {
        gap: 8px;
    }
    
    .section-title {
        font-size: 24px;
    }
    
    .subcategory-title {
        font-size: 20px;
    }
    
    /* 関連カテゴリのレスポンシブ対応 */
    .category-links {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .henreihin-list-item {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .henreihin-list-item .product-image {
        height: 180px;
    }
    
    .henreihin-list-item .product-name {
        font-size: 16px;
    }
    
    .henreihin-list-item .product-price {
        font-size: 18px;
    }
    
    .henreihin-list-item .henreihin-portal-button {
        width: 90px;
        height: 28px;
    }
    
    .henreihin-list-item .portal-links {
        gap: 6px;
    }
    
    .section-title {
        font-size: 20px;
    }
    
    .subcategory-title {
        font-size: 18px;
    }
    
    /* 関連カテゴリのスマホ対応 */
    .category-links {
        grid-template-columns: 1fr;
    }
    
    .related-categories {
        margin-bottom: 80px;
    }
}

