/**
 * KL Cart – Frontend Styles
 * Mobile-first, matches KL design system
 */

/* ═══════════════════════════════
   CSS Variables
   ═══════════════════════════════ */
:root {
    --kl-accent: #00d4aa;
    --kl-accent-hover: #00b894;
    --kl-dark: #0a0a0a;
    --kl-gray: #6c757d;
    --kl-light: #f8f9fa;
    --kl-border: #eee;
    --kl-radius: 12px;
    --kl-radius-sm: 8px;
}


/* ═══════════════════════════════
   Page Layout Overrides
   ═══════════════════════════════ */
.woocommerce-cart .site-content,
.woocommerce-cart #primary,
.woocommerce-cart .ast-woocommerce-container,
.woocommerce-cart .site-content > .ast-container,
.woocommerce-cart #content,
.woocommerce-cart .site-main {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.woocommerce-cart .woocommerce-breadcrumb {
    display: none !important;
}

/* Hide page title "Cart" – we handle it via context */
.woocommerce-cart .entry-title,
.woocommerce-cart .page-title {
    display: none !important;
}


/* ═══════════════════════════════
   Empty Cart – Hide Defaults
   ═══════════════════════════════ */
.woocommerce-cart .cart-empty.woocommerce-info {
    display: none !important;
}
.woocommerce-cart .return-to-shop {
    display: none !important;
}


/* ═══════════════════════════════
   Empty Cart – Custom UI
   ═══════════════════════════════ */
.kl-cart-empty {
    text-align: center;
    padding: 60px 20px 40px;
}

.kl-cart-empty-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--kl-light);
    border-radius: 50%;
    margin: 0 auto 24px;
}

.kl-cart-empty-icon i {
    font-size: 32px;
    color: var(--kl-gray);
}

.kl-cart-empty-title {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--kl-dark);
    margin: 0 0 8px;
}

.kl-cart-empty-subtitle {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    color: var(--kl-gray);
    margin: 0 0 28px;
}

.kl-cart-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 600;
    background: var(--kl-accent);
    color: var(--kl-dark);
    border-radius: var(--kl-radius-sm);
    text-decoration: none;
    transition: background 0.2s, transform 0.2s;
}

.kl-cart-btn-primary:hover {
    background: var(--kl-accent-hover);
    color: var(--kl-dark);
    transform: translateY(-2px);
}


/* ═══════════════════════════════
   Popular Products Section
   ═══════════════════════════════ */
.kl-cart-popular {
    padding: 40px 20px 60px;
    max-width: 1200px;
    margin: 0 auto;
}

.kl-cart-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 32px;
    color: var(--kl-dark);
}

/* Slider wrapper (matches homepage) */
.kl-cart-popular .kl-slider {
    position: relative;
}

.kl-cart-popular .kl-products-grid {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
}

.kl-cart-popular .kl-products-grid::-webkit-scrollbar {
    display: none;
}

/* Product card (matches homepage) */
.kl-cart-popular .kl-product-card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #eee;
    transition: transform 0.3s, box-shadow 0.3s;
    flex: 0 0 260px;
    scroll-snap-align: start;
}

.kl-cart-popular .kl-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.kl-cart-popular .kl-product-image {
    display: block;
    overflow: hidden;
}

.kl-cart-popular .kl-product-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s;
}

.kl-cart-popular .kl-product-card:hover .kl-product-image img {
    transform: scale(1.05);
}

.kl-cart-popular .kl-product-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #ddd;
}

.kl-cart-popular .kl-product-info {
    padding: 16px;
}

.kl-cart-popular .kl-product-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #0a0a0a;
    text-decoration: none;
    margin-bottom: 8px;
    line-height: 1.3;
}

