/* ============================================
   メニューカートシステム CSS
   配置場所: /wp-content/themes/[子テーマ]/assets/menu-cart.css
   ============================================ */

/* ----- メニューアイテムのカーソル ----- */
.menu-item img,
.menu-item h3 {
    cursor: pointer;
    transition: opacity 0.2s;
}

.menu-item img:hover {
    opacity: 0.85;
}

/* ----- 商品詳細モーダル ----- */
.product-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.product-modal-overlay.active {
    display: flex;
}

.product-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 420px;
    width: 100%;
    padding: 24px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.product-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    padding: 0 !important;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 18px;
    color: #333;
    cursor: pointer;
    line-height: 1 !important;
}

.product-modal-image {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 16px;
    display: block;
}

.product-modal-name {
    font-size: 1.3em;
    font-weight: bold;
    margin: 0 0 8px;
}

.product-modal-price {
    font-size: 1.1em;
    color: #333;
    margin: 0 0 20px;
}

.product-modal-note {
    display: none;
    background: #fff8e1;
    border-left: 3px solid #f5a623;
    color: #8a6d3b;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    margin-bottom: 16px;
    line-height: 1.5;
}

.product-modal-qty {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.product-modal-qty select {
    flex: 1;
    padding: 10px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 6px;
}

.product-modal-add {
    width: 100%;
    padding: 14px;
    background: #c41e3a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.product-modal-add:hover {
    background: #a01830;
}

/* ----- カートトグルボタン ----- */
.cart-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #FFF;
    color: #fff;
    border: none;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-toggle:hover{
    background: #FFF !important;
}

.cart-toggle-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #fff;
    color: #c41e3a;
    border: 2px solid #c41e3a;
    border-radius: 50%;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    padding: 0 4px;
    box-sizing: border-box;
}

/* カート追加時のバッジアニメーション */
@keyframes cart-badge-pop {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.5);
    }

    70% {
        transform: scale(0.95);
    }

    100% {
        transform: scale(1);
    }
}

.cart-toggle-count.pop {
    animation: cart-badge-pop 0.4s ease-out;
}

/* おまけ:🛒ボタン自体もちょっと弾むアニメ */
@keyframes cart-toggle-shake {

    0%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-6px);
    }

    60% {
        transform: translateY(2px);
    }
}

.cart-toggle.bump {
    animation: cart-toggle-shake 0.4s ease-out;
}

/* ----- スライドインカート ----- */
.cart-panel {
    position: fixed;
    top: 0;
    right: -460px;
    width: 440px;
    max-width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: 99998;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.35s ease;
    display: flex;
    flex-direction: column;
}

.cart-panel.open {
    right: 0;
}

.cart-panel-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
}

.cart-panel-header h2 {
    margin: 0;
    font-size: 1.3em;
}

.cart-panel-close {
    width: 32px;
    height: 32px;
    border: none;
    padding: 0 !important;
    background: #f0f0f0;
    color: #333;
    border-radius: 50%;
    line-height: 1 !important;
    font-size: 18px;
    cursor: pointer;
}

.cart-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 0 12px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: bold;
    margin: 0 0 4px;
    width: 100%;
    font-size: 0.95em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.variable-badge {
    display: inline-block;
    background: #f5a623;
    color: #fff;
    font-size: 0.7em;
    font-weight: bold;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}

.cart-item-price {
    color: #666;
    font-size: 0.85em;
    margin: 0;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cart-item-qty button {
    width: 28px;
    height: 28px;
    border: 1px solid #ccc;
    background: #fff;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

.cart-item-qty button:hover{
    background: inherit;
    color: inherit;
}

.cart-item-qty span {
    min-width: 24px;
    text-align: center;
}

.cart-item-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 20px;
    margin-left: 4px;
    padding: 4px;
    line-height: 1 !important;
}

.cart-item-remove:hover{
    background: #FFF;
}

.cart-empty {
    text-align: center;
    color: #999;
    padding: 40px 20px;
}

.cart-panel-footer {
    border-top: 2px solid #e0e0e0;
    padding: 20px;
    background: #fafafa;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 16px;
}

.cart-total-note {
    display: none;
    font-size: 0.8em;
    color: #8a6d3b;
    background: #fff8e1;
    border-left: 3px solid #f5a623;
    padding: 8px 10px;
    border-radius: 4px;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* ----- カスタム注文確定ボタン ----- */
.cart-checkout-btn {
    width: 100%;
    padding: 14px;
    background: #c41e3a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.cart-checkout-btn:hover:not(:disabled) {
    background: #a01830;
}

.cart-checkout-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.cart-checkout-btn.loading {
    opacity: 0.7;
    cursor: wait;
}

/* ----- スマホ対応 ----- */
@media (max-width: 600px) {
    .cart-panel {
        width: 100%;
        right: -100%;
    }

    .cart-toggle {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
}