/**
 * Cart page — Bebetill theme styling.
 */

body.bebetill-cart-page,
body.woocommerce-cart {
    --bt-cart-green: #15b86a;
}

/* Hide duplicate WP page title */
body.bebetill-cart-page .content-page > article > h1,
body.woocommerce-cart .content-page > article > h1,
body.bebetill-cart-page .content-page .entry-title,
body.woocommerce-cart .content-page .entry-title {
    display: none !important;
}

body.bebetill-cart-page .content-page,
body.woocommerce-cart .content-page {
    padding: 24px 0 64px;
}

body.bebetill-cart-page .content-page > article,
body.woocommerce-cart .content-page > article {
    margin: 0;
}

/* Layout shell */
.bt-cart {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    max-width: 100%;
    font-family: "Vazirmatn", var(--bt-font), Tahoma, sans-serif;
}

.bt-cart__crumb {
    font-size: 13px;
    color: var(--bt-muted);
}

.bt-cart__crumb .woocommerce-breadcrumb {
    margin: 0;
    padding: 0;
}

.bt-cart__crumb a {
    color: var(--bt-muted);
}

.bt-cart__crumb a:hover {
    color: var(--bt-green);
}

.bt-cart__crumb .breadcrumb-last {
    color: var(--bt-ink);
    font-weight: 600;
}

.bt-cart__head {
    margin: 0;
}

.bt-cart__title {
    margin: 0;
    color: var(--bt-ink);
    font-family: var(--bt-heading-font);
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 800;
    text-align: right;
}

/* Main layout: form (wide) + totals sidebar */
.bt-cart__grid {
    display: flex;
    flex-direction: row;
    gap: 24px;
    align-items: flex-start;
    width: 100%;
}

