/* 
 * Cart Styles
 * Custom styling for WooCommerce cart pages
 */

/* Cart Wrapper */
.plo-cart-wrapper {
    max-width: var(--container-width, 1200px);
    margin: 0 auto;
    padding: var(--spacing-md, 2rem) var(--spacing-sm, 1rem);
    font-family: var(--body-font, sans-serif);
}

/* Page Title */
.woocommerce-cart .entry-header,
.woocommerce-cart header.entry-header {
    margin-bottom: var(--spacing-md, 2rem);
    text-align: left;
}

.woocommerce-cart .entry-header h1.entry-title,
.woocommerce-cart header.entry-header h1.entry-title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    color: var(--heading-color, #333333);
    font-weight: 600;
    position: relative;
    padding-bottom: 0;
    margin-bottom: var(--spacing-md, 1.5rem);
    display: inline-block;
}

/* Remove the underline pseudo-element */
.woocommerce-cart .entry-header h1.entry-title::after,
.woocommerce-cart header.entry-header h1.entry-title::after {
    display: none;
}

/* Cart Layout */
@media (min-width: 992px) {
    .plo-cart-wrapper {
        display: grid;
        grid-template-columns: 1fr 320px;
        gap: var(--spacing-lg, 2rem);
        align-items: start;
        max-width: var(--container-width, 1200px);
    }
    
    .woocommerce-cart-form {
        grid-column: 1;
    }
    
    .cart-collaterals {
        grid-column: 2;
        position: sticky;
        top: var(--spacing-md, 2rem);
        margin-bottom: var(--spacing-lg, 3rem);
    }
}

/* Cart Table */
.shop_table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--border-radius-md, 8px);
    overflow: hidden;
    margin-bottom: var(--spacing-md, 2rem);
    background-color: #fff;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.1));
}

