:root {
    --main-color: #fd4646;
    --text-color: #171427;
    --bg-color: #fff;
}

.icon {
    inline-size: 60px;
    block-size: 60px;
    background-color: #ffffff;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    fill: rgb(71, 71, 71);
    /* box-shadow: 0px 4px 3px rgba(71, 71, 71, 0.2); */
    border-radius: 0.2rem;
    cursor: pointer;
    position: relative;
}

.icon .badge {
    background-color: rgb(255, 43, 43);
    color: #ffffff;
    padding: 0.2rem;
    border-radius: 0.2rem;
    position: absolute;
    inset-block-start: -0.1rem;
    inset-inline-end: -0.5rem;
    font-size: 1rem;
    box-shadow: 0px 4px 3px rgba(255, 42, 42, 0.2);
    min-width: 20px;
    /* この行を追加 */
    text-align: center;
    /* バッジ内のテキストを中央揃えにする */
}

/* 
 * モーダルウィンドウを画面の下部からスライドインさせ (start)
*/
.cart-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    visibility: hidden;
}

.cart-modal.active {
    width: 30%;
    /* max-height: 80%; */
    transform: translateY(0%);
    visibility: visible;

}

/* 
 * メーニューバーにあるかートアイコンと商品数表示 (start)
*/
#cart-icon {
    font-size: 1.8rem;
    cursor: pointer;
    inline-size: 60px;
    block-size: 60px;
    /* background-coLor: #ffffff; */
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    fill: rgb(71, 71, 71);
    /* box-shadow: 0px 4px 3px rgba(71, 71, 71, 0.2); */
    border-radius: 0.2rem;
    cursor: pointer;
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: red;
    color: white;
    font-size: 14px;
    padding: 2px 5px;
    border-radius: 50%;
    display: none;
}

/* 
 * メーニューバーにあるかートアイコンと商品数表示 (end)
*/


.cart-content {
    /* カートの高さを変更するにはこの値を調整する*/
    max-height: 80%;
    overflow-y: auto;
}

.cart {
    position: fixed;
    top: 0;
    right: -100%;
    width: 360px;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg-color);
    box-shadow: -2px 0 4px hsl(0, 4%, 15% / 10%);
    transition: 0.3s;
}

.cart.active {
    right: 0;
}

.cart-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 2rem;
}

.cart-box {
    display: grid;
    grid-template-columns: 30% 65%;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    /* 垂直スクロールバーを追加 overflow-y: auto;*/
    /* 必要に応じて調整 height: 150px;*/

}

.detail-box {
    display: grid;
    row-gap: 0.5rem;
}

.cart-product-name {
    font-size: 1rem;
    text-transform: uppercase;
}

.cart-price {
    font-weight: 500;
}

.quantity-controls {
    text-align: left;
    grid-template-columns: 65% 30%;
}


.cart-quantity {
    outline-color: var(--main-color);
    width: 2.4rem;
    text-align: center;
    font-size: 1rem;
}


/* 合計金額とアイテム数のコンテナをフレックスボックスにする */
.total {
    display: flex;
    justify-content: space-between;
    /* コンテンツを両端に揃える */
    align-items: center;
    /* コンテンツを垂直方向の中央に揃える */
    margin-top: 1.5rem;
    border-top: 1px solid var(--text-color);
}

/* アイテム数のラッパー要素をフレックスボックスにする */
.item-count-wrapper {
    display: flex;
    align-items: center;
    /* コンテンツを垂直方向の中央に揃える */
}

/* アイテム数のタイトルと数字に右マージンを設定 */
.item-count-title,
.item-count {
    margin-right: 8px;
}

.total-price {
    margin-left: 0.5rem;
}

/* 購入ボタン start*/
.btn-buy {
    display: flex;
    margin: 1.5rem auto 0 auto;
    padding: 12px 20px;
    border: none;
    background: var(--main-color);
    color: var(--bg-color);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-buy:hover {
    background: var(--text-color);
}

/* 購入ボタン end*/


#close-cart {
    position: absolute;
    top: 1rem;
    right: 0.8rem;
    font-size: 2rem;
    color: var(--text-color);
    cursor: pointer;
}