.bt-cart__grid .woocommerce-cart-form {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

.bt-cart__grid .cart-collaterals {
    flex: 0 0 300px;
    width: 300px;
    max-width: 100%;
}

/* Notices */
.bt-cart .woocommerce-message,
.bt-cart .woocommerce-info,
.bt-cart .woocommerce-error {
    margin: 0 0 16px;
    padding: 14px 18px;
    border: 1px solid #eee;
    border-radius: 14px;
    border-top: 0;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    font-size: 14px;
}

.bt-cart .woocommerce-message {
    border-color: rgba(76, 184, 62, 0.25);
    background: #f8fdf8;
}

.bt-cart .woocommerce-error {
    border-color: rgba(227, 35, 42, 0.2);
    background: #fff8f8;
}

/* Cart form card */
.bt-cart .woocommerce-cart-form {
    padding: 24px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

/* Force normal table layout (override WC responsive stacking on desktop) */
.bt-cart table.shop_table.cart {
    width: 100% !important;
    max-width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    table-layout: auto;
}

.bt-cart table.shop_table.cart thead {
    display: table-header-group !important;
}

.bt-cart table.shop_table.cart tbody {
    display: table-row-group !important;
}

.bt-cart table.shop_table.cart tr {
    display: table-row !important;
}

.bt-cart table.shop_table.cart th,
.bt-cart table.shop_table.cart td {
    display: table-cell !important;
    vertical-align: middle;
}

.bt-cart table.shop_table.cart thead th {
    padding: 0 12px 14px;
    color: var(--bt-muted);
    background: transparent;
    border: 0;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.bt-cart table.shop_table.cart tbody tr {
    border-bottom: 1px solid #f2f2f2;
}

.bt-cart table.shop_table.cart tbody tr:last-child {
    border-bottom: 0;
}

.bt-cart table.shop_table.cart td {
    padding: 18px 12px;
    border: 0;
    text-align: right;
}

.bt-cart table.shop_table.cart td::before {
    display: none !important;
    content: none !important;
}

.bt-cart .product-remove {
    width: 44px;
}

.bt-cart .product-thumbnail {
    width: 88px;
}

.bt-cart .product-thumbnail img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border: 1px solid #eee;
    border-radius: 12px;
}

.bt-cart .product-name {
    min-width: 180px;
}

.bt-cart .product-name a {
    color: var(--bt-ink);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.6;
}

.bt-cart .product-name a:hover {
    color: var(--bt-green-dark);
}

.bt-cart .product-name .variation {
    display: block;
    margin-top: 4px;
    color: var(--bt-muted);
    font-size: 13px;
}

.bt-cart .product-price,
.bt-cart .product-subtotal {
    color: var(--bt-ink);
    font-family: var(--bt-product-font);
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.bt-cart .product-price .amount,
.bt-cart .product-subtotal .amount {
    color: var(--bt-green-dark);
}

.bt-cart .product-remove a.remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--bt-muted) !important;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
}

.bt-cart .product-remove a.remove:hover {
    color: #fff !important;
    background: var(--bt-red);
}

/* Quantity */
.bt-cart .quantity {
    display: inline-flex !important;
    align-items: stretch;
    overflow: hidden;
    width: 110px !important;
    height: 42px !important;
    margin: 0 !important;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    direction: ltr;
}

.bt-cart .quantity .qty {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    color: var(--bt-ink);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    -moz-appearance: textfield;
}

.bt-cart .quantity .qty::-webkit-outer-spin-button,
.bt-cart .quantity .qty::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.bt-cart .quantity .minus,
.bt-cart .quantity .plus {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 36px;
    padding: 0;
    color: #444;
    background: #fafafa;
    border: 0;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.bt-cart .quantity .minus {
    border-right: 1px solid #eee;
}

.bt-cart .quantity .plus {
    border-left: 1px solid #eee;
}

/* Cart actions */
.bt-cart .woocommerce-cart-form .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.bt-cart .coupon {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.bt-cart .coupon label {
    display: none;
}

.bt-cart .coupon input.input-text {
    min-width: 180px;
    height: 42px;
    padding: 0 14px;
    color: var(--bt-ink);
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
}

.bt-cart button[name="update_cart"],
.bt-cart .coupon button {
    min-height: 42px;
    padding: 0 18px;
    color: var(--bt-ink) !important;
    background: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 10px !important;
    box-shadow: none !important;
    font-family: var(--bt-button-font);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transform: none !important;
}

.bt-cart button[name="update_cart"]:hover,
.bt-cart .coupon button:hover {
    background: #fafafa !important;
    border-color: #ccc !important;
}

/* Totals sidebar */
.bt-cart .cart_totals {
    padding: 24px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.bt-cart .cart_totals > h2 {
    margin: 0 0 18px;
    padding-bottom: 14px;
    color: var(--bt-ink);
    font-family: var(--bt-heading-font);
    font-size: 20px;
    font-weight: 800;
    border-bottom: 1px solid #eee;
}

.bt-cart .cart_totals table {
    width: 100%;
    margin: 0 0 20px;
    border: 0;
    border-collapse: collapse;
}

.bt-cart .cart_totals th,
.bt-cart .cart_totals td {
    padding: 10px 0;
    border: 0;
    border-bottom: 1px dashed #eee;
    font-size: 14px;
    text-align: right;
}

.bt-cart .cart_totals th {
    color: var(--bt-muted);
    font-weight: 600;
}

.bt-cart .cart_totals td {
    text-align: left;
    color: var(--bt-ink);
    font-weight: 700;
}

.bt-cart .cart_totals .order-total th,
.bt-cart .cart_totals .order-total td {
    padding-top: 14px;
    border-bottom: 0;
    font-size: 16px;
}

.bt-cart .cart_totals .order-total .amount {
    color: var(--bt-green-dark);
    font-size: 18px;
    font-weight: 800;
}

.bt-cart .wc-proceed-to-checkout {
    margin: 0;
    padding: 0;
}

/* Primary buttons — same as homepage add to cart (.bt-product-card) */
.bt-cart .wc-proceed-to-checkout .checkout-button,
.bt-cart .wc-proceed-to-checkout a.button,
.bt-cart .return-to-shop .button,
.bt-cart .cross-sells .add_to_cart_button,
.bt-cart .cross-sells .button,
.bt-cart .cross-sells .product_type_simple {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 9px 14px !important;
    color: #fff !important;
    background: linear-gradient(135deg, var(--bt-red), var(--bt-orange)) !important;
    border: 0 !important;
    border-radius: 16px !important;
    box-shadow: 0 14px 28px rgba(227, 35, 42, 0.22) !important;
    font-family: var(--bt-button-font);
    font-size: 0.86rem !important;
    font-weight: 900 !important;
    line-height: 1.4;
    cursor: pointer;
    transform: none !important;
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.bt-cart .wc-proceed-to-checkout .checkout-button,
.bt-cart .wc-proceed-to-checkout a.button {
    width: 100%;
    min-height: 50px;
    font-size: 0.9rem !important;
}

.bt-cart .cross-sells .add_to_cart_button,
.bt-cart .cross-sells .button,
.bt-cart .cross-sells .product_type_simple {
    width: 100%;
    margin-top: 12px;
}

.bt-cart .wc-proceed-to-checkout .checkout-button:hover,
.bt-cart .wc-proceed-to-checkout a.button:hover,
.bt-cart .return-to-shop .button:hover,
.bt-cart .cross-sells .add_to_cart_button:hover,
.bt-cart .cross-sells .button:hover,
.bt-cart .cross-sells .product_type_simple:hover {
    color: #fff !important;
    background: linear-gradient(135deg, var(--bt-red-dark), var(--bt-orange)) !important;
    transform: translateY(-2px);
}

/* Empty cart */
.bt-cart .cart-empty.woocommerce-info {
    margin: 0;
    padding: 48px 24px;
    text-align: center;
    border-radius: 18px;
}

.bt-cart .return-to-shop {
    margin-top: 16px;
    text-align: center;
}

/* Cross-sells */
.bt-cart .cross-sells {
    flex: 1 1 100%;
    width: 100%;
    margin-top: 8px;
}

.bt-cart .cross-sells > h2 {
    margin: 0 0 18px;
    font-family: var(--bt-heading-font);
    font-size: 20px;
    font-weight: 800;
}

.bt-cart .cross-sells ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

/* Mobile: stack sidebar + card rows */
@media (max-width: 900px) {
    .bt-cart__grid {
        flex-direction: column;
    }

    .bt-cart__grid .cart-collaterals {
        flex: 1 1 auto;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .bt-cart .woocommerce-cart-form {
        padding: 16px;
    }

    .bt-cart table.shop_table.cart thead {
        display: none !important;
    }

    .bt-cart table.shop_table.cart tbody tr.cart_item {
        display: grid !important;
        grid-template-columns: 72px 1fr;
        gap: 8px 14px;
        padding: 16px 0;
        position: relative;
    }

    .bt-cart table.shop_table.cart tbody tr.cart_item td {
        display: block !important;
        padding: 0;
    }

    .bt-cart table.shop_table.cart tbody tr.cart_item td::before {
        display: block !important;
        margin-bottom: 4px;
        color: var(--bt-muted);
        font-size: 12px;
        font-weight: 600;
        content: attr(data-title) !important;
    }

    .bt-cart .product-thumbnail {
        grid-row: 1 / span 4;
    }

    .bt-cart .product-remove {
        position: absolute;
        top: 16px;
        left: 0;
    }

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

    .bt-cart .coupon {
        width: 100%;
    }

    .bt-cart .coupon input.input-text {
        flex: 1;
        min-width: 0;
    }

    .bt-cart .cross-sells ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .bt-cart .cross-sells ul.products {
        grid-template-columns: 1fr;
    }
}
