/* ========================================
   Modern Cart Design - TP Theme
   ======================================== */


:root {
    --color: #000000;         /* צבע ראשי - טקסט, כפתורים */
    --color-2: #555555;       /* צבע משני - לינקים, הדגשות */
    --color-4: #e67e22;       /* צבע התראות (backorder) */
    --color-5: #e0e0e0;       /* צבע גבולות */
    --color-hover: #333333;   /* צבע hover לכפתורים */
    --font: 'Assistant', sans-serif;  /* פונט ראשי */
}

/* Cart Container */
.tp-cart-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* Cart Layout - Grid */
.tp-cart-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    align-items: start;
}

/* Cart Items Wrapper */
.tp-cart-items-wrapper {
    width: 100%;
}

.tp-cart-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: transparent;
}

/* Individual Cart Item */
.tp-cart-item {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: 20px;
    padding: 20px;
    background: #ffffff;
    align-items: center;
    transition: all 0.2s ease;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.tp-cart-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.08);
}

/* Item Image */
.tp-item-image {
    width: 120px;
    height: 120px;
    background: #ffffff;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.tp-item-image img,
.tp-item-image .attachment-woocommerce_thumbnail {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.tp-item-image a {
    display: block;
    width: 100%;
    height: 100%;
}

/* Item Details */
.tp-item-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tp-item-name {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0 0 8px 0;
    color: var(--color);
}

.tp-item-name a {
    color: var(--color);
    text-decoration: none;
    transition: color 0.2s;
}

.tp-item-name a:hover {
    color: var(--color-2);
}

.tp-item-meta {
    font-size: 0.85rem;
    color: #666666;
    margin-top: 8px;
    margin-bottom: 0;
    line-height: 1.6;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.tp-item-meta p {
    margin: 4px 0;
    color: #888888;
    display: inline-block;
}

.tp-item-meta:empty {
    display: none !important;
}

.tp-item-meta dl {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tp-item-meta dt,
.tp-item-meta dd {
    margin: 0;
    display: inline;
}

.tp-item-meta dt {
    font-weight: 500;
    color: #555555;
}

.tp-item-meta dt::after {
    content: ": ";
}

.tp-item-meta dd::after {
    content: "";
}

.tp-item-meta dd:last-child::after {
    content: "";
}

/* Variation display */
.tp-item-meta .variation {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 8px 0 0 0;
    padding: 0;
    background: transparent;
}

.tp-item-meta .variation dt {
    color: #666666;
    font-weight: 400;
    display: inline-block;
    margin: 0;
}

.tp-item-meta .variation dt::after {
    content: ": ";
    margin-left: 2px;
}

.tp-item-meta .variation dd {
    color: var(--color);
    font-weight: 500;
    display: inline-block;
    background: #f5f5f5;
    padding: 4px 10px;
    border-radius: 4px;
    margin: 0 8px 0 0;
}

.tp-item-meta .variation dd p {
    display: inline;
    margin: 0;
}

.tp-item-price-mobile {
    display: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--color);
}

/* Quantity Control */
.tp-quantity-control {
    display: inline-flex;
}

.tp-quantity-control .quantity {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--color-5);
    border-radius: 4px;
    overflow: hidden;
}

.tp-quantity-control input.qty {
    width: 60px;
    height: 40px;
    border: none;
    border-right: 1px solid var(--color-5);
    border-left: 1px solid var(--color-5);
    text-align: center;
    font-family: var(--font);
    font-size: 0.95rem;
    padding: 0;
    margin: 0;
    background: #ffffff;
}

/* Item Price Section */
.tp-item-price-section {
    text-align: left;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.tp-item-price {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    color: var(--color);
}

.tp-remove-btn,
.woocommerce .tp-cart-items a.remove,
.woocommerce-page .tp-cart-items a.remove {
    font-size: 0.85rem !important;
    color: #999999 !important;
    background: transparent !important;
    border: 1px solid #e0e0e0 !important;
    cursor: pointer;
    text-decoration: none !important;
    padding: 8px 16px !important;
    transition: all 0.2s !important;
    border-radius: 4px !important;
    display: inline-block !important;
    margin-top: 8px;
    height: auto !important;
    width: auto !important;
    line-height: normal !important;
    font-weight: 400 !important;
}

.tp-remove-btn:hover,
.woocommerce .tp-cart-items a.remove:hover,
.woocommerce-page .tp-cart-items a.remove:hover {
    color: #dc3545 !important;
    background: #fff5f5 !important;
    border-color: #dc3545 !important;
}

/* Coupon Input in Summary */
.tp-coupon-input {
    display: flex;
    gap: 8px;
    margin: 24px 0;
}

.tp-coupon-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--color-5);
    border-radius: 4px;
    font-family: var(--font);
    font-size: 0.9rem;
}

.tp-coupon-input .tp-apply-coupon {
    padding: 12px 20px !important;
    background: transparent !important;
    border: 1px solid var(--color) !important;
    border-radius: 4px !important;
    cursor: pointer;
    font-family: var(--font) !important;
    font-size: 0.9rem !important;
    transition: all 0.2s;
    color: var(--color) !important;
    white-space: nowrap;
}

.tp-coupon-input .tp-apply-coupon:hover {
    background: var(--color) !important;
    color: #ffffff !important;
}

/* Cart Summary */
.tp-cart-summary-wrapper {
    position: sticky;
    top: 24px;
}

.woocommerce .cart-collaterals .cart_totals,
.woocommerce-page .cart-collaterals .cart_totals {
    width: 100% !important;
    float: none !important;
}

.tp-cart-summary {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.tp-summary-title {
    font-size: 1.3rem;
    font-weight: 500;
    margin: 0 0 32px 0;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-5);
    color: var(--color);
}

.tp-summary-content {
    margin-bottom: 24px;
    margin-top: 24px;
}

.tp-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 0.95rem;
    color: var(--color);
}

