/* VBH Basket Sync – cart / checkout frontend styles */

/* Availability badges */
.vbh-bs-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}

.vbh-bs-avail {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    line-height: 1.5;
}

.vbh-bs-in-stock {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.vbh-bs-partial {
    background: #fef9c3;
    color: #854d0e;
    border: 1px solid #fde047;
}

.vbh-bs-out-of-stock {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.vbh-bs-partial-extra {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fdba74;
    font-weight: 400;
}

/* Delivery date */
.vbh-bs-delivery {
    display: inline-block;
    font-size: 11px;
    color: #6b7280;
    padding: 2px 0;
    white-space: nowrap;
}
.vbh-bs-delivery::before {
    content: '📅 ';
}

/* Hide the WC Blocks "Proceed to Checkout" button when our submit form is on
 * the page. CSS :has() fires before JS, so there is no flash of the old button.
 * The JS in cart.js also hides it for browsers that don't support :has(). */
.wp-block-woocommerce-cart:has( .vbh-bs-cart-submit-wrap ) .wc-block-cart__submit-button,
.wp-block-woocommerce-cart:has( .vbh-bs-cart-submit-wrap ) .wp-block-woocommerce-proceed-to-checkout-block {
    display: none !important;
}

/* Direct-submit button area in cart totals */
.vbh-bs-cart-submit-wrap {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vbh-bs-cart-note {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    resize: vertical;
    font-family: inherit;
}
.vbh-bs-cart-note:focus {
    outline: none;
    border-color: #96588a;
    box-shadow: 0 0 0 2px rgba(150, 88, 138, .15);
}

/* Inherit WC Blocks button look so it blends in naturally */
.vbh-bs-submit-btn {
    width: 100%;
    text-align: center;
    cursor: pointer;
    border: none;
}
.vbh-bs-submit-btn:disabled {
    opacity: .65;
    cursor: not-allowed;
    pointer-events: none;
}

.vbh-bs-cart-error {
    font-size: 13px;
    padding: 8px 12px;
    margin: 0;
}

/* Web discount row in totals table */
tr.vbh-bs-discount-row th,
tr.vbh-bs-discount-row td {
    color: #166534;
    font-weight: 600;
    font-size: 13px;
}
tr.vbh-bs-discount-row td {
    color: #166534;
}

/* ══════════════════════════════════════════════════════════════════════════════
   [vbh_cart] shortcode — custom cart page layout
   ══════════════════════════════════════════════════════════════════════════════ */

.vbh-cart-wrap {
    max-width: 100%;
}

/* ── Items table ────────────────────────────────────────────────────────────── */

.vbh-cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}

.vbh-cart-table th {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 2px solid #e5e7eb;
    text-align: left;
    color: #374151;
    white-space: nowrap;
}

.vbh-cart-table td {
    padding: 16px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
    font-size: 14px;
    color: #374151;
}

.vbh-cart-table tr.cart_item:hover td {
    background: #fafafa;
}

/* Remove column */
.vbh-cart-table .product-remove {
    width: 36px;
}
.vbh-cart-table .product-remove a.remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fee2e2;
    color: #dc2626;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    line-height: 1;
    transition: background .15s, color .15s;
}
.vbh-cart-table .product-remove a.remove:hover {
    background: #dc2626;
    color: #fff;
}

/* Thumbnail column */
.vbh-cart-table .product-thumbnail {
    width: 80px;
}
.vbh-cart-table .product-thumbnail img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    display: block;
}

/* Product name column */
.vbh-cart-table .product-name a {
    font-weight: 600;
    color: #111827;
    text-decoration: none;
}
.vbh-cart-table .product-name a:hover {
    text-decoration: underline;
}

.vbh-cart-sku {
    display: block;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
    font-family: monospace;
}

/* BC badge row under name */
.vbh-cart-table .vbh-bs-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

/* Quantity input */
.vbh-cart-table .product-quantity {
    width: 100px;
}
.vbh-cart-qty-input {
    width: 72px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    -moz-appearance: textfield;
}
.vbh-cart-qty-input::-webkit-inner-spin-button,
.vbh-cart-qty-input::-webkit-outer-spin-button {
    opacity: 1;
}
.vbh-cart-qty-input:focus {
    outline: none;
    border-color: #96588a;
    box-shadow: 0 0 0 2px rgba(150, 88, 138, .15);
}