.kl-cart-popular .kl-product-name:hover {
    color: var(--kl-accent, #00d4aa);
}

.kl-cart-popular .kl-product-rating {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 8px;
}

.kl-cart-popular .kl-product-rating i {
    font-size: 12px;
    color: #FFD700;
}

.kl-cart-popular .kl-rating-count {
    font-size: 12px;
    color: #6c757d;
    margin-left: 4px;
}

.kl-cart-popular .kl-product-price {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.kl-cart-popular .kl-price-current {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
    color: #0a0a0a;
}

.kl-cart-popular .kl-price-current del {
    font-size: 13px;
    color: #999;
    font-weight: 400;
}

.kl-cart-popular .kl-price-current ins {
    text-decoration: none;
    font-weight: 700;
    color: #0a0a0a;
}

.kl-cart-popular .kl-btn-group {
    display: flex;
    gap: 8px;
}

.kl-cart-popular .kl-btn-cart {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    background: #0a0a0a;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.kl-cart-popular .kl-btn-cart:hover {
    background: #222;
    color: #fff;
}

.kl-cart-popular .kl-btn-buy {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    background: var(--kl-accent, #00d4aa);
    color: #0a0a0a;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.kl-cart-popular .kl-btn-buy:hover {
    background: #00b894;
    color: #0a0a0a;
}

.kl-cart-popular .kl-btn-cart.kl-loading,
.kl-cart-popular .kl-btn-buy.kl-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Slider arrows (matches homepage) */
.kl-cart-popular .kl-slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #eee;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: all 0.2s;
    color: #333;
    font-size: 14px;
    padding: 0;
}

.kl-cart-popular .kl-slider-arrow:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    background: #f8f9fa;
    color: #0a0a0a;
}

.kl-cart-popular .kl-slider-arrow.kl-hidden {
    opacity: 0;
    pointer-events: none;
}

.kl-cart-popular .kl-slider-prev {
    left: -16px;
}

.kl-cart-popular .kl-slider-next {
    right: -16px;
}


/* ═══════════════════════════════
   Continue Shopping Link
   ═══════════════════════════════ */
.kl-cart-continue {
    margin-bottom: 20px;
}

.kl-cart-continue-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--kl-accent);
    text-decoration: none;
    transition: gap 0.2s, color 0.2s;
}

.kl-cart-continue-link:hover {
    gap: 10px;
    color: var(--kl-accent-hover);
}


/* ═══════════════════════════════
   Cart Table
   ═══════════════════════════════ */
.woocommerce-cart table.shop_table.cart {
    border: 1px solid var(--kl-border) !important;
    border-radius: var(--kl-radius) !important;
    overflow: hidden;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    font-family: 'Outfit', sans-serif !important;
}

.woocommerce-cart table.shop_table.cart thead th {
    background: var(--kl-light) !important;
    font-family: 'Outfit', sans-serif !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--kl-gray) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 14px 16px !important;
    border-bottom: 1px solid var(--kl-border) !important;
}

.woocommerce-cart table.shop_table.cart td {
    padding: 16px !important;
    border-top: 1px solid var(--kl-border) !important;
    vertical-align: middle !important;
    font-family: 'Outfit', sans-serif !important;
}

/* Larger product thumbnails */
.woocommerce-cart table.shop_table .product-thumbnail img {
    width: 80px !important;
    height: 80px !important;
    object-fit: cover !important;
    border-radius: var(--kl-radius-sm) !important;
}

/* Product name link */
.woocommerce-cart table.shop_table .product-name a {
    color: var(--kl-dark) !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    text-decoration: none !important;
    transition: color 0.2s !important;
}

.woocommerce-cart table.shop_table .product-name a:hover {
    color: var(--kl-accent) !important;
}

/* Price font */
.woocommerce-cart table.shop_table .product-price .amount,
.woocommerce-cart table.shop_table .product-subtotal .amount {
    font-family: 'Space Mono', monospace !important;
    font-weight: 700 !important;
    color: var(--kl-dark) !important;
}


/* ═══════════════════════════════
   Remove Button
   ═══════════════════════════════ */
.woocommerce-cart table.shop_table .product-remove a.remove {
    color: transparent !important;
    font-size: 0 !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: #fff !important;
    border: 1.5px solid #e8e8e8 !important;
    transition: background 0.2s, border-color 0.2s !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    position: relative !important;
    display: block !important;
}

