/* =======================================
   商品一覧ページ product_list.css
   （フォント等は customize.css に依存）
   ======================================= */

/* タイトルを商品ボックスと揃える（幅1200px 内で左右30pxの余白） */
.ec-pageTitle {
    max-width: 1200px;
    margin: 30px auto 20px; /* 下に20pxの余白を追加 */
    padding-left: 30px;
    text-align: left;
    box-sizing: border-box;
}

/* コンテナ（最大幅1200px、左右余白30px） */
.ec-shelfRole {
    padding: 40px 0;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 30px;
    padding-right: 30px;
    box-sizing: border-box;
}

/* グリッド（flex化して中央寄せ） */
.ec-shelfGrid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;   /* 中央寄せ */
    margin: 0 auto;
    padding: 0;
    list-style: none;
    box-sizing: border-box;
}

/* ダミー要素（中央寄せ用）を非表示に */
.ec-shelfGrid__dummy {
    visibility: hidden;
    pointer-events: none;
    height: 0;
    margin: 0;
    padding: 0;
}

/* 商品カード */
.ec-shelfGrid__item {
    border: none;       /* 枠線を削除 */
    border-radius: 8px;
    overflow: hidden;
    background-color: #fff;
    transition: box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    flex: 0 1 370px;    /* 幅固定気味に設定（最小・基準） */
    max-width: 370px;   /* 最大幅370px */
}

.ec-shelfGrid__inner {
    display: flex;
    flex-direction: column;
}

/* 画像（デフォルトは正方形に見せる設定） */
.ec-shelfGrid__link.ec-link--image { display:block; }
.ec-shelfGrid__image {
    width: 100%;
    padding-top: 100%;     /* デスクトップ／タブレットで正方形に見せる振る舞い（下でSP解除） */
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}
.ec-shelfGrid__image img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.ec-shelfGrid__item:hover .ec-shelfGrid__image img {
    transform: scale(1.05);
}

/* カテゴリラベル */
.ec-productRole__category {
    margin: 5px 10px 0 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.ec-categoryLabel {
    display: inline-block;
    background-color: #dddddd;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
}
.ec-categoryLabel a { color: inherit; text-decoration: none; }
.ec-categoryLabel a:hover { text-decoration: underline; }

/* 商品名 */
.ec-shelfGrid__title {
    margin: 10px 30px 10px 30px;
    font-size: 0.85em;
    font-weight: 700;
    line-height: 1.2;
}

/* 説明 */
.ec-shelfGrid__desc {
    margin: 0 30px 10px 30px;
}

/* 価格と数量ラベル周り */
.ec-productRole__details {
    padding: 0 10px 10px 10px;
}
.ec-priceQuantityWrapper {
    display: flex;
    align-items: center;
    gap: 50px;
    margin: 0;
    justify-content: flex-start;
}

/* ラベル（価格／数量） */
.ec-priceLabel,
.ec-quantityLabel {
    background-color: #000;
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

/* 金額表示部分 */
.ec-shelfGrid__price {
    font-weight: 700;
    margin: 0 0 0 6px;
    display: inline-block;
}

/* 数量入力 */
.ec-numberInput {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ec-numberInput input {
    width: 40px;
    padding: 4px 6px;
    text-align: right;
}

/* カートボタン */
.ec-productRole__btn {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}
.ec-blockBtn--action {
    padding: 10px 15px;
    font-weight: 600;
    text-align: center;
    background-color: #999999;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: inline-block;
}
.ec-blockBtn--action:hover { background-color: #c5001f; }
.ec-btn-disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* カートのモーダル */
.ec-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999; }
.ec-modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); }
.ec-modal-wrap { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; border-radius: 8px; padding: 20px; width: 90%; max-width: 400px; text-align: center; }
.ec-modal-close { position: absolute; top: 10px; right: 10px; cursor: pointer; }
.ec-modal-box { margin-top: 20px; }
.ec-inlineBtn--action { display:inline-block; padding:8px 12px; margin:5px; border-radius:4px; text-decoration:none; background:#e60023; color:#fff; }
.ec-inlineBtn--cancel { display:inline-block; padding:8px 12px; margin:5px; border-radius:4px; text-decoration:none; background:#f0f0f0; color:#333; }

/* =====================================
   タブレット表示（2列〜自動幅）
   ===================================== */
@media screen and (max-width: 1024px) {
    .ec-shelfRole { padding-left: 30px; padding-right: 30px; }

    .ec-shelfGrid {
        justify-content: center; /* 中央寄せ */
    }

    .ec-shelfGrid__item {
        flex: 0 1 370px; /* 幅固定気味に調整 */
        max-width: 370px;
    }

    /* PC/タブレットでは正方形の見せ方を維持（画像は cover） */
    .ec-shelfGrid__image {
        padding-top: 100%;
        position: relative;
        overflow: hidden;
    }
    .ec-shelfGrid__image img {
        position: absolute;
        top: 0; left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* =====================================
   SP表示（1列） — ここで“正方形化”を解除して自然なアスペクトに戻す
   ===================================== */
@media screen and (max-width: 767px) {
    .ec-shelfRole { padding-left: 15px; padding-right: 15px; }

    .ec-shelfGrid {
        flex-direction: column;
        align-items: center; /* アイテム自体を中央寄せ */
    }

    .ec-shelfGrid__item {
        width: 90%;
        max-width: 370px;  /* SPでも最大幅を制限 */
        flex-direction: column;
        /* flexプロパティはSPで固定しない（幅に応じて伸縮） */
        flex: 0 1 auto;
    }

    /* === SPだけ正方形（padding-top:100%） を解除する === */
    .ec-shelfGrid__image {
        padding-top: 0;       /* 正方形解除 */
        height: auto;         /* 高さは画像に任せる */
        position: relative;
        overflow: visible;
    }
    .ec-shelfGrid__image img {
        position: static;     /* absolute を解除 */
        display: block;       /* ブラウザの余白回避 */
        width: 100%;          /* 横幅いっぱいに拡げる */
        height: auto;         /* 縦横比を保つ */
        object-fit: contain;  /* 余白がある時は収める */
    }

    .ec-productRole__info {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
}