.tp-summary-row span:first-child {
    color: #666666;
}

.tp-summary-row span:last-child {
    font-weight: 500;
    color: var(--color);
}

.tp-summary-row.tp-total {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--color-5);
}

.tp-summary-row.tp-total span {
    color: var(--color);
    font-weight: 600;
}

.tp-fee-row {
    background: #fff9e6;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 8px 0;
    border-left: 3px solid #ffc107;
}

.tp-fee-row span:first-child {
    color: #856404;
    font-weight: 500;
}

.tp-fee-row span:last-child {
    color: #856404;
    font-weight: 600;
}

.tp-coupon-row {
    background: #f0f9ff;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 8px 0;
    border-left: 3px solid var(--color);
}

.tp-coupon-row span:first-child {
    color: var(--color);
    font-weight: 500;
}

.tp-coupon-row a {
    color: #666666;
    text-decoration: underline;
    font-size: 0.85rem;
    margin-right: 8px;
}

.tp-coupon-row a:hover {
    color: #dc3545;
}

/* Checkout Button */
.tp-checkout-wrapper {
    margin-top: 16px;
}

.tp-checkout-wrapper .checkout-button {
    width: 100%;
    padding: 18px !important;
    background: var(--color) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 4px !important;
    font-family: var(--font) !important;
    font-size: 1rem !important;
    font-weight: 500 !important;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
    display: block;
}

.tp-checkout-wrapper .checkout-button:hover {
    background: #333333 !important;
}

.tp-secure-note {
    text-align: center;
    font-size: 0.8rem;
    color: #666666;
    margin-top: 16px;
}

/* Shipping Calculator in Summary */
.tp-shipping-row .woocommerce-shipping-calculator {
    margin-top: 8px;
}

.tp-shipping-row .shipping-calculator-button {
    font-size: 0.85rem;
    color: var(--color-2);
    text-decoration: underline;
}

/* Hide old table structure */
.tp-cart-summary table {
    display: none;
}