.woocommerce-cart table.shop_table .product-remove a.remove::before {
    content: '\f2ed';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 13px;
    color: #999;
    transition: color 0.2s;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.woocommerce-cart table.shop_table .product-remove a.remove:hover {
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
}

.woocommerce-cart table.shop_table .product-remove a.remove:hover::before {
    color: #ef4444;
}


/* ═══════════════════════════════
   Quantity +/- Controls
   ═══════════════════════════════ */
.woocommerce-cart .quantity {
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
    border: 1px solid var(--kl-border);
    border-radius: var(--kl-radius-sm);
    overflow: hidden;
    width: fit-content;
}

.kl-qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--kl-light);
    border: none;
    cursor: pointer;
    color: var(--kl-dark);
    font-size: 12px;
    padding: 0;
    transition: background 0.2s;
}

.kl-qty-btn:hover {
    background: #e9ecef;
}

.woocommerce-cart .quantity input.qty {
    width: 44px !important;
    height: 36px !important;
    text-align: center !important;
    border: none !important;
    border-left: 1px solid var(--kl-border) !important;
    border-right: 1px solid var(--kl-border) !important;
    font-family: 'Space Mono', monospace !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    -moz-appearance: textfield !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
}

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


/* ═══════════════════════════════
   Coupon Input
   ═══════════════════════════════ */
.woocommerce-cart .coupon {
    display: flex;
    gap: 8px;
    align-items: center;
}

.woocommerce-cart .coupon input.input-text {
    font-family: 'Outfit', sans-serif !important;
    font-size: 14px !important;
    padding: 10px 14px !important;
    border: 1px solid var(--kl-border) !important;
    border-radius: var(--kl-radius-sm) !important;
    transition: border-color 0.2s !important;
    background: #fff !important;
}

.woocommerce-cart .coupon input.input-text:focus {
    outline: none !important;
    border-color: var(--kl-accent) !important;
    box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.15) !important;
}

.woocommerce-cart .coupon button {
    font-family: 'Outfit', sans-serif !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    padding: 10px 20px !important;
    background: var(--kl-dark) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--kl-radius-sm) !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
}

.woocommerce-cart .coupon button:hover {
    background: #222 !important;
}

/* Update Cart button */
.woocommerce-cart button[name="update_cart"] {
    font-family: 'Outfit', sans-serif !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    padding: 10px 20px !important;
    background: var(--kl-light) !important;
    color: var(--kl-dark) !important;
    border: 1px solid var(--kl-border) !important;
    border-radius: var(--kl-radius-sm) !important;
    cursor: pointer !important;
    transition: background 0.2s !important;
}

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

.woocommerce-cart button[name="update_cart"]:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}


/* ═══════════════════════════════
   Cart Totals
   ═══════════════════════════════ */
.woocommerce-cart .cart_totals {
    background: #fff !important;
    border: 1px solid var(--kl-border) !important;
    border-radius: var(--kl-radius) !important;
    padding: 24px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

.woocommerce-cart .cart_totals h2 {
    font-family: 'Outfit', sans-serif !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    color: var(--kl-dark) !important;
    margin: 0 0 16px !important;
}

.woocommerce-cart .cart_totals table.shop_table {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
}

.woocommerce-cart .cart_totals table.shop_table th {
    background: none !important;
    font-family: 'Outfit', sans-serif !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--kl-gray) !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    padding: 12px 0 !important;
}

.woocommerce-cart .cart_totals table.shop_table td {
    font-family: 'Space Mono', monospace !important;
    font-weight: 600 !important;
    color: var(--kl-dark) !important;
    padding: 12px 0 !important;
    text-align: right !important;
}

.woocommerce-cart .cart_totals .order-total th,
.woocommerce-cart .cart_totals .order-total td {
    font-size: 18px !important;
    font-weight: 700 !important;
    color: var(--kl-dark) !important;
    border-top: 2px solid var(--kl-border) !important;
    padding-top: 16px !important;
}

/* Checkout button */
.woocommerce-cart .wc-proceed-to-checkout .checkout-button {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    font-family: 'Outfit', sans-serif !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    padding: 14px 24px !important;
    background: var(--kl-accent) !important;
    color: var(--kl-dark) !important;
    border: none !important;
    border-radius: var(--kl-radius-sm) !important;
    cursor: pointer !important;
    transition: background 0.2s, transform 0.2s !important;
    text-decoration: none !important;
    margin-top: 16px !important;
}