/* Table Header */
.shop_table thead {
    background-color: var(--forest-green, #548C2F);
    color: white;
}

.shop_table thead th {
    padding: 0.85rem var(--spacing-sm, 1rem);
    font-weight: 600;
    text-align: left;
}

/* Table Body */
.shop_table tbody tr {
    border-bottom: 1px solid var(--gray-200, #e5e7eb);
    transition: background-color 0.2s ease;
}

.shop_table tbody tr:hover {
    background-color: var(--gray-50, #f9fafb);
}

.shop_table tbody td {
    padding: 0.85rem var(--spacing-sm, 1rem);
    vertical-align: middle;
}

/* Product Thumbnail */
.product-thumbnail {
    width: 80px;
}

.product-thumbnail img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--border-radius-sm, 4px);
    box-shadow: var(--shadow-xs, 0 1px 2px rgba(0,0,0,0.05));
    transition: transform 0.3s ease;
}

.product-thumbnail img:hover {
    transform: scale(1.05);
}

/* Product Name */
.product-name a {
    color: var(--deep-green, #104911);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.product-name a:hover {
    color: var(--forest-green, #548C2F);
}

/* Product Price */
.product-price {
    font-weight: 600;
    color: var(--gray-800, #1f2937);
}

/* Product Quantity */
.product-quantity .quantity {
    display: flex;
    align-items: center;
    max-width: 120px;
}

.product-quantity .quantity input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: var(--border-radius-sm, 4px);
    text-align: center;
    -moz-appearance: textfield;
}

.product-quantity .quantity input::-webkit-outer-spin-button,
.product-quantity .quantity input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Product Subtotal */
.product-subtotal {
    font-weight: 700;
    color: var(--deep-green, #104911);
}

/* Remove Item Button */
.product-remove a.remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: var(--gray-200, #e5e7eb);
    color: var(--gray-700, #374151);
    text-decoration: none;
    border-radius: 50%;
    font-size: 1.2rem;
    line-height: 1;
    transition: all 0.2s ease;
}

.product-remove a.remove:hover {
    background-color: #ef4444;
    color: white;
}

/* Coupon & Update Cart Section */
.coupon-update-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm, 1rem);
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md, 1.5rem) var(--spacing-sm, 1rem);
}

.coupon {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.coupon input {
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: var(--border-radius-sm, 4px);
    font-size: 0.875rem;
}

/* Buttons */
.coupon button,
button[name="update_cart"] {
    padding: 0.75rem 1.5rem;
    background-color: var(--forest-green, #548C2F);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm, 4px);
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.coupon button:hover,
button[name="update_cart"]:hover {
    background-color: var(--deep-green, #104911);
}

button[name="update_cart"] {
    background-color: var(--olive-green, #AAB03C);
}

button[name="update_cart"]:hover {
    background-color: var(--golden-orange, #F9A620);
}

/* Cart Totals */
.cart_totals {
    background-color: white;
    padding: var(--spacing-md, 1.5rem);
    border-radius: var(--border-radius-md, 8px);
    box-shadow: var(--shadow-md, 0 4px 6px rgba(0,0,0,0.1));
}

@media (min-width: 992px) {
    .cart_totals {
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Improve hierarchy for side-by-side layout */
    .cart_totals h2 {
        font-size: 1.25rem;
    }
    
    /* Ensure cart totals are fully visible with sticky positioning */
    .cart-collaterals {
        max-height: calc(100vh - 100px);
        overflow-y: auto;
        scrollbar-width: thin;
    }
    
    /* Styling for webkit browsers scrollbar */
    .cart-collaterals::-webkit-scrollbar {
        width: 4px;
    }
    
    .cart-collaterals::-webkit-scrollbar-track {
        background: var(--gray-100, #f3f4f6);
    }
    
    .cart-collaterals::-webkit-scrollbar-thumb {
        background: var(--gray-300, #d1d5db);
        border-radius: 2px;
    }
    
    .cart-collaterals::-webkit-scrollbar-thumb:hover {
        background: var(--gray-400, #9ca3af);
    }
}

.cart_totals h2 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md, 2rem);
    color: var(--deep-green, #104911);
    font-weight: 600;
    padding-bottom: var(--spacing-xs, 0.5rem);
    border-bottom: 2px solid var(--forest-green, #548C2F);
}

.cart_totals table {
    width: 100%;
    margin-bottom: var(--spacing-md, 2rem);
}

.cart_totals table th,
.cart_totals table td {
    padding: var(--spacing-sm, 1rem) 0;
    border-bottom: 1px solid var(--gray-200, #e5e7eb);
}

.cart_totals table th {
    text-align: left;
    font-weight: 600;
    color: var(--gray-700, #374151);
    width: 40%;
    vertical-align: top;
}

.cart_totals table td {
    text-align: right;
}

.order-total th,
.order-total td {
    font-weight: 700;
    color: var(--deep-green, #104911);
    font-size: 1.125rem;
}

/* Improved Shipping Calculator */
.shipping-calculator-form {
    margin-top: 0.75rem;
    text-align: left;
}

.shipping-calculator-form p {
    margin-bottom: 0.75rem;
}

.shipping-calculator-form .form-row {
    margin-bottom: 0.75rem;
}

.shipping-calculator-form .form-row label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: var(--gray-700, #374151);
    font-size: 0.9rem;
}

.shipping-calculator-form select,
.shipping-calculator-form input[type="text"] {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--gray-300, #d1d5db);
    border-radius: var(--border-radius-sm, 4px);
    background-color: white;
    font-size: 0.9rem;
}

.shipping-calculator-form select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23374151' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
    padding-right: 2rem;
}

/* Required Field Indicator */
.form-row .required {
    color: #ef4444;
    font-weight: 700;
    border: 0;
}

/* Shipping Address Section */
.shipping-calculator-form .shipping-address {
    padding: 0.75rem;
    background-color: var(--gray-50, #f9fafb);
    border-radius: var(--border-radius-sm, 4px);
    margin-bottom: 0.75rem;
}

/* Change Address Link */
a.shipping-calculator-button {
    color: var(--forest-green, #548C2F);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 0.5rem;
}

a.shipping-calculator-button:hover {
    color: var(--deep-green, #104911);
    text-decoration: underline;
}

/* Coupon Reminder */
.coupon-reminder {
    background-color: var(--gray-50, #f9fafb);
    border-left: 3px solid var(--forest-green, #548C2F);
    padding: var(--spacing-sm, 1rem);
    margin-bottom: var(--spacing-md, 2rem);
    font-size: 0.875rem;
    color: var(--gray-700, #374151);
    border-radius: 0 var(--border-radius-sm, 4px) var(--border-radius-sm, 4px) 0;
}

/* Proceed to Checkout Button */
.wc-proceed-to-checkout {
    margin-top: var(--spacing-md, 2rem);
}

.wc-proceed-to-checkout a.checkout-button {
    display: block;
    width: 100%;
    padding: 1rem;
    text-align: center;
    background-color: var(--deep-green, #104911);
    color: white;
    font-weight: 700;
    text-decoration: none;
    border-radius: var(--border-radius-sm, 4px);
    transition: background-color 0.2s ease;
    position: relative;
    overflow: hidden;
}

.wc-proceed-to-checkout a.checkout-button:hover {
    background-color: var(--golden-orange, #F9A620);
}

/* Add a subtle animation to the checkout button */
.wc-proceed-to-checkout a.checkout-button::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to right,
        transparent 0%,
        rgba(255, 255, 255, 0.2) 50%,
        transparent 100%
    );
    transition: left 0.5s ease;
}

.wc-proceed-to-checkout a.checkout-button:hover::after {
    left: 100%;
}

/* Empty Cart */
.cart-empty {
    padding: var(--spacing-lg, 3rem) var(--spacing-md, 2rem);
    text-align: center;
}

.cart-empty.woocommerce-info {
    background-color: white;
    border: 2px dashed var(--gray-300, #d1d5db);
    border-radius: var(--border-radius-md, 8px);
    padding: var(--spacing-lg, 3rem) var(--spacing-md, 2rem);
    margin-bottom: var(--spacing-md, 2rem);
    font-size: 1.125rem;
    color: var(--gray-700, #374151);
}

.return-to-shop {
    text-align: center;
    margin-top: var(--spacing-md, 2rem);
}

.return-to-shop a.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--forest-green, #548C2F);
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--border-radius-sm, 4px);
    transition: background-color 0.2s ease;
}

.return-to-shop a.button:hover {
    background-color: var(--deep-green, #104911);
}

/* Cross-Sells */
.cross-sells {
    margin-top: var(--spacing-xl, 4rem);
    padding: var(--spacing-md, 2rem);
    background-color: var(--gray-50, #f9fafb);
    border-radius: var(--border-radius-md, 8px);
}

.cross-sells h2 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md, 2rem);
    color: var(--deep-green, #104911);
    text-align: center;
    font-weight: 600;
}

.cross-sells ul.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-md, 2rem);
}

.cross-sells-action {
    margin-top: var(--spacing-md, 2rem);
    text-align: center;
}

.view-all-products {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--olive-green, #AAB03C);
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--border-radius-sm, 4px);
    transition: background-color 0.2s ease;
    border: none;
    cursor: pointer;
}

.view-all-products:hover {
    background-color: var(--forest-green, #548C2F);
}

/* Applied Coupon */
.cart-discount th,
.cart-discount td {
    color: var(--forest-green, #548C2F);
    font-weight: 600;
}

.woocommerce-remove-coupon {
    font-size: 0.75rem;
    color: #ef4444;
    margin-left: 0.5rem;
    text-decoration: none;
}

/* Shipping Options */
.woocommerce-shipping-methods {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    text-align: right;
}

.woocommerce-shipping-methods li {
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}

.woocommerce-shipping-methods input[type="radio"] {
    margin: 0.25rem 0.5rem 0 0;
    min-width: 16px;
}

.woocommerce-shipping-methods label {
    font-size: 0.9rem;
    color: var(--gray-700, #374151);
    cursor: pointer;
}

.woocommerce-shipping-destination {
    font-size: 0.85rem;
    color: var(--gray-600, #4b5563);
    margin-top: 0.75rem;
    text-align: right;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--gray-200, #e5e7eb);
}

/* Shipping Region Display */
.shipping td strong {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--deep-green, #104911);
}

/* Country Selection Styling */
p#calc_shipping_country_field {
    margin-bottom: 1rem;
}

/* State Field Styling */
p#calc_shipping_state_field {
    margin-bottom: 1rem;
}

/* City Field Styling */
p#calc_shipping_city_field {
    margin-bottom: 1rem;
}

/* Postcode Field Styling */
p#calc_shipping_postcode_field {
    margin-bottom: 1rem;
}

/* Update Totals Button */
.shipping-calculator-form button {
    background-color: var(--olive-green, #AAB03C);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm, 4px);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.75rem;
    transition: background-color 0.2s ease;
    width: 100%;
}

.shipping-calculator-form button:hover {
    background-color: var(--golden-orange, #F9A620);
}

/* Responsive Adjustments */
@media (max-width: 991px) {
    .plo-cart-wrapper {
        display: block;
    }
    
    .woocommerce-cart-form {
        width: 100%;
        margin-bottom: var(--spacing-lg, 3rem);
    }
    
    .cart-collaterals {
        width: 100%;
        max-width: 600px;
        margin: 0 auto var(--spacing-lg, 3rem);
    }
}

@media (max-width: 768px) {
    .shop_table thead {
        display: none;
    }
    
    .shop_table tbody td {
        display: block;
        text-align: right;
        border-bottom: 0;
        padding: 0.75rem var(--spacing-sm, 1rem);
    }
    
    .shop_table tbody td:before {
        content: attr(data-title);
        float: left;
        font-weight: 600;
        color: var(--gray-700, #374151);
    }
    
    .shop_table tbody td.product-remove:before,
    .shop_table tbody td.product-thumbnail:before {
        display: none;
    }
    
    .shop_table tbody td.product-remove,
    .shop_table tbody td.product-thumbnail {
        text-align: center;
    }
    
    .shop_table tbody td.product-thumbnail {
        padding: var(--spacing-sm, 1rem) 0;
    }
    
    .shop_table tbody td.product-thumbnail img {
        width: 100px;
        height: 100px;
    }
    
    .shop_table tbody tr {
        display: block;
        margin-bottom: var(--spacing-md, 2rem);
        border: 1px solid var(--gray-300, #d1d5db);
        border-radius: var(--border-radius-sm, 4px);
        overflow: hidden;
    }
    
    .coupon-update-container {
        flex-direction: column;
        gap: var(--spacing-md, 2rem);
    }
    
    .coupon {
        width: 100%;
        justify-content: space-between;
    }
    
    button[name="update_cart"] {
        width: 100%;
        padding: 1rem;
    }
    
    /* Mobile-first cart table */
    .woocommerce-cart-form__contents {
        box-shadow: none;
    }
    
    /* Improve cart totals display on mobile */
    .cart_totals {
        margin-top: 1rem;
    }
    
    /* Shipping calculator optimization */
    .shipping-calculator-form {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .shipping-calculator-form p {
        margin: 0;
    }
    
    /* Cart notices and messages */
    .woocommerce-notices-wrapper {
        margin-bottom: var(--spacing-md, 2rem);
    }
    
    .woocommerce-notices-wrapper .woocommerce-message,
    .woocommerce-notices-wrapper .woocommerce-error,
    .woocommerce-notices-wrapper .woocommerce-info {
        padding: 1rem;
        border-radius: var(--border-radius-sm, 4px);
        margin-bottom: 1rem;
    }
    
    .woocommerce-message {
        background-color: #ecfdf5;
        border-left: 4px solid #10b981;
        color: #065f46;
    }
    
    .woocommerce-error {
        background-color: #fef2f2;
        border-left: 4px solid #ef4444;
        color: #b91c1c;
    }
    
    .woocommerce-info {
        background-color: #eff6ff;
        border-left: 4px solid #3b82f6;
        color: #1e40af;
    }
}

@media (max-width: 576px) {
    .coupon {
        flex-direction: column;
        align-items: stretch;
    }
    
    .coupon input {
        width: 100%;
        min-width: unset;
    }
    
    .coupon button {
        width: 100%;
    }
    
    .cart_totals {
        padding: var(--spacing-sm, 1rem);
    }
    
    /* Optimize checkout button on small screens */
    .wc-proceed-to-checkout a.checkout-button {
        padding: 1.25rem;
        font-size: 1.1rem;
    }
    
    /* Better table visualization */
    .shop_table tbody td {
        padding: 0.75rem;
        border-bottom: 1px dashed var(--gray-200, #e5e7eb);
    }
    
    .shop_table tbody td:last-child {
        border-bottom: none;
    }
    
    /* Optimize cart item layout */
    .shop_table tbody td.product-name {
        font-size: 1rem;
    }
    
    /* Increase touch target sizes for better mobile UX */
    .product-remove a.remove {
        width: 32px;
        height: 32px;
        font-size: 1.5rem;
    }
    
    /* Add card-style to each cart item for better visual separation */
    .shop_table tbody tr {
        box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.1));
    }
}

/* High-contrast mode support */
@media (prefers-contrast: more) {
    .shop_table thead {
        background-color: #000;
    }
    
    .product-name a,
    .product-subtotal,
    .order-total th,
    .order-total td {
        color: #000;
    }
    
    .wc-proceed-to-checkout a.checkout-button {
        background-color: #000;
        outline: 2px solid #000;
    }
    
    .product-remove a.remove:hover {
        background-color: #000;
    }
}

/* Full Width Cart */
.full-width-cart {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Fix for potential sidebar overflow */
.woocommerce-cart #secondary,
.woocommerce-cart .widget-area,
.woocommerce-cart aside#secondary {
    display: none !important;
}

/* Fix for grid or container issues */
.woocommerce-cart .col-lg-4 {
    display: none !important;
}

.woocommerce-cart .col-lg-8 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* Full Width Content */
.content-area.full-width {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

@media (min-width: 992px) {
    /* Optimize table for side-by-side layout */
    .shop_table thead th {
        padding: 0.85rem var(--spacing-sm, 1rem);
    }
    
    .shop_table tbody td {
        padding: 0.85rem var(--spacing-sm, 1rem);
    }

    /* Improve space efficiency in cart table */
    .product-thumbnail {
        width: 80px;
    }
    
    .product-thumbnail img {
        width: 60px;
        height: 60px;
    }
    
    .product-name {
        max-width: 180px;
    }
    
    .product-price, 
    .product-subtotal {
        width: 100px;
    }
    
    .product-quantity {
        width: 120px;
    }
    
    .product-remove {
        width: 40px;
    }
}

@media (min-width: 992px) {
    /* Improve coupon layout on side-by-side view */
    .coupon-update-container {
        padding: var(--spacing-sm, 1rem);
        background-color: var(--gray-50, #f9fafb);
        border-radius: 0 0 var(--border-radius-md, 8px) var(--border-radius-md, 8px);
    }
    
    .coupon {
        min-width: 60%;
    }
    
    .coupon input {
        min-width: 150px;
    }
    
    button[name="update_cart"] {
        padding: 0.65rem 1.25rem;
    }
} 