/* Responsive Design */
@media (max-width: 900px) {
    .tp-cart-layout {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .tp-cart-summary-wrapper {
        position: static;
    }

    .tp-cross-sells-section {
        margin-top: 40px;
        padding: 30px 20px;
    }

    .tp-cross-sells-products .cross-sells ul.products li.product,
    .woocommerce-cart .tp-cross-sells-products ul.products li.product {
        flex: 0 0 calc(33.333% - 12px) !important;
        max-width: calc(33.333% - 12px) !important;
    }

    .tp-cross-sells-products .cross-sells ul.products {
        gap: 16px !important;
    }
}

@media (max-width: 600px) {
    .tp-cart-container {
        padding: 24px 16px;
    }

    .tp-cross-sells-section {
        margin-top: 30px;
        padding: 24px 16px;
    }

    .tp-cross-sells-title {
        font-size: 1.25rem;
        margin-bottom: 20px !important;
    }

    .tp-cross-sells-products .cross-sells ul.products {
        gap: 12px !important;
    }

    .tp-cross-sells-products .cross-sells ul.products li.product,
    .woocommerce-cart .tp-cross-sells-products ul.products li.product {
        flex: 0 0 calc(50% - 6px) !important;
        max-width: calc(50% - 6px) !important;
    }

    .tp-cross-sells-products .cross-sells ul.products li.product {
        padding: 12px;
    }

    .tp-cross-sells-products .cross-sells ul.products li.product .woocommerce-loop-product__title {
        font-size: 0.85rem;
    }

    .tp-cross-sells-products .cross-sells ul.products li.product .price {
        font-size: 0.9rem;
    }

    .tp-cross-sells-products .cross-sells ul.products li.product .button {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    .tp-cart-item {
        grid-template-columns: 80px 1fr;
        gap: 16px;
        padding: 24px 16px;
    }

    .tp-item-image {
        width: 80px;
        height: 80px;
    }

    .tp-item-price-section {
        grid-column: 2;
        text-align: right;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-top: 12px;
    }

    .tp-item-price-mobile {
        display: block;
    }

    .tp-item-price {
        display: none;
    }

    .tp-item-name {
        font-size: 1rem;
    }

    .tp-cart-actions {
        flex-direction: column;
        align-items: stretch;
        padding: 20px 16px;
    }

    .tp-coupon {
        max-width: 100%;
    }

    .tp-cart-summary {
        padding: 32px 24px;
    }

    .tp-summary-title {
        font-size: 1.2rem;
        margin-bottom: 24px;
    }

    .tp-coupon-input {
        flex-direction: column;
    }

    .tp-coupon-input .tp-apply-coupon {
        width: 100%;
    }
}

/* Empty Cart State */
.woocommerce-info,
.woocommerce-message {
    background: #f8f8f8;
    border-left: 4px solid var(--color-2);
    padding: 16px 20px;
    margin-bottom: 24px;
    border-radius: 4px;
}

.return-to-shop {
    text-align: center;
    margin-top: 32px;
}

.return-to-shop .button {
    padding: 14px 32px !important;
    background: var(--color) !important;
    color: #ffffff !important;
    border-radius: 4px !important;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s;
}

.return-to-shop .button:hover {
    background: #333333 !important;
}

/* Additional Cart Styling */
.woocommerce-cart .woocommerce-notices-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Loading State */
.woocommerce-cart-form.processing {
    opacity: 0.6;
    pointer-events: none;
}

/* Quantity Input Buttons (if theme adds them) */
.tp-quantity-control button.plus,
.tp-quantity-control button.minus {
    width: 36px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.2rem;
    color: #666666;
    transition: color 0.2s;
}

.tp-quantity-control button.plus:hover,
.tp-quantity-control button.minus:hover {
    color: var(--color);
}

/* Cross-sells Section - New Separate Section */
.tp-cross-sells-section {
    width: 100%;
    margin-top: 60px;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 12px;
}

.tp-cross-sells-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 32px !important;
    text-align: center;
    color: var(--color);
}

.tp-cross-sells-products {
    width: 100%;
}

.tp-cross-sells-products .cross-sells {
    width: 100%;
}

.tp-cross-sells-products .cross-sells > h2 {
    display: none; /* Hide the default WooCommerce title */
}

.tp-cross-sells-products .cross-sells ul.products {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 18px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
}

.tp-cross-sells-products .cross-sells ul.products li.product,
.woocommerce-cart .tp-cross-sells-products ul.products li.product {
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    flex: 0 0 calc(25% - 18px) !important;
    max-width: calc(25% - 18px) !important;
    margin: 0 !important;
    float: none !important;
}

.tp-cross-sells-products .cross-sells ul.products li.product:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.tp-cross-sells-products .cross-sells ul.products li.product img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 12px;
}

.tp-cross-sells-products .cross-sells ul.products li.product .woocommerce-loop-product__title {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: #333333;
    line-height: 1.4;
}