.woocommerce-cart .wc-proceed-to-checkout .checkout-button:hover {
    background: var(--kl-accent-hover) !important;
    transform: translateY(-2px) !important;
}


/* ═══════════════════════════════
   Cross-Sells Section
   ═══════════════════════════════ */
.woocommerce-cart .cross-sells > h2 {
    font-family: 'Outfit', sans-serif !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    color: var(--kl-dark) !important;
    margin-bottom: 20px !important;
}

/* Scroll wrapper injected by JS */
.kl-cart-scroll-wrap {
    position: relative;
}

/* Horizontal scroll layout – override WC grid */
.woocommerce-cart .cross-sells ul.products {
    display: flex !important;
    grid-template-columns: none !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    scroll-behavior: smooth !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 16px !important;
    padding: 4px 0 8px !important;
    list-style: none !important;
    margin: 0 !important;
    width: 100% !important;
    float: none !important;
}

.woocommerce-cart .cross-sells ul.products::before,
.woocommerce-cart .cross-sells ul.products::after {
    display: none !important;
}

.woocommerce-cart .cross-sells ul.products::-webkit-scrollbar {
    display: none;
}

.woocommerce-cart .cross-sells ul.products li.product {
    flex: 0 0 260px !important;
    max-width: 260px !important;
    scroll-snap-align: start !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
}

/* Hide sale badges on cross-sell products */
.woocommerce-cart .cross-sells .onsale,
.woocommerce-cart .cross-sells .kl-shop-badge {
    display: none !important;
}

/* Cross-sells arrow buttons – reuse same style */
.kl-cart-scroll-wrap .kl-cart-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--kl-border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: all 0.2s;
    color: #333;
    font-size: 14px;
    padding: 0;
}

.kl-cart-scroll-wrap .kl-cart-arrow:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    background: var(--kl-light);
    color: var(--kl-dark);
}

.kl-cart-scroll-wrap .kl-cart-arrow.kl-hidden {
    opacity: 0;
    pointer-events: none;
}

.kl-cart-scroll-wrap .kl-cart-prev {
    left: -16px;
}

.kl-cart-scroll-wrap .kl-cart-next {
    right: -16px;
}


/* ═══════════════════════════════
   Hide WooCommerce Sale Flash
   ═══════════════════════════════ */
.woocommerce-cart .onsale {
    display: none !important;
}


/* ═══════════════════════════════
   Links – no underline
   ═══════════════════════════════ */
.woocommerce-cart a {
    text-decoration: none !important;
}


/* ═══════════════════════════════
   RESPONSIVE – Tablet (768px+)
   ═══════════════════════════════ */
@media (min-width: 768px) {
    .kl-cart-empty-title {
        font-size: 28px;
    }

    .kl-cart-section-title {
        font-size: 28px;
    }

    .woocommerce-cart .cross-sells ul.products li.product {
        flex: 0 0 calc(33.333% - 11px) !important;
        max-width: calc(33.333% - 11px) !important;
    }
}


/* ═══════════════════════════════
   RESPONSIVE – Desktop (1024px+)
   ═══════════════════════════════ */
@media (min-width: 1024px) {
    .kl-cart-empty-title {
        font-size: 32px;
    }

    .kl-cart-section-title {
        font-size: 32px;
        margin-bottom: 40px;
    }

    .woocommerce-cart .cross-sells ul.products li.product {
        flex: 0 0 calc(25% - 12px) !important;
        max-width: calc(25% - 12px) !important;
    }
}


/* ═══════════════════════════════
   RESPONSIVE – Mobile (767px-)
   ═══════════════════════════════ */
@media (max-width: 767px) {
    .woocommerce-cart .ast-container,
    .woocommerce-cart .ast-woocommerce-container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}


/* ═══════════════════════════════
   RESPONSIVE – Small Mobile (479px-)
   ═══════════════════════════════ */
@media (max-width: 479px) {
    .kl-cart-empty {
        padding: 40px 16px 24px;
    }

    .kl-cart-btn-primary {
        padding: 12px 24px;
        font-size: 14px;
    }

    .kl-cart-popular .kl-btn {
        padding: 8px 8px;
        font-size: 12px;
    }

    .kl-cart-popular .kl-btn i {
        display: none;
    }
}
