/**
 * Cart Optimization Styles
 */

/* ========================================
   Free Shipping Progress Bar
   ======================================== */
.dmn-free-shipping-bar {
    background: #f8f9fa;
    padding: var(--dmn-button-padding);
    margin-bottom: 20px;
    border-radius: var(--dmn-button-radius);
    box-shadow: var(--dmn-box-shadow);
    text-align: center;
}

.fs-message {
    font-size: var(--dmn-font-size);
    margin-bottom: 10px;
    display: block;
    color: #333;
    font-weight: 500;
}

.fs-progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.fs-progress-fill {
    height: 100%;
    background: #27ae60;
    /* Green */
    border-radius: 4px;
    transition: width 0.5s ease;
}

.fs-success-message {
    color: #27ae60;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ========================================
   Trust Badges (Cart Totals)
   ======================================== */
.cart-trust-badges {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #ddd;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.cart-trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

.cart-trust-item svg {
    width: 18px;
    height: 18px;
    color: #27ae60;
    flex-shrink: 0;
}

/* ========================================
   Mobile Layout (Cards)
   ======================================== */
@media (max-width: 768px) {
    .cart-trust-badges-wrapper .dmn-trust-badge {
        font-size: 11px !important;
    }

    .fs-success-message {
        font-size: 14px;
    }

    /* Hide standard table headers */
    .shop_table.cart thead {
        display: none;
    }

    .shop_table.cart tbody tr {
        display: block;
        background: #fff;
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 8px;
        border: 1px solid #eee;
        position: relative;
    }

    .shop_table.cart td {
        display: block;
        padding: 0 !important;
        border: none !important;
    }

    /* Product Thumbnail */
    .shop_table.cart td.product-thumbnail {
        grid-area: image;
    }

    .shop_table.cart td.product-thumbnail img {
        width: 80px !important;
        height: 80px !important;
        object-fit: cover;
        border-radius: 4px;
    }

    /* Product Name */
    .shop_table.cart td.product-name {
        grid-area: title;
        font-weight: 700;
        font-size: 14px;
        align-self: start;
    }

    .shop_table.cart td.product-name a {
        text-decoration: none;
        color: #333;
    }

    /* Price */
    .shop_table.cart td.product-price {
        grid-area: price;
        font-size: 13px;
        color: #666;
    }

    /* Quantity */
    .shop_table.cart td.product-quantity {
        grid-area: qty;
        align-self: center;
    }

    /* Subtotal */
    .shop_table.cart td.product-subtotal {
        grid-area: subtotal;
        font-weight: 700;
        text-align: right;
        color: #333;
    }

    /* Remove Button (Trash icon) */
    .shop_table.cart td.product-remove {
        grid-area: remove;
        position: absolute;
        top: 10px;
        right: 10px;
    }

    .shop_table.cart td.product-remove .remove {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        background: #fff0f0;
        color: #dc3545 !important;
        border-radius: 50%;
        font-size: 16px;
        text-decoration: none;
    }

    /* Sticky Checkout Button logic handled largely by structure, but minor styling here */
    .mobile-sticky-checkout {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        padding: 15px;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        z-index: 999;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .mobile-sticky-checkout .checkout-button {
        width: 100%;
        display: block;
        text-align: center;
        margin: 0 !important;
    }

    /* Hide the original checkout button in cart totals to avoid duplicates if we want */
    /* .wc-proceed-to-checkout { display: none; } */

    /* Ensure footer doesn't hide it (add padding to body or wrapper) */
    body.woocommerce-cart {
        padding-bottom: 80px;
    }

    /* Cart Actions (Coupon + Update) */
    .woocommerce-cart-form .actions {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
        padding: 15px !important;
        background: #f8f9fa;
        border-radius: 8px;
        margin-top: 15px !important;
    }

    .woocommerce-cart-form .coupon {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
        margin: 0 !important;
    }

    .woocommerce-cart-form .coupon label {
        display: block !important;
        font-size: 13px !important;
        font-weight: 600 !important;
        margin-bottom: 5px !important;
        color: #333;
    }

    .woocommerce-cart-form .coupon input[type="text"] {
        width: 100% !important;
        padding: 12px !important;
        border: 1px solid #ddd !important;
        border-radius: 6px !important;
        font-size: 14px !important;
        box-sizing: border-box !important;
    }

    .woocommerce-cart-form .coupon button[type="submit"] {
        width: 100% !important;
        padding: 12px !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        border-radius: 6px !important;
        margin: 0 !important;
    }

    .woocommerce-cart-form button[name="update_cart"] {
        width: 100% !important;
        padding: 12px !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        border-radius: 6px !important;
        margin: 0 !important;
        border: 1px solid #ddd !important;
        color: #333 !important;
    }

    .woocommerce-cart-form button[name="update_cart"]:hover {
        background: #f0f0f0 !important;
    }

    /* Cart Totals */
    .cart-collaterals {
        padding: 0px !important;
    }

    .cart-collaterals .cart_totals {
        width: 100% !important;
        margin-top: 20px !important;
    }

    .cart-collaterals .cart_totals h2 {
        font-size: 18px !important;
        margin-bottom: 15px !important;
    }

    .cart-collaterals .cart_totals table {
        font-size: 14px !important;
    }

    .cart-collaterals .cart_totals .wc-proceed-to-checkout {
        padding: 0 !important;
    }

    .cart-collaterals .cart_totals .wc-proceed-to-checkout .checkout-button {
        width: 100% !important;
        padding: 15px !important;
        font-size: 16px !important;
        font-weight: 700 !important;
    }

    /* Trust badges responsive */
    .cart-trust-badges {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .cart-trust-item {
        font-size: 11px !important;
    }
}

/* ========================================
   Cross Sells (Compact)
   ======================================== */
.cart-collaterals .cross-sells {
    width: 100%;
    margin-top: 30px;
    padding-top: 20px;
}

.cross-sells>h2 {
    font-size: 18px !important;
    margin-bottom: 15px !important;
    color: #444;
}

.cross-sells ul.products {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
    gap: 15px !important;
    margin: 0 !important;
}

.cross-sells ul.products li.product {
    text-align: center;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    /* Small radius */
    padding: 10px !important;
    transition: all 0.2s;
    width: 100% !important;
    margin: 0 !important;
    float: none !important;
}

.cross-sells ul.products li.product:hover {
    border-color: #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cross-sells ul.products li.product img {
    margin-bottom: 8px !important;
    height: 100px !important;
    /* Force small height */
    width: auto !important;
    object-fit: contain !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.cross-sells ul.products li.product h2.woocommerce-loop-product__title {
    font-size: 13px !important;
    padding: 0 !important;
    margin: 0 0 5px !important;
    line-height: 1.3 !important;
    min-height: 2.6em;
    /* 2 lines */
    overflow: hidden;
}

.cross-sells ul.products li.product .price {
    font-size: 13px !important;
    color: #333;
    font-weight: 700;
    display: block !important;
    margin-bottom: 8px !important;
}

.cross-sells ul.products li.product .button {
    font-size: 12px !important;
    padding: 6px 12px !important;
    width: 100% !important;
    min-height: auto !important;
    line-height: normal !important;
    margin-top: 5px !important;
    border-radius: var(--dmn-button-radius) !important;
}

.cross-sells ul.products li.product span.onsale {
    width: 75px !important;
    height: 10px !important;
    font-size: 11px !important;
}