/**
 * Cart page styles – moved from style.css.
 *
 * @package Blocksy_Child
 */

/* Container & Header */
.custom-cart-design {
    width: 100%;
    font-family: Arial, sans-serif;
    border-radius: 4px;
    overflow: visible;
}

.cart-header-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    background-color: #0081C9;
    color: white;
    padding: 12px 20px;
    font-weight: bold;
    font-size: 14px;
}

/* Rows */
.cart-item-row {
    background: #fff;
    border-bottom: 1px solid #eee;
}

.cart-item-main {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    align-items: center;
    padding: 15px 20px;
}

/* Product Column */
.product-info-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.product-info-wrapper img {
    width: 60px;
    height: auto;
    object-fit: contain;
}

/* Remove Row */
.cart-item-remove-row {
    background-color: #f9f9f9;
    padding: 8px 20px;
    text-align: right;
    border-top: 1px solid #f0f0f0;
}

.remove-link {
    color: #d32f2f !important;
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Quantity Input Styling */
.custom-qty-wrapper input.qty {
    width: 50px;
    background: #eef4ff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px;
    text-align: center;
}

/* Footer & Notice */
.delivery-notice {
    margin-top: 15px;
    padding: 10px;
    border: 1px solid #0081C9;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
}

/* Proceed to Checkout button – right bottom corner (WooCommerce default style) */
.woocommerce-cart .cart-proceed-checkout-wrapper,
.woocommerce .cart-proceed-checkout-wrapper {
    margin-top: 24px;
    margin-bottom: 24px;
    display: flex !important;
    visibility: visible !important;
    justify-content: flex-end;
    width: 100%;
}

.woocommerce-cart .cart-proceed-checkout-wrapper .checkout-button,
.woocommerce .cart-proceed-checkout-wrapper .checkout-button,
.cart-proceed-checkout-wrapper .checkout-button {
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    background-color: #0081C9 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px;
    text-decoration: none !important;
    display: inline-block !important;
    visibility: visible !important;
    transition: background-color 0.2s ease;
}

.woocommerce-cart .cart-proceed-checkout-wrapper .checkout-button:hover,
.woocommerce .cart-proceed-checkout-wrapper .checkout-button:hover,
.cart-proceed-checkout-wrapper .checkout-button:hover {
    background-color: #006ba3 !important;
    color: #fff !important;
}

/* Hide Update cart button – cart updates via AJAX */
.cart-footer-actions {
    display: none !important;
}

.update-cart-btn {
    margin-top: 20px;
    float: right;
}

/* Responsive */
@media (max-width: 768px) {
    .cart-header-grid { display: none; }
    .cart-item-main {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .product-info-wrapper { flex-direction: column; }
    .fee-content-wrapper {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* Larger touch target for info button on mobile */
@media (max-width: 480px) {
    .info-btn {
        padding: 8px;
        margin: -8px;
    }
}

.custom-qty-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Hide default WooCommerce spin buttons */
.custom-qty-wrapper input[type=number]::-webkit-inner-spin-button,
.custom-qty-wrapper input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.custom-qty-wrapper input.qty {
    min-width: 52px;
    width: 3.5em;
    height: 32px;
    border: 1px solid #ccc !important;
    text-align: center;
    background-color: #eef4ff !important;
    color: #333;
    border-radius: 4px;
    font-size: 14px;
    padding: 0 6px !important;
    box-sizing: content-box;
}

.qty-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn svg {
    width: 24px;
    height: 24px;
    fill: #0081C9;
    transition: transform 0.1s ease;
}

.qty-btn:active svg {
    transform: scale(0.9);
}

.custom-qty-wrapper input.qty {
    margin-left: 8px;
}

.recycling-fee-row {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 10px 0;
    overflow: visible;
}

.fee-content-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    align-items: center;
    padding: 0 20px;
}

.fee-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1b5e20;
    position: relative;
    overflow: visible;
}

.fee-icon {
    width: 24px;
    height: 24px;
    fill: #1b5e20;
}

.fee-text {
    font-size: 14px;
    font-weight: 500;
}

.info-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    touch-action: manipulation;
}

.info-btn svg {
    width: 18px;
    height: 18px;
    fill: #757575;
}

.recycling-fee-row .col-price,
.recycling-fee-row .col-qty,
.recycling-fee-row .col-subtotal {
    font-size: 14px;
    color: #333;
}

.recycling-fee-row .col-price,
.recycling-fee-row .col-qty {
    text-align: left;
}

.recycling-fee-row .col-subtotal {
    text-align: left;
    font-weight: bold;
}

.custom-qty-wrapper {
    margin-right: 166px;
}

/* Popover */
/* Popover wrap: positions popover relative to info button */
.custom-popover-wrap {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.custom-popover-card {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
    width: min(320px, calc(100vw - 32px));
    max-width: 320px;
    background-color: #fff;
    padding: 14px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.55;
    color: #333;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15),
                0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 99999;
    pointer-events: auto;
}

.custom-popover-card.is-visible {
    display: block;
}

.custom-popover-card p {
    margin: 0;
}

/* Arrow pointing up at info icon */
.custom-popover-card::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #fff;
    filter: drop-shadow(0 -2px 2px rgba(0, 0, 0, 0.06));
}

/* Mobile: full-width popover, stays in viewport */
@media (max-width: 480px) {
    .custom-popover-card {
        width: calc(100vw - 24px);
        max-width: none;
        left: 50%;
        transform: translateX(-50%);
        margin-left: 0;
    }
    .custom-popover-card::before {
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Quantity container */
.quantity-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: sans-serif;
}

.qty-btn:hover {
    opacity: 0.7;
}

.qty-btn svg {
    width: 28px;
    height: 28px;
    fill: #1976d2;
}

#qty-input {
    min-width: 52px;
    width: 3.5em;
    height: 32px;
    text-align: center;
    border: 1px solid #cccccc;
    border-radius: 4px;
    background-color: #eef4ff;
    color: #333333;
    font-size: 14px;
    outline: none;
    padding: 0 6px;
    box-sizing: content-box;
}

#qty-input::-webkit-outer-spin-button,
#qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.col-qty {
    margin-left: 36px;
}

.rec-col-qty {
    margin-left: 47px;
}

/* Cart notice (e.g. out of stock) – no icon overlap */
.sa-cart-notice.woocommerce-error::before,
.sa-cart-notice.woocommerce-error::after {
    display: none !important;
    content: none !important;
}
.sa-cart-notice.woocommerce-error {
    padding: 12px 16px !important;
    padding-left: 16px !important;
    margin-bottom: 16px;
    background: #f8f6f3;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #b81c23;
    border-radius: 4px;
    font-size: 14px;
    color: #333;
}
