/**
 * カートページ — 和モダン（機能・マークアップは変更しない）
 *
 * 条件: body に .woocommerce-cart（WooCommerce がカート画面で付与）
 * ラッパー: page.php は #primary > .site-main。環境差で .site-main が無い場合に備え #primary / .entry-content も指定。
 */

body.woocommerce-cart #primary,
body.woocommerce-cart .site-main,
body.woocommerce-cart .entry-content {
    font-family: var(--tbt-font-sans, 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic UI', Meiryo, sans-serif);
}

body.woocommerce-cart #primary .woocommerce,
body.woocommerce-cart .site-main .woocommerce,
body.woocommerce-cart .entry-content > .woocommerce {
    max-width: min(1080px, 100%);
    margin-left: auto;
    margin-right: auto;
    padding-bottom: clamp(1.5rem, 4vw, 2.5rem);
}

/* 見出し */
body.woocommerce-cart .entry-header {
    margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

body.woocommerce-cart .entry-title {
    font-family: var(--tbt-font-sans, 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic UI', Meiryo, sans-serif);
    font-size: clamp(1.35rem, 3vw, 1.65rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #111;
    border-bottom: 2px solid rgba(127, 38, 41, 0.35);
    padding-bottom: 0.45rem;
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
}

/* 送料ナッジ（functions の tbt_cart_free_shipping_nudge） */
body.woocommerce-cart .tbt-cart-shipping-nudge {
    border-radius: 12px;
    border: 1px solid rgba(184, 139, 70, 0.55);
    background: linear-gradient(135deg, rgba(255, 252, 248, 0.98) 0%, rgba(248, 242, 232, 0.95) 100%);
    box-shadow: 0 6px 20px rgba(45, 32, 22, 0.06);
    padding: 0.85rem 1.1rem;
    margin-bottom: 1.25rem;
}

body.woocommerce-cart .tbt-cart-shipping-nudge__text {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* 通知 */
body.woocommerce-cart .woocommerce-notices-wrapper {
    margin-bottom: 1rem;
}

body.woocommerce-cart .woocommerce-message,
body.woocommerce-cart .woocommerce-info,
body.woocommerce-cart .woocommerce-error {
    border-radius: 12px;
    border-width: 1px;
    box-shadow: 0 4px 14px rgba(40, 28, 18, 0.06);
    font-size: 0.95rem;
    line-height: 1.65;
}

/* 2カラム：カートフォーム + サイド（合計） */
@media (min-width: 960px) {
    body.woocommerce-cart #primary .woocommerce,
    body.woocommerce-cart .site-main .woocommerce,
    body.woocommerce-cart .entry-content > .woocommerce {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
        gap: clamp(1.25rem, 2.5vw, 2rem);
        align-items: start;
    }

    body.woocommerce-cart .woocommerce-cart-form {
        margin: 0;
    }
}

/* カートフォームカード（和紙背景から切り離して視認性アップ） */
body.woocommerce-cart .woocommerce-cart-form {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.985), rgba(252, 248, 242, 0.98));
    border: 1px solid rgba(224, 214, 200, 0.95);
    border-left: 4px solid rgba(127, 38, 41, 0.55);
    border-radius: 16px;
    padding: clamp(0.85rem, 1.8vw, 1.2rem);
    box-shadow:
        0 12px 40px rgba(40, 28, 18, 0.09),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    box-sizing: border-box;
}

body.woocommerce-cart table.shop_table.cart {
    border: none !important;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0 !important;
    background: rgba(255, 252, 248, 0.55);
}

body.woocommerce-cart table.shop_table.cart thead {
    background: linear-gradient(180deg, rgba(127, 38, 41, 0.09), rgba(127, 38, 41, 0.04));
}

body.woocommerce-cart table.shop_table.cart thead th {
    font-family: var(--tbt-font-sans, 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic UI', Meiryo, sans-serif);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #3a3228;
    padding: 0.85rem 0.65rem !important;
    border-bottom: 1px solid rgba(127, 38, 41, 0.12) !important;
    text-transform: none;
}

body.woocommerce-cart table.shop_table.cart tbody tr {
    transition: background-color 0.15s ease;
}

body.woocommerce-cart table.shop_table.cart tbody tr:hover {
    background: rgba(255, 255, 255, 0.82);
}

body.woocommerce-cart table.shop_table.cart tbody td {
    border-color: rgba(224, 214, 200, 0.75) !important;
    padding: clamp(0.75rem, 1.5vw, 1rem) 0.65rem !important;
    vertical-align: middle !important;
    font-size: 0.94rem;
    line-height: 1.55;
    background: rgba(255, 255, 255, 0.35);
}

body.woocommerce-cart table.shop_table.cart .product-thumbnail img {
    border-radius: 10px;
    border: 1px solid rgba(224, 214, 200, 0.9);
    box-shadow: 0 2px 10px rgba(40, 28, 18, 0.06);
    max-width: 72px;
    height: auto;
}

body.woocommerce-cart table.shop_table.cart .product-name a {
    font-weight: 700;
    color: var(--tbt-enzhi, #7f2629);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
}

body.woocommerce-cart table.shop_table.cart .product-name a:hover {
    color: var(--tbt-senju, #d0826c);
    border-bottom-color: rgba(208, 130, 108, 0.5);
}

body.woocommerce-cart table.shop_table.cart .product-name dl.variation {
    margin: 0.4rem 0 0;
    font-size: 0.82rem;
    color: #5c534a;
}

body.woocommerce-cart table.shop_table.cart .product-name dl.variation dt {
    font-weight: 600;
    clear: left;
    float: left;
    margin-right: 0.35rem;
}

body.woocommerce-cart table.shop_table.cart .product-price,
body.woocommerce-cart table.shop_table.cart .product-subtotal {
    font-weight: 700;
    color: #2e2a26;
}

/* 削除：テキスト／×を隠し、薄い円上にゴミ箱シルエット（単色SVG） */
body.woocommerce-cart table.shop_table.cart a.remove {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 2.15rem !important;
    height: 2.15rem !important;
    border-radius: 999px !important;
    background-color: rgba(255, 252, 248, 0.95) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23221c19' d='M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4zM10 9v9h2V9h-2zm4 0v9h2V9h-2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 52% 52% !important;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 0 !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
    border: 1px solid rgba(127, 38, 41, 0.2);
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        transform 0.12s ease;
}

body.woocommerce-cart table.shop_table.cart a.remove:hover {
    background-color: rgba(252, 236, 232, 0.98) !important;
    border-color: rgba(127, 38, 41, 0.45);
    transform: scale(1.06);
}

/* 数量 */
body.woocommerce-cart table.shop_table.cart .quantity {
    display: inline-flex;
    align-items: center;
}

body.woocommerce-cart table.shop_table.cart .quantity .qty {
    min-width: 3.25rem;
    padding: 0.45rem 0.5rem !important;
    border-radius: 10px !important;
    border: 1px solid rgba(148, 124, 98, 0.45) !important;
    font-weight: 600;
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
}

body.woocommerce-cart table.shop_table.cart .quantity .qty:focus {
    border-color: var(--tbt-enzhi, #7f2629) !important;
    outline: 2px solid rgba(127, 38, 41, 0.15);
    outline-offset: 1px;
}

/* アクション行（クーポン・更新） */
body.woocommerce-cart .woocommerce-cart-form .actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    padding: clamp(0.85rem, 2vw, 1.1rem) 0.35rem 0.25rem !important;
    margin-top: 0.35rem !important;
    border-top: 1px dashed rgba(184, 139, 70, 0.35);
    background: transparent !important;
}

body.woocommerce-cart .woocommerce-cart-form .actions .coupon {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 220px;
}

body.woocommerce-cart .woocommerce-cart-form .actions .coupon .input-text {
    flex: 1 1 140px;
    min-width: 0;
    max-width: 220px;
    padding: 0.55rem 0.75rem !important;
    border-radius: 10px !important;
    border: 1px solid rgba(148, 124, 98, 0.4) !important;
}

body.woocommerce-cart .woocommerce-cart-form .actions .button {
    border-radius: 10px !important;
    padding: 0.55rem 1rem !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(127, 38, 41, 0.12);
}

body.woocommerce-cart .woocommerce-cart-form .actions > .button {
    margin-left: auto !important;
}

body.woocommerce-cart .woocommerce-cart-form .actions .button:disabled,
body.woocommerce-cart .woocommerce-cart-form .actions .button[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

/* 合計エリア */
body.woocommerce-cart .cart-collaterals {
    width: 100%;
    max-width: 100%;
}

body.woocommerce-cart .cart_totals {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.99) 0%, rgba(252, 247, 240, 0.99) 100%);
    border: 2px solid rgba(127, 38, 41, 0.22);
    border-radius: 16px;
    padding: clamp(1rem, 2.2vw, 1.35rem);
    box-shadow:
        0 14px 42px rgba(45, 32, 22, 0.11),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

body.woocommerce-cart .cart_totals > h2 {
    font-family: var(--tbt-font-sans, 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic UI', Meiryo, sans-serif);
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.06em;
    color: #111;
    margin: 0 0 1rem !important;
    padding-bottom: 0.55rem;
    border-bottom: 2px solid rgba(127, 38, 41, 0.15);
}

body.woocommerce-cart .cart_totals table.shop_table_responsive {
    border: none !important;
    margin-bottom: 1rem !important;
}

body.woocommerce-cart .cart_totals table.shop_table_responsive th,
body.woocommerce-cart .cart_totals table.shop_table_responsive td {
    border: none !important;
    border-bottom: 1px solid rgba(224, 214, 200, 0.85) !important;
    padding: 0.65rem 0 !important;
    font-size: 0.92rem;
}

body.woocommerce-cart .cart_totals table.shop_table_responsive th {
    font-weight: 600;
    color: #5c534a;
}

body.woocommerce-cart .cart_totals table.shop_table_responsive .order-total th,
body.woocommerce-cart .cart_totals table.shop_table_responsive .order-total td {
    border-bottom: none !important;
    padding-top: 0.85rem !important;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--tbt-enzhi, #7f2629);
}

body.woocommerce-cart .wc-proceed-to-checkout {
    padding-top: 0.25rem;
    margin-bottom: 0 !important;
}

body.woocommerce-cart .wc-proceed-to-checkout .checkout-button {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 0.95rem 1.25rem !important;
    border-radius: 12px !important;
    font-size: 1rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.06em;
    color: #fff !important;
    box-shadow: 0 6px 20px rgba(127, 38, 41, 0.22);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

body.woocommerce-cart .wc-proceed-to-checkout .checkout-button:hover,
body.woocommerce-cart .wc-proceed-to-checkout .checkout-button:focus {
    color: #fff !important;
}

body.woocommerce-cart .wc-proceed-to-checkout .checkout-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 26px rgba(127, 38, 41, 0.28);
}

/* WC Blocks: 購入手続きボタンの可読性（赤文字化を抑止） */
body.woocommerce-cart .wc-block-cart__submit-button,
body.woocommerce-cart .wc-block-components-button.wc-block-cart__submit-button,
body.woocommerce-cart .wc-block-components-button.contained.wc-block-cart__submit-button {
    color: #fff !important;
    border-color: var(--tbt-enzhi, #7f2629) !important;
}

body.woocommerce-cart .wc-block-cart__submit-button:hover,
body.woocommerce-cart .wc-block-cart__submit-button:focus-visible {
    color: #fff !important;
}

/* WC Blocks: 削除リンクの赤背景混入を防ぎ、通常のゴミ箱UIに寄せる */
body.woocommerce-cart .wc-block-cart-item__remove-link,
body.woocommerce-cart .wc-block-components-product-metadata__description .wc-block-cart-item__remove-link {
    color: #4a3f37 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* クロスセル */
body.woocommerce-cart .cross-sells {
    margin-top: clamp(1.5rem, 3vw, 2rem);
    padding: 1.25rem 1rem 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(224, 214, 200, 0.85);
    background: linear-gradient(180deg, rgba(255, 252, 248, 0.96), rgba(246, 238, 228, 0.9));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* カート下部：通販トップへ／ページ上部へ（.tbt-shop-end-nav--content） */
body.woocommerce-cart .woocommerce .tbt-shop-end-nav--content {
    margin-top: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: 0.5rem;
}

body.woocommerce-cart .cross-sells > h2 {
    font-family: var(--tbt-font-sans, 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic UI', Meiryo, sans-serif);
    font-size: 1.02rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.04em;
    color: #111;
    margin-bottom: 0.85rem !important;
}

/* ワイド：合計を右カラムに。cross-sells は下段フル幅（.cart-collaterals を display:contents で透過） */
@media (min-width: 960px) {
    body.woocommerce-cart #primary .woocommerce .cart-collaterals,
    body.woocommerce-cart .site-main .woocommerce .cart-collaterals,
    body.woocommerce-cart .entry-content > .woocommerce .cart-collaterals {
        display: contents;
    }

    body.woocommerce-cart #primary .woocommerce .woocommerce-cart-form,
    body.woocommerce-cart .site-main .woocommerce .woocommerce-cart-form,
    body.woocommerce-cart .entry-content > .woocommerce .woocommerce-cart-form {
        grid-column: 1;
        grid-row: 1;
    }

    body.woocommerce-cart #primary .woocommerce .cart_totals,
    body.woocommerce-cart .site-main .woocommerce .cart_totals,
    body.woocommerce-cart .entry-content > .woocommerce .cart_totals {
        grid-column: 2;
        grid-row: 1;
        position: sticky;
        top: calc(var(--wp-admin--admin-bar--height, 0px) + 5.5rem);
        align-self: start;
    }

    body.woocommerce-cart #primary .woocommerce .cross-sells,
    body.woocommerce-cart .site-main .woocommerce .cross-sells,
    body.woocommerce-cart .entry-content > .woocommerce .cross-sells {
        grid-column: 1 / -1;
        grid-row: 2;
        margin-top: 0.5rem;
        padding-top: 1.5rem;
        border-top: 1px solid rgba(224, 214, 200, 0.85);
    }
}

/* 空カート */
body.woocommerce-cart .cart-empty {
    font-family: var(--tbt-font-serif, 'Noto Serif JP', serif);
    font-size: clamp(1rem, 2.2vw, 1.12rem);
    text-align: center;
    padding: clamp(1.45rem, 4vw, 2.2rem) clamp(0.9rem, 2.6vw, 1.4rem) !important;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 248, 242, 0.94));
    border: 1px solid rgba(184, 139, 70, 0.28);
    box-shadow: 0 10px 28px rgba(40, 28, 18, 0.08);
    letter-spacing: 0.03em;
}

body.woocommerce-cart .return-to-shop .button {
    border-radius: 12px !important;
    margin-top: 1rem;
    min-width: min(100%, 320px);
    text-align: center;
}

/* モバイル：テーブルレスポンシブ（Woo 既定の縦積みを維持しつつ余白調整） */
@media (max-width: 768px) {
    body.woocommerce-cart table.shop_table_responsive.cart tbody tr {
        margin-bottom: 0.85rem;
        padding: 0.65rem 0.5rem;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.55);
        border: 1px solid rgba(224, 214, 200, 0.65) !important;
    }

    body.woocommerce-cart table.shop_table_responsive.cart tbody td {
        padding: 0.45rem 0.5rem !important;
    }

    body.woocommerce-cart .woocommerce-cart-form .actions {
        flex-direction: column;
        align-items: stretch;
    }

    body.woocommerce-cart .woocommerce-cart-form .actions > .button {
        margin-left: 0 !important;
        width: 100%;
    }

    body.woocommerce-cart .woocommerce-cart-form .actions .coupon {
        width: 100%;
    }

    body.woocommerce-cart .woocommerce-cart-form .actions .coupon .input-text {
        max-width: none;
    }

    /* カートではモバイル上部に出るサイドメニューを非表示にする */
    body.woocommerce-cart .sidebar-wrap,
    body.woocommerce-cart .sidebar-wrap--aux,
    body.woocommerce-cart #secondary {
        display: none !important;
    }
}

/* WC Blocks カート（ブロックテンプレート利用時の最低限の調和） */
body.woocommerce-cart .wp-block-woocommerce-empty-cart-block,
body.woocommerce-cart .wc-block-cart {
    max-width: min(1080px, 100%);
    margin-left: auto;
    margin-right: auto;
}

body.woocommerce-cart .wc-block-cart,
body.woocommerce-cart .wc-block-components-totals-item,
body.woocommerce-cart .wc-block-components-product-name {
    font-family: var(--tbt-font-sans, 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic UI', Meiryo, sans-serif);
}

body.woocommerce-cart .wc-block-cart__main {
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(252, 247, 240, 0.96)) !important;
    padding: 0.75rem !important;
    box-shadow: inset 0 0 0 1px rgba(224, 214, 200, 0.65);
}

body.woocommerce-cart .wc-block-components-sidebar-layout .wc-block-components-sidebar {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.98), rgba(252, 246, 238, 0.97)) !important;
    border-radius: 16px !important;
    padding: 1rem !important;
    box-shadow: inset 0 0 0 1px rgba(224, 206, 186, 0.55);
}

body.woocommerce-cart .wc-block-components-panel {
    border-radius: 12px;
    background: rgba(255, 252, 248, 0.75) !important;
}

/* カート：お渡し方法セレクター（DPS） */
body.woocommerce-cart .dps-delivery-method-selector {
    background: linear-gradient(180deg, rgba(255, 252, 248, 0.98), rgba(246, 238, 226, 0.95)) !important;
    border: 1px solid rgba(127, 38, 41, 0.16) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

body.woocommerce-cart .dps-delivery-method-selector h3,
body.woocommerce-cart .dps-method-button {
    font-family: var(--tbt-font-sans, 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic UI', Meiryo, sans-serif);
    color: #111;
}

body.woocommerce-cart .dps-method-button {
    font-weight: 800 !important;
    background: rgba(255, 255, 255, 0.92) !important;
}

body.woocommerce-cart .dps-method-icon {
    font-size: 0 !important;
    line-height: 0 !important;
    width: 1.28rem !important;
    height: 1.28rem !important;
    display: inline-block !important;
    vertical-align: middle;
    background-color: #221c19;
    opacity: 0.88;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
}

body.woocommerce-cart .dps-method-button[data-method='pickup'] .dps-method-icon {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M3 21V9.5L12 4l9 5.5V21h-5.5v-6h-5v6H3zm9-11h3v6h-3v-6z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M3 21V9.5L12 4l9 5.5V21h-5.5v-6h-5v6H3zm9-11h3v6h-3v-6z'/%3E%3C/svg%3E");
}

body.woocommerce-cart .dps-method-button[data-method='delivery'] .dps-method-icon {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M2 10h10v6H2v-6zm11-1h2.5l4.5 3.5V17h-7v-8z'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M2 10h10v6H2v-6zm11-1h2.5l4.5 3.5V17h-7v-8z'/%3E%3C/svg%3E");
}

/* 一覧の視認性（機能・クラス名はそのまま） */
body.woocommerce-cart table.shop_table.cart tbody td.product-name {
    font-size: 0.98rem;
}

body.woocommerce-cart table.shop_table.cart tbody td.product-subtotal {
    font-size: 1rem;
    letter-spacing: 0.02em;
}

body.woocommerce-cart .woocommerce-cart-form__contents {
    border-collapse: separate;
    border-spacing: 0;
}

@media (min-width: 769px) {
    body.woocommerce-cart table.shop_table.cart thead th.product-name {
        min-width: 38%;
    }
}
