/* ========================================= */
/* 🚀 ANTI-FOUC (Flash of Unstyled Content)  */
/* Forces carousel to look correct instantly */
/* ========================================= */

/* 1. Force the container to be a Flex Row */
.pt-cart-carousel-section .carousel-track {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 20px !important;
    overflow-x: auto !important; 
    width: 100% !important;
}

/* 2. Force items to be 32% width (Desktop) */
.pt-cart-carousel-section .carousel-item {
    flex: 0 0 32% !important;
    max-width: 32% !important;
    box-sizing: border-box !important;
    display: block !important;
    position: relative; /* Ensure children anchor correctly */
}

/* 3. 🏆 IMAGE FIX: Force the Wrapper to be Square */
.pt-cart-carousel-section .product-image-wrapper {
    width: 100% !important;
    aspect-ratio: 1 / 1 !important; /* Force Square */
    position: relative !important;
    overflow: hidden !important;
    background: #fff !important;
    display: block !important;
    height: auto !important; /* Allow aspect-ratio to dictate height */
}

/* 4. 🏆 IMAGE FIX: Force Image to Contain/Fit the Square */
/* We use absolute positioning to stop it from breaking the square aspect ratio */
.pt-cart-carousel-section .product-image-wrapper img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important; /* Ensures whole image is visible */
    display: block !important;
    mix-blend-mode: multiply;
}

/* 5. Mobile Pre-Flight (Forces 45% width) */
@media only screen and (max-width: 900px) {
    .pt-cart-carousel-section .carousel-item {
        flex: 0 0 45% !important;
        max-width: 45% !important;
    }
}


/* ========================================= */
/* SAFETY: HIDE DEFAULT CHECKOUT BUTTONS     */
/* ========================================= */
.checkout-button:not(.pt-checkout-btn) { display: none !important; }

/* ========================================= */
/* PREMIUM CART LAYOUT (Selfridges Style)    */
/* ========================================= */
:root { --pt-brand-red: #D00; }

/* MAIN WRAPPER */
.pt-cart-page-wrapper {
    background: #fff; padding: 60px 20px; min-height: 60vh;
    width: 100%; flex: 1 0 100%; display: block; box-sizing: border-box;
}
.pt-cart-container { max-width: 1200px; margin: 0 auto; width: 100%; }

.pt-cart-title {
    font-size: 36px; font-weight: 800; margin-bottom: 40px;
    text-transform: uppercase; border-bottom: 1px solid #eee;
    padding-bottom: 20px; text-align: left; 
}

/* GRID SYSTEM (Desktop) */
.pt-cart-layout .woocommerce {
    display: grid; grid-template-columns: 65% 30%; gap: 0 5%; align-items: start; 
    /* 🏆 NEW: Ensure rows size automatically for carousel insertion */
    grid-template-rows: auto auto !important; 
}
.pt-cart-layout .woocommerce-cart-form {
    grid-column: 1; width: 100%; margin-top: 0 !important; padding-top: 0 !important;
}
.pt-cart-layout .cart-collaterals {
    grid-column: 2; width: 100%; margin-top: 0; position: sticky; top: 40px; 
    /* 🏆 NEW: Ensure it spans enough rows to stick properly next to table + carousel */
    grid-row: 1 / span 2; 
}

/* LEFT COLUMN STYLING */
.pt-cart-layout table.shop_table,
.pt-cart-layout table.shop_table tbody {
    width: 100% !important; display: block; box-sizing: border-box;
    border: none !important; 
}
.pt-cart-layout table.shop_table thead { display: none; }

/* PRODUCT ROW (Desktop) */
.pt-cart-layout table.shop_table tr.cart_item {
    display: grid;
    grid-template-columns: 110px 1fr auto; 
    grid-template-rows: auto auto; 
    width: 100% !important; border-bottom: 1px solid #eee;
    padding: 30px 0; column-gap: 20px; row-gap: 15px;    
    position: relative; align-items: center; box-sizing: border-box;
}
.pt-cart-layout table.shop_table tr.cart_item:first-child { padding-top: 0 !important; }

/* 🛑 NUCLEAR LINE REMOVAL */
.pt-cart-layout table.shop_table tr.cart_item:last-child,
.pt-cart-layout table.shop_table tr.cart_item:last-of-type,
.pt-cart-layout table.shop_table tr:last-child { 
    border-bottom: none !important; 
}

/* ========================================= */
/* 🏆 1. THUMBNAIL IMAGE (HIGH SPECIFICITY)  */
/* ========================================= */

.pt-cart-layout .woocommerce-cart-form table.shop_table .product-thumbnail {
    grid-column: 1; 
    grid-row: 1 / span 2; 
    width: 110px !important; 
    height: 110px !important; 
    border: none; 
    padding: 0 !important;
    overflow: hidden; 
    display: block !important;
    background: #fff; 
}

.pt-cart-layout .woocommerce-cart-form table.shop_table .product-thumbnail a {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    align-items: center; 
    justify-content: center;
}

.pt-cart-layout .woocommerce-cart-form table.shop_table .product-thumbnail img {
    width: 100% !important; 
    height: 100% !important; 
    max-width: 100% !important; 
    max-height: 100% !important;
    border-radius: 4px; 
    display: block;
    object-fit: contain !important; 
    background-color: transparent; 
}


/* 2. Product Name */
.pt-cart-layout table.shop_table .product-name {
    grid-column: 2; grid-row: 1; align-self: end; border: none; padding: 0 !important;
}
.pt-cart-layout table.shop_table .product-name a {
    color: #000; font-weight: 800; font-size: 16px; text-decoration: none; display: block; line-height: 1.2;
}

/* 3. Quantity Selector (Updated for PT Classes & Truncation Fix) */
.pt-cart-layout table.shop_table .product-quantity {
    grid-column: 2; grid-row: 2; align-self: start; border: none; padding: 0 !important; display: flex; align-items: center;
}
.pt-cart-layout .product-quantity .quantity {
    display: inline-flex; align-items: center; justify-content: space-between;
    border: 1px solid #e0e0e0; border-radius: 4px; background: #fff;
    padding: 0; height: 34px; width: 100px; overflow: hidden; position: relative; 
}
.pt-cart-layout .product-quantity .quantity .input-text.qty {
    width: 40px !important; height: 100% !important; text-align: center; border: none !important;
    background: transparent !important; box-shadow: none !important; font-weight: 600; font-size: 14px;
    color: #333; padding: 0; margin: 0; -moz-appearance: textfield; appearance: none; z-index: 5;
    /* Dividers */
    border-left: 1px solid #f0f0f0 !important;
    border-right: 1px solid #f0f0f0 !important;
}
.pt-cart-layout .product-quantity .quantity .input-text.qty::-webkit-outer-spin-button,
.pt-cart-layout .product-quantity .quantity .input-text.qty::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}