.cart-remove {
    font-size: 30px;
    color: var(--main-color);
    margin-left: 1rem;
    vertical-align: middle;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
}

/* カート内商品画像 */
/* img {
    width: 80%;
} */

/* <!-- 数量減少ボタン --> */
.quantity-decrease {
    border: 1px solid var(--border-color);
    border-radius: var(--percent50);
    width: fit-content;
    padding: 0.5em;
    width: 38px;
    height: 38px;
}

/* <!-- 数量 --> */
.cart-quantity {
    font-size: 1.25em;
    outline: 0;
    border: 0;
}

/* 上下のスピンボタン表示しない */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* <!-- 数量増加ボタン --> */
.quantity-increase {
    border: 1px solid var(--border-color);
    border-radius: var(--percent50);
    width: fit-content;
    padding: 0.5em;
    width: 38px;
    height: 38px;
}


/* Breakpoints /Making Responsive 
  ipad,iphoneなどスマートホン対応
*/
@media (max-width: 1024px) {

    /* 
     * モーダルウィンドウを画面の下部からスライドインさせ (start)
    */

    /* カート内商品画像 */
    .cart-modal.active img {
        width: 50%;
    }

    .cart-modal.active {
        width: 100%;
        transform: translateY(40%);
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
    }

    .cart-content {
        /* カートの高さを変更するにはこの値を調整する*/
        max-height: 40%;
        overflow-y: auto;
    }

    .cart-box {
        display: grid;
        grid-template-columns: 35% 60%;
        align-items: center;
        gap: 1rem;
        margin-top: 1rem;
        /* 垂直スクロールバーを追加 */
        overflow-y: auto;
        /* 必要に応じて調整 */
        height: 100px;
    }

}

@media (max-width: 768px) {
    /* 
     * モーダルウィンドウを画面の下部からスライドインさせ (start)
    */

    /* カート内商品画像 */
    .cart-modal.active img {
        width: 75%;
    }

    .cart-modal.active {
        width: 100%;
        transform: translateY(40%);
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
    }

    .cart-content {
        /* カートの高さを変更するにはこの値を調整する*/
        max-height: 40%;
        overflow-y: auto;
    }

    .cart-box {
        display: grid;
        grid-template-columns: 35% 60%;
        align-items: center;
        gap: 1rem;
        margin-top: 1rem;
        /* 垂直スクロールバーを追加 */
        overflow-y: auto;
        /* 必要に応じて調整 */
        height: 150px;
    }

    /* 検索 */
    .form-control {
        width: 100%;
    }

}


/* iPhone XR */
@media (max-width: 414px) {

    /* カート内商品画像 */
    .cart-modal.active img {
        width: 100%;
    }

    .cart-modal.active {
        width: 100%;
    }

    .cart-content {
        /* カートの高さを変更するにはこの値を調整する*/
        max-height: 40%;
        overflow-y: auto;
    }

    .cart-box {
        grid-template-columns: 35% 60%;
    }

}

/* iPhone 12 Pro */
@media (max-width: 393px) {

    /* カート内商品画像 */
    .cart-modal.active img {
        width: 100%;
    }

    .cart-modal.active {
        width: 100%;
    }

    .cart-content {
        /* カートの高さを変更するにはこの値を調整する*/
        max-height: 40%;
        overflow-y: auto;
    }

    .cart-box {
        grid-template-columns: 35% 60%;
    }

}

/* iPhone 12 Pro */
@media (max-width: 390px) {

    .cart-content {
        /* カートの高さを変更するにはこの値を調整する*/
        max-height: 40%;
        overflow-y: auto;
    }

    .cart-box {
        grid-template-columns: 35% 60%;
    }

}

/* iPhone SE */
@media (max-width: 375px) {


    .cart-content {
        /* カートの高さを変更するにはこの値を調整する*/
        max-height: 40%;
        overflow-y: auto;
    }

    .cart-box {
        grid-template-columns: 35% 60%;
    }

}