/* Price / subtotal columns */
.vbh-cart-table .product-price,
.vbh-cart-table .product-subtotal {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.vbh-cart-table .product-subtotal {
    font-weight: 700;
}

/* ── Actions row (coupon + update) ──────────────────────────────────────────── */

.vbh-cart-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 0 24px;
}

.vbh-cart-actions .coupon {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vbh-cart-actions .coupon label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.vbh-cart-actions .coupon input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    width: 160px;
}

.vbh-cart-update-btn {
    margin-left: auto;
}

/* ── Cart totals sidebar ────────────────────────────────────────────────────── */

.vbh-cart-collaterals {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.vbh-cart-totals {
    width: 100%;
    max-width: 420px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
}

.vbh-cart-totals h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 16px;
    padding: 0;
    color: #111827;
}

.vbh-cart-totals table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.vbh-cart-totals table th,
.vbh-cart-totals table td {
    padding: 10px 0;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

.vbh-cart-totals table th {
    font-weight: 600;
    color: #374151;
    text-align: left;
}

.vbh-cart-totals table td {
    text-align: right;
    color: #374151;
    font-variant-numeric: tabular-nums;
}

.vbh-cart-totals table tr:last-child th,
.vbh-cart-totals table tr:last-child td {
    border-bottom: none;
}

.vbh-cart-totals table tr.order-total th,
.vbh-cart-totals table tr.order-total td {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    padding-top: 14px;
}

/* ── CTA area inside totals ─────────────────────────────────────────────────── */

.vbh-cart-cta {
    margin-top: 4px;
}

/* "Proceed to Checkout" fallback button fills the box */
.vbh-cart-cta .checkout-button {
    display: block;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

/* BC submit wrap is already full-width from existing rules */

/* ── Empty cart state ────────────────────────────────────────────────────────── */

.vbh-cart-wrap .cart-empty {
    font-size: 15px;
    padding: 20px;
    background: #f9fafb;
    border-left: 4px solid #3b82f6;
    border-radius: 4px;
    color: #374151;
}

.vbh-cart-wrap .return-to-shop {
    margin-top: 16px;
}

/* ── Responsive — stack on mobile ───────────────────────────────────────────── */

@media (max-width: 767px) {
    .vbh-cart-table,
    .vbh-cart-table thead,
    .vbh-cart-table tbody,
    .vbh-cart-table tr,
    .vbh-cart-table th,
    .vbh-cart-table td {
        display: block;
        width: 100%;
    }

    .vbh-cart-table thead {
        display: none;
    }

    .vbh-cart-table tr.cart_item {
        display: grid;
        grid-template-columns: 36px 72px 1fr;
        grid-template-rows: auto auto;
        column-gap: 12px;
        padding: 16px 0;
        border-bottom: 1px solid #e5e7eb;
    }

    .vbh-cart-table td {
        padding: 2px 0;
        border: none;
    }

    .vbh-cart-table .product-remove {
        grid-column: 1;
        grid-row: 1 / 3;
        display: flex;
        align-items: center;
    }

    .vbh-cart-table .product-thumbnail {
        grid-column: 2;
        grid-row: 1 / 3;
    }

    .vbh-cart-table .product-name {
        grid-column: 3;
        grid-row: 1;
        font-size: 14px;
    }

    .vbh-cart-table .product-price,
    .vbh-cart-table .product-quantity,
    .vbh-cart-table .product-subtotal {
        grid-column: 3;
        text-align: left;
    }

    .vbh-cart-table td[data-title]::before {
        content: attr(data-title) ': ';
        font-weight: 700;
        font-size: 11px;
        text-transform: uppercase;
        color: #9ca3af;
        margin-right: 4px;
    }

    .vbh-cart-table .product-name td[data-title]::before,
    .vbh-cart-table .product-thumbnail td[data-title]::before,
    .vbh-cart-table .product-remove td[data-title]::before {
        content: none;
    }

    .vbh-cart-collaterals {
        justify-content: stretch;
    }

    .vbh-cart-totals {
        max-width: 100%;
    }

    .vbh-cart-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .vbh-cart-actions .coupon {
        flex-direction: column;
        align-items: stretch;
    }

    .vbh-cart-actions .coupon input {
        width: 100%;
    }

    .vbh-cart-update-btn {
        margin-left: 0;
        width: 100%;
    }
}
