:root {
    --primary-color: #768071;
    --offer-background: #fff8e1;
    --offer-border: #4E1C50;
    --text-color: #323232;
    --light-text-color: #666;
    --border-color: #eee;
    --input-border: #ccc;
    --background-color: #fff;
    --summary-background: #fcfcfc;
    --discount-color: #9C7B98;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.custom-cart {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    font-family: Arial, sans-serif;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
}

.cart-content {
    display: flex;
    flex-direction: row;
    gap: 30px;
    flex: 1;
}

.cart-items-section {
    flex: 2;
    display: flex;
    flex-direction: column;
}

.cart-products {
    max-height: 600px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Custom Scrollbar Styling */
.cart-products::-webkit-scrollbar {
    width: 8px;
}

.cart-products::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.cart-products::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-color), #45a049);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.cart-products::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #45a049, var(--primary-color));
}

/* Firefox Scrollbar */
.cart-products {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f1f1f1;
}

.order-summary {
    flex: 1;
    min-width: 300px;
    padding: 20px;
    border-radius: 6px;
    background-color: var(--summary-background);
    box-shadow: var(--shadow);
    align-self: flex-start;
    position: sticky;
    top: 20px;
}

.cart-product {
    display: flex;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.cart-products .cart-product:last-of-type {
    border-bottom: none;
}

.product-image {
    width: 90px;
    height: 90px;
    margin-right: 15px;
    flex-shrink: 0;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.product-info {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 20px;
}

.product-header {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

.cart-product-name {
    margin: 0;
    font-size: 1em;
    font-weight: normal;
    color: var(--text-color) !important;
}

.cart-product-name a {
    text-decoration: none;
    color: var(--text-color) !important;
}

.product-price {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    margin: 3px 0;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-color);
}

.product-price-wrapper {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-price {
    margin: 3px 0;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-color);
}

.quantity-control {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: auto;
}

.remove-item {
    position: absolute;
    top: 15px;
    right: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.remove-item img {
    display: block;
    width: 20px;
    height: 20px;
}

.remove-item:hover {
    opacity: 1;
    transform: scale(1.1);
}

.qty-minus,
.qty-plus {
    background-color: var(--background-color);
    color: var(--text-color);
    border: 2px solid var(--primary-color);
    padding: 8px 16px;
    cursor: pointer;
    font-size: 1.3em;
    line-height: 1;
    font-weight: bold;
    transition: all 0.2s ease;
    min-width: 42px;
    height: 42px;
}

.qty-minus:hover,
.qty-plus:hover {
    background-color: var(--primary-color);
    color: white;
}

.qty-input {
    width: 50px;
    text-align: center;
    border: 2px solid var(--primary-color);
    border-left: none;
    border-right: none;
    padding: 8px 0;
    font-size: 1.1em;
    font-weight: bold;
    -moz-appearance: textfield;
    height: 42px;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-minus {
    border-right: none;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.qty-plus {
    border-left: none;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.product-subtotal {
    display: none;
}

.add-another-offer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin: 10px 0 20px 0;
    background-color: var(--offer-background);
    border: 1px solid var(--offer-border);
    border-radius: 4px;
    margin-left: 105px;
    width: calc(100% - 105px);
}

.offer-text {
    font-size: 0.9em;
    color: var(--text-color);
}

.offer-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    text-transform: uppercase;
}

.summary-title {
    font-size: 1.2em;
    font-weight: bold;
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
    text-transform: uppercase;
}

.summary-details .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
}

.summary-details .summary-row:nth-child(2) .summary-value {
    color: var(--discount-color);
    font-weight: bold;
}

.summary-details .total {
    padding-top: 15px;
    margin-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 1.2em;
    font-weight: bold;
}

.checkout-button {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 15px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.checkout-button::before {
    content: "";
    display: inline-block;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 2L3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4z"/><line x1="3" y1="6" x2="21" y2="6"/><path d="M16 10a4 4 0 0 1-8 0"/></svg>');
    width: 20px;
    height: 20px;
    margin-right: 10px;
}

/* Mobile Checkout Bar - Hidden on Desktop */
.mobile-checkout-bar {
    display: none;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .custom-cart {
        padding: 10px;
        padding-bottom: 100px;
        /* Space for floating button */
    }

    .cart-content {
        flex-direction: column;
        gap: 20px;
    }

    .order-summary {
        display: none;
    }

    .cart-products {
        max-height: none;
    }

    .product-image {
        width: 70px;
        height: 70px;
        margin-right: 12px;
    }

    .product-info {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .product-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        width: 100%;
    }

    .product-header .cart-product-name {
        flex: 1;
        padding-right: 10px;
    }

    .remove-item {
        position: static;
        margin-left: auto;
    }

    .product-price {
        margin: 5px 0;
    }

    .quantity-control {
        justify-content: flex-start;
        margin-top: 8px;
    }

    .qty-minus,
    .qty-plus {
        padding: 6px 12px;
        font-size: 1.2em;
        min-width: 38px;
        height: 38px;
    }

    .qty-input {
        width: 45px;
        font-size: 1em;
        height: 38px;
    }

    /* Mobile Floating Checkout Bar */
    .mobile-checkout-bar {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 15px 20px;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 999;
    }

    .mobile-total {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 1.1em;
    }

    .mobile-total-label {
        color: var(--light-text-color);
        font-weight: normal;
    }

    .mobile-total-value {
        font-weight: bold;
        font-size: 1.2em;
        color: var(--discount-color);
    }

    .mobile-checkout-button {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        max-width: 400px;
        padding: 14px 20px;
        background-color: var(--primary-color);
        color: white;
        text-decoration: none;
        font-size: 1em;
        font-weight: bold;
        text-transform: uppercase;
        border-radius: 6px;
        transition: background-color 0.2s ease;
    }

    .mobile-checkout-button:hover {
        background-color: #45a049;
    }
}

/* Upsell Products Section */
.upsell-products-section {
    margin-top: 60px;
    padding: 40px 0;
}

.upsell-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
    color: #323232;
}

.upsell-description {
    text-align: center;
    color: #666;
    margin-bottom: 40px;
    font-size: 16px;
}

.upsell-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.upsell-product-box {
    background: #fff;
    border: 2px solid #9C7B98;
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upsell-content-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.upsell-left-section {
    flex: 1;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.upsell-right-section {
    flex-shrink: 0;
}

/* Custom Checkbox */
.upsell-checkbox-container {
    position: relative;
    display: block;
    width: 28px;
    height: 28px;
    cursor: pointer;
    flex-shrink: 0;
}

.upsell-checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.upsell-checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 28px;
    width: 28px;
    background-color: #fefefe;
    border: 2px solid #768071;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.upsell-checkbox-container input:checked~.upsell-checkmark {
    background-color: #4E1C50;
    border-color: #4E1C50;
}

.upsell-checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 9px;
    top: 5px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

.upsell-checkbox-container input:checked~.upsell-checkmark:after {
    display: block;
}

/* Product Details */
.upsell-product-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upsell-product-name {
    font-size: 18px;
    font-weight: 600;
    color: #323232;
    margin: 0;
    line-height: 1.4;
}

.upsell-product-pricing {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upsell-discount-price {
    font-size: 24px;
    font-weight: 700;
    color: #9C7B98;
}

.upsell-regular-price {
    font-size: 16px;
    color: #999;
    text-decoration: line-through;
}

.upsell-toggle-description {
    background: none;
    border: none;
    color: #323232;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: underline;
    text-transform: capitalize !important;
    padding: 0;
    cursor: pointer;
    text-align: left;
    transition: color 0.2s ease;
}


.upsell-toggle-description.active {
    color: #323232;
}

/* Product Image */
.upsell-product-image {
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    border-radius: 12px;
    overflow: hidden;
}

.upsell-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Product Description */
.upsell-product-description {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
    color: #666;
    line-height: 1.6;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.no-upsells {
    text-align: center;
    color: #999;
    font-size: 16px;
    padding: 40px 20px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .upsell-products-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .upsell-product-box {
        padding: 16px;
    }

    .upsell-right-section {
        width: fit-content;
        display: flex;
        justify-content: center;
    }

    .upsell-product-image {
        width: 70px;
        height: 70px;
    }

    .upsell-product-name {
        font-size: 16px;
    }

    .upsell-discount-price {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .upsell-left-section {
        gap: 12px;
    }

    .upsell-checkbox-container {
        width: 24px;
        height: 24px;
    }

    .upsell-checkmark {
        width: 24px;
        height: 24px;
    }

    .upsell-checkmark:after {
        left: 7px;
        top: 3px;
        width: 5px;
        height: 10px;
    }

}