.tp-cross-sells-products .cross-sells ul.products li.product .price {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color);
    margin-bottom: 12px;
}

.tp-cross-sells-products .cross-sells ul.products li.product .button {
    background: var(--color);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.tp-cross-sells-products .cross-sells ul.products li.product .button:hover {
    background: var(--color-hover, #333333);
}

/* Old Cross-sells in collaterals - hide */
.cart-collaterals .cross-sells {
    display: none;
}

/* Fix for WooCommerce default styles */
.woocommerce-cart table.cart {
    display: none !important;
}

.woocommerce-cart .woocommerce-cart-form table {
    display: none !important;
}

/* Show our custom cart */
.tp-cart-items {
    display: flex !important;
}

/* Hide WooCommerce messages that might interfere */
.woocommerce-cart .woocommerce-message {
    margin-bottom: 24px;
}

/* Ensure proper RTL support */
[dir="rtl"] .tp-cart-item {
    direction: rtl;
}

[dir="rtl"] .tp-item-price-section {
    text-align: right;
}

[dir="rtl"] .tp-summary-row {
    direction: rtl;
}

/* Shipping Calculator Styling */
.tp-shipping-row .woocommerce-shipping-destination {
    font-size: 0.85rem;
    color: #666666;
    margin-top: 8px;
}

.tp-shipping-row .shipping-calculator-button {
    font-size: 0.85rem;
    color: var(--color-2);
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.tp-shipping-row .shipping-calculator-form {
    margin-top: 16px;
    padding: 16px;
    background: #f8f8f8;
    border-radius: 4px;
}

.tp-shipping-row .shipping-calculator-form .form-row {
    margin-bottom: 12px;
}

.tp-shipping-row .shipping-calculator-form input,
.tp-shipping-row .shipping-calculator-form select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-5);
    border-radius: 4px;
    font-family: var(--font);
}

.tp-shipping-row .shipping-calculator-form button {
    padding: 10px 20px;
    background: var(--color);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font);
}

/* Shipping Methods List */
.tp-shipping-cost {
    margin: 0 10px 0 0;
}

.tp-shipping-cost ul#shipping_method {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tp-shipping-cost ul#shipping_method li {
    margin-bottom: 8px;
}

.tp-shipping-cost ul#shipping_method label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.tp-shipping-cost ul#shipping_method input[type="radio"] {
    margin: 0;
}

/* Price Display */
.tp-item-price .woocommerce-Price-amount,
.tp-summary-row .woocommerce-Price-amount {
    font-weight: inherit;
}

/* Sale Price */
.tp-item-price del {
    opacity: 0.5;
    margin-left: 8px;
}

.tp-item-price ins {
    text-decoration: none;
    color: var(--color-2);
}

/* Backorder Notice */
.tp-item-meta .backorder_notification {
    color: var(--color-4);
    font-size: 0.85rem;
    margin: 4px 0 0 0;
}

/* Screen Reader Text */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    height: 1px;
    overflow: hidden;
    position: absolute !important;
    width: 1px;
    word-wrap: normal !important;
}

/* Additional Cart Improvements */
.woocommerce-cart .tp-cart-container {
    background: #fafafa;
}

.tp-cart-items-wrapper .woocommerce-cart-form {
    width: 100%;
}

/* Ensure proper spacing - removed as each item now has its own border-radius */

/* Loading state */
.woocommerce-cart-form.processing .tp-cart-items {
    opacity: 0.6;
    pointer-events: none;
}

.tp-cart-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tp-cart-loading-overlay.active {
    display: flex;
    opacity: 1;
}

.tp-cart-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--color);
    border-radius: 50%;
    animation: tp-spin 0.8s linear infinite;
}

@keyframes tp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Update cart button - hide it since we auto-update */
.woocommerce-cart-form button[name="update_cart"] {
    display: none !important;
}

/* Coupon applied message */
.woocommerce-message {
    background: #d4edda;
    border-left: 4px solid #28a745;
    padding: 16px 20px;
    margin-bottom: 24px;
    border-radius: 4px;
    color: #155724;
}

.woocommerce-error {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    padding: 16px 20px;
    margin-bottom: 24px;
    border-radius: 4px;
    color: #721c24;
}