/* 🏆 FIX: Updated selector to .pt-instant-btn to match new HTML */
.pt-cart-layout .product-quantity .quantity .pt-instant-btn {
    display: flex !important; align-items: center; justify-content: center;
    width: 30px !important; height: 100% !important; background: transparent !important; 
    color: #555 !important; text-decoration: none !important; font-weight: 400; font-size: 18px; 
    border: none !important; cursor: pointer; line-height: 1; padding: 0 !important; margin: 0 !important;
    border-radius: 0 !important; box-shadow: none !important; z-index: 10; transition: background 0.2s ease;
}
.pt-cart-layout .product-quantity .quantity .pt-instant-btn:hover {
    background: #f5f5f5 !important; color: #000 !important; 
}

/* Hide native or theme buttons (Safety) */
.pt-cart-layout .product-quantity .quantity a.minus,
.pt-cart-layout .product-quantity .quantity a.plus,
.pt-cart-layout .product-quantity .quantity button:not(.pt-instant-btn) { display: none !important; }

/* 4. Price/Subtotal */
.pt-cart-layout table.shop_table .product-price { display: none; } 
.pt-cart-layout table.shop_table .product-subtotal {
    grid-column: 3; grid-row: 2; align-self: center; border: none; font-size: 16px; font-weight: 700; text-align: right;
}

/* Remove Button */
.pt-cart-layout table.shop_table .product-remove {
    position: absolute; top: 25px; right: 0; width: auto; padding: 0 !important; border: none; z-index: 10;
}
.pt-cart-layout table.shop_table .product-remove a.remove {
    display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0; 
    color: transparent; background: #fff; border: 1px solid #e5e5e5; border-radius: 2px;
    padding: 6px 12px; text-decoration: none; transition: all 0.2s ease; height: auto; width: auto; line-height: 1;
}
.pt-cart-layout table.shop_table .product-remove a.remove::before {
    content: "REMOVE"; color: #666; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; display: block;
}
.pt-cart-layout table.shop_table .product-remove a.remove::after {
    content: ''; display: block; width: 14px; height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'%3E%3C/polyline%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center; background-size: contain; transition: background-image 0.2s ease;
}
.pt-cart-layout table.shop_table .product-remove a.remove:hover { border-color: var(--pt-brand-red); }
.pt-cart-layout table.shop_table .product-remove a.remove:hover::before { color: var(--pt-brand-red); }
.pt-cart-layout table.shop_table .product-remove a.remove:hover::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d0021b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'%3E%3C/polyline%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'%3E%3C/path%3E%3C/svg%3E");
}

/* Actions & Coupon */
.pt-cart-layout .woocommerce-cart-form .actions .coupon { display: none !important; }
.pt-cart-layout table.shop_table tr:not(.cart_item) {
    display: flex; width: 100% !important; box-sizing: border-box; padding: 0; margin: 0; border: none;
}
.pt-cart-layout .woocommerce-cart-form .actions {
    display: flex; width: 100% !important; padding-top: 20px; padding-bottom: 20px; justify-content: flex-end; box-sizing: border-box;
}
/* Hide Update Button (JS Handles it) */
.pt-cart-layout .woocommerce-cart-form .actions button[name="update_cart"] { display: none !important; }

/* Right Column Coupon & Totals */
.pt-right-column-coupon-wrapper {
    background: #f9f9f9; padding: 30px 30px 10px 30px; border-radius: 4px 4px 0 0; 
}
.pt-coupon-heading {
    font-size: 14px; font-weight: 700; text-transform: uppercase; margin: 0 0 15px 0; color: #333;
}
.coupon-flex-container { display: flex; gap: 10px; }
.coupon-flex-container .input-text { flex-grow: 1; padding: 12px; border: 1px solid #e0e0e0; border-radius: 2px; font-size: 14px; background: #fff; }
.pt-apply-coupon-btn {
    background-color: #333 !important; color: #fff !important; padding: 12px 20px !important;
    font-weight: 700 !important; text-transform: uppercase; border-radius: 2px; border: none; cursor: pointer;
}
.pt-apply-coupon-btn:hover { background-color: #000 !important; }

.pt-cart-layout .cart_totals {
    background: #f9f9f9; padding: 10px 30px 30px 30px; border-radius: 0 0 4px 4px; float: none !important; width: 100% !important;
}
.pt-cart-layout .cart_totals h2 {
    font-size: 22px; font-weight: 800; text-transform: uppercase; margin-bottom: 20px; border-bottom: 1px solid #e5e5e5; padding-bottom: 15px; margin-top: 10px;
}
.pt-cart-layout .cart_totals table.shop_table { border: none; margin: 0; display: table; }
.pt-cart-layout .cart_totals table.shop_table th,
.pt-cart-layout .cart_totals table.shop_table td {
    padding: 15px 0; border-bottom: 1px solid #e5e5e5; background: transparent;
}
.pt-cart-layout .cart_totals table.shop_table th { text-align: left; font-weight: 600; color: #555; }
.pt-cart-layout .cart_totals table.shop_table td { text-align: right; font-weight: 700; color: #000; }

.pt-cart-layout .wc-proceed-to-checkout { padding-top: 25px; }
.pt-cart-layout .checkout-button {
    background-color: #000 !important; color: #fff !important; width: 100%; display: block;
    padding: 18px 20px !important; font-size: 16px !important; font-weight: 800 !important;
    text-transform: uppercase; text-align: center; border-radius: 4px; transition: background 0.3s;
}
.pt-cart-layout .checkout-button:hover { background-color: #333 !important; }

/* Delivery/Returns */
/* 🏆 LINE REMOVAL */
.pt-extra-info-wrapper { margin-top: 40px; border-top: none !important; padding-top: 0; }

.pt-info-box { border: 1px solid #e0e0e0; margin-bottom: 20px; background: #fff; border-radius: 4px; overflow: hidden; transition: all 0.3s ease; }
.pt-info-box summary { display: flex; align-items: center; justify-content: space-between; padding: 20px; cursor: pointer; list-style: none; outline: none; }
.pt-info-box summary::-webkit-details-marker { display: none; }
.pt-info-left { display: flex; align-items: center; gap: 15px; }
.pt-info-icon { width: 24px; height: 24px; color: #333; flex-shrink: 0; }
.pt-info-text { display: flex; flex-direction: column; font-size: 14px; color: #333; line-height: 1.4; text-align: left; }
@media (min-width: 600px) {
    .pt-info-text { display: block; }
    .pt-info-text strong { margin-right: 15px; font-size: 15px; }
    .pt-info-text span { color: #666; font-weight: 400; }
}
.pt-info-chevron { transition: transform 0.3s ease; color: #999; }
.pt-info-box[open] .pt-info-chevron { transform: rotate(180deg); }
.pt-info-content { padding: 0 20px 20px 60px; color: #666; font-size: 14px; line-height: 1.6; border-top: 1px solid #f9f9f9; margin-top: -5px; }
@media (max-width: 600px) {
    .pt-info-content { padding: 0 20px 20px 20px; }
    .pt-info-text strong { display: block; margin-bottom: 2px; }
}

/* ========================================= */
/* 🏆 CAROUSEL SECTION (SCOPED)              */
/* ========================================= */
.pt-cart-page-wrapper .pt-cart-carousel-section {
    margin-top: 60px; padding-top: 40px; border-top: 1px solid #eee; width: 100%; clear: both; position: relative;
    /* 🏆 NEW: Force grid placement on Desktop so it sits in left column */
    grid-column: 1 !important; 
}

.pt-cart-page-wrapper .pt-cart-carousel-title {
    font-size: 22px; font-weight: 800; text-transform: uppercase; margin-bottom: 25px; color: #000;
}
.pt-cart-page-wrapper .pt-cart-carousel-section .carousel-item { 
    flex: 0 0 32% !important; 
    max-width: 32% !important; 
}
.pt-cart-page-wrapper .pt-cart-carousel-section .carousel-nav.prev { left: -15px; }
.pt-cart-page-wrapper .pt-cart-carousel-section .carousel-nav.next { right: -15px; }

/* 🏆 CAROUSEL IMAGE FIX (CART PAGE ONLY) */
/* Forces images to be square and contained, overriding native defaults */
.pt-cart-page-wrapper .pt-cart-carousel-section .custom-product-card .product-image-wrapper {
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}
.pt-cart-page-wrapper .pt-cart-carousel-section .custom-product-card .product-image-wrapper img {
    object-fit: contain !important;
    mix-blend-mode: multiply;
}


/* ========================================= */
/* 🔔 TOAST NOTIFICATION (Fixed Position)    */
/* ========================================= */
.woocommerce-message {
    /* 1. Positioning (Green Area / Top of List) */
    position: fixed !important;
    top: 160px !important;         /* 🏆 Moves it down to the "Green Area" */
    bottom: auto !important;
    left: 50% !important;          /* Center horizontally */
    transform: translateX(-50%);   /* Perfect centering */
    right: auto !important;
    z-index: 999999;
    
    /* 2. Box Styling */
    background-color: #111 !important; 
    color: #fff !important;
    border: none !important;
    border-left: 4px solid var(--pt-brand-red) !important;
    border-radius: 4px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    
    /* 3. Sizing */
    width: auto;
    min-width: 300px;
    max-width: 90%;
    padding: 15px 25px !important;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    
    /* 4. Animation (Fade/Slide) */
    animation: pt-fade-in 0.4s ease forwards;
}

/* Hide default icon */
.woocommerce-message::before { display: none !important; }

/* Button Styling */
.woocommerce-message .button.wc-forward {
    background: transparent !important;
    color: #fff !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    font-size: 12px !important;
    padding: 6px 0 !important;
    margin: 0 !important;
    border: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.3) !important;
    border-radius: 0;
    float: none !important;
    order: 2;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.woocommerce-message .button.wc-forward:hover {
    background: transparent !important;
    border-color: var(--pt-brand-red) !important;
    color: var(--pt-brand-red) !important;
}

/* Animation */
@keyframes pt-fade-in {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ========================================= */
/* 📱 MOBILE RESPONSIVE (Strict Clean Up)    */
/* ========================================= */
@media only screen and (max-width: 900px) {
    
    .pt-cart-layout .woocommerce { display: block; }
    .pt-cart-layout .woocommerce-cart-form { margin-bottom: 40px; }
    .pt-cart-layout .cart-collaterals { width: 100%; position: static; }

    /* 1. NUCLEAR OPTION FOR LABELS */
    .pt-cart-layout table.shop_table_responsive tr td::before,
    .pt-cart-layout table.shop_table_responsive tr td::after,
    .pt-cart-layout table.shop_table tr td::before {
        content: none !important;
        display: none !important;
    }

    /* 2. MOBILE GRID LAYOUT */
    .pt-cart-layout table.shop_table tr.cart_item {
        display: grid !important;
        /* Col 1: Image (90px) | Col 2: Content */
        grid-template-columns: 90px 1fr !important;
        /* Row 1: Spacer/Remove | Row 2: Title | Row 3: Qty & Price */
        grid-template-rows: auto auto auto !important;
        gap: 5px 20px;
        padding: 20px 0 !important;
        align-items: center; 
        position: relative;
    }

    /* 3. SLOT ASSIGNMENTS */
    
    /* Thumbnail: Top Left, Spans 3 Rows */
    .pt-cart-layout .woocommerce-cart-form table.shop_table .product-thumbnail {
        grid-column: 1;
        grid-row: 1 / span 3;
        width: 90px !important;
        height: 90px !important;
        display: block !important;
    }
    
    /* Name: Row 2 (Left Aligned) */
    .pt-cart-layout table.shop_table .product-name {
        grid-column: 2;
        grid-row: 2;
        margin-bottom: 5px;
        
        /* 🏆 FIX: Increased padding to 60px to clear the Remove Icon */
        padding-right: 60px !important; 
        
        text-align: left !important;
        justify-self: start !important;
        display: block !important;
    }
    
    /* Quantity: Row 3 (Bottom Left) */
    .pt-cart-layout table.shop_table .product-quantity {
        grid-column: 2;
        grid-row: 3;
        width: auto;
        justify-self: start; 
        align-self: end;
        margin-top: 10px !important;
        padding: 0 !important;
        display: flex !important;
    }
    
    /* Price: Row 3 (Bottom Right) */
    .pt-cart-layout table.shop_table .product-price {
        grid-column: 2;
        grid-row: 3;
        width: auto;
        justify-self: end; 
        align-self: end;
        display: block !important; 
        text-align: right;
        margin: 0 !important; 
        padding: 0 !important;
        font-weight: 700;
        font-size: 15px;
        line-height: 1;
    }
    
    /* Hide Subtotal on Mobile */
    .pt-cart-layout table.shop_table .product-subtotal {
        display: none !important;
    }
    
    /* Remove Button: FLUSH TOP (Match Row Padding) */
    .pt-cart-layout table.shop_table .product-remove {
        position: absolute;
        top: 20px !important; /* Matches row padding */
        right: 0 !important;
        width: auto;
        height: auto;
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 20;
    }
    /* Hide the text label "REMOVE" on mobile */
    .pt-cart-layout table.shop_table .product-remove a.remove::before {
        display: none !important; 
    }
    .pt-cart-layout table.shop_table .product-remove a.remove {
        border: none; padding: 5px; margin: 0;
    }

    /* Carousel Adjustment (SCOPED) */
    .pt-cart-page-wrapper .pt-cart-carousel-section .carousel-item {
        flex: 0 0 45% !important; max-width: 45% !important;
    }
}

/* ========================================= */
/* 💳 PAYMENT ICONS (Local Assets Version)   */
/* ========================================= */

.pt-cart-payment-methods {
    margin-top: 15px;
    text-align: left;
    border-top: 1px dashed #e0e0e0;
    padding-top: 15px;
}

.pt-cart-payment-methods p {
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.pt-icons-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* --- THE CARD CONTAINER --- */
.pt-card {
    width: 38px;
    height: 24px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: #fff;
    border: 1px solid #e5e5e5;
    box-sizing: border-box;
}

/* NO Hover Animation (Static) */
.pt-card:hover {
    border-color: #ccc;
}

/* --- IMAGE SIZING --- */
.pt-card img {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    display: block;
}

/* --- SPECIFIC CARD COLORS --- */

/* Black Cards */
.pt-card.mastercard, 
.pt-card.maestro {
    background-color: #0a0a0a;
    border-color: #0a0a0a;
}

/* Blue Cards */
.pt-card.amex {
    background-color: #257fbb;
    border-color: #257fbb;
}
.pt-card.electron {
    background-color: #1a1f71;
    border-color: #1a1f71;
}

/* Pink Card */
.pt-card.klarna {
    background-color: #ffb3c7;
    border-color: #ffb3c7;
}

/* Mint Card */
.pt-card.clearpay {
    background-color: #b2fce4;
    border-color: #b2fce4;
}

