/**
 * FINAL YITH Added to Cart Popup Styles (Clean Version)
 * Enhanced for Woodmart theme compatibility
 * Button colors removed for UI configuration
 */

/* Base Popup Styling Improvements */
.yith-wacp-wrapper {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.yith-wacp-overlay {
    background: rgba(0, 0, 0, 0.65) !important;
    backdrop-filter: blur(3px);
}

/* Fix popup centering and alignment */
.yith-wacp-content {
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    width: 800px !important;
    max-width: 90vw !important;
    position: relative !important;
    margin: 20px auto !important;
    animation: slideInUp 0.3s ease-out;
    left: auto !important;
    transform: none !important;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Popup Header Enhancement */
.yith-wacp-message {
    background: linear-gradient(135deg, #2e6bc6 0%, #007bc4 100%);
    color: #fff !important;
    padding: 20px 25px !important;
    border-radius: 12px 12px 0 0 !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    text-align: center;
    margin: -1px -1px 0 -1px !important;
}

.yith-wacp-message h3 {
    color: #fff !important;
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
}

/* Product Table Improvements */
.yith-wacp-wrapper table.cart-list {
    border-collapse: separate !important;
    border-spacing: 0 8px !important;
}

.yith-wacp-wrapper table.cart-list tr {
    background: #f7f7f7;
    transition: all 0.2s ease;
}

.yith-wacp-wrapper table.cart-list tr:hover {
    background: #f0f0f0;
    transform: translateX(2px);
}

.yith-wacp-wrapper table.cart-list td {
    padding: 15px !important;
    vertical-align: middle !important;
    border: none !important;
}

.yith-wacp-wrapper table.cart-list td:first-child {
    border-radius: 8px 0 0 8px;
}

.yith-wacp-wrapper table.cart-list td:last-child {
    border-radius: 0 8px 8px 0;
}

/* Product Image Styling */
.yith-wacp-wrapper .item-thumb img {
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
}

.yith-wacp-wrapper .item-thumb:hover img {
    transform: scale(1.05);
}

/* Related Products Section Enhancement */
.yith-wacp-custom-related {
    padding: 20px !important;
    background: #fafafa;
    border-top: 1px solid #e5e5e5;
    margin: 0 -20px -20px -20px !important;
    border-radius: 0 0 12px 12px;
}

.yith-wacp-custom-related h4 {
    color: #2e6bc6;
    font-size: 18px !important;
    font-weight: 600 !important;
    margin-bottom: 20px !important;
    text-align: center;
}

.yith-wacp-related-products {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.yith-wacp-related-product {
    background: #fff !important;
    border-radius: 8px !important;
    padding: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.yith-wacp-related-product:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.yith-wacp-related-product .product-element-top {
    margin-bottom: 10px;
    position: relative;
}

.yith-wacp-related-product img {
    width: 100% !important;
    height: auto !important;
    border-radius: 6px;
    object-fit: cover;
}

.yith-wacp-related-product .woocommerce-loop-product__title {
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin: 8px 0 5px 0 !important;
    color: #333 !important;
    font-weight: 500 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.yith-wacp-related-product .price {
    font-size: 14px !important;
    color: #2e6bc6 !important;
    font-weight: 600 !important;
    margin: 5px 0 10px 0 !important;
}

/* Custom Add to Cart Button - Woodmart Style Integration */
.yith-popup-add-btn {
    margin-top: 10px;
}

.yith-popup-add-btn .add-to-cart-loop {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    padding: 8px 12px !important;
    background: linear-gradient(135deg, #2e6bc6, #007bc4) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease !important;
    cursor: pointer;
    text-decoration: none !important;
    box-shadow: 0 2px 6px rgba(46, 107, 198, 0.2);
}

.yith-popup-add-btn .add-to-cart-loop:hover {
    background: linear-gradient(135deg, #007bc4, #2e6bc6) !important;
    box-shadow: 0 4px 12px rgba(46, 107, 198, 0.3);
    transform: translateY(-1px);
}

.yith-popup-add-btn .add-to-cart-loop:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(46, 107, 198, 0.2);
}

.yith-popup-add-btn .add-to-cart-loop:before {
    content: '\f07a';
    font-family: 'Font Awesome 5 Free', 'FontAwesome';
    font-weight: 900;
    margin-right: 6px;
    font-size: 11px;
}

.yith-popup-add-btn .added_to_cart {
    display: none !important;
}

/* Mobile Responsive Add to Cart Button */
@media (max-width: 1024px) {
    .yith-popup-add-btn .add-to-cart-loop {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        position: relative;
    }

    .yith-popup-add-btn .add-to-cart-loop span {
        display: none !important;
    }

    .yith-popup-add-btn .add-to-cart-loop:before {
        margin-right: 0;
        font-size: 16px;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }

    .yith-wacp-related-products {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

/* Action Buttons Base Styles (WITHOUT COLORS) */
.yith-wacp-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 20px !important;
    background: #fff;
    border-top: 1px solid #e5e5e5;
}

.yith-wacp-actions a.button {
    padding: 12px 24px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    flex: 1;
    text-align: center;
}

/* Button hover effects (structure only, no colors) */
.yith-wacp-actions a.button:hover {
    transform: translateY(-2px);
}

/* Cart Total Section */
.yith-wacp-cart-info {
    background: linear-gradient(to right, #f9f9f9, #fff);
    padding: 15px 20px !important;
    border-top: 2px solid #2e6bc6;
    margin: 15px 0 !important;
}

.yith-wacp-cart-info .cart-totals {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px !important;
}

.yith-wacp-cart-info .cart-totals .cart-label {
    color: #666;
    font-weight: 500;
}

.yith-wacp-cart-info .cart-totals .cart-value {
    color: #2e6bc6;
    font-weight: 700;
    font-size: 18px !important;
}

/* Close Button Enhancement */
.yith-wacp-close {
    width: 36px !important;
    height: 36px !important;
    background: #fff !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    top: 10px !important;
    right: 10px !important;
    transition: all 0.3s ease !important;
}

.yith-wacp-close:hover {
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

.yith-wacp-close:before,
.yith-wacp-close:after {
    background: #333 !important;
    width: 16px !important;
    height: 2px !important;
}

/* Loading States */
.yith-wacp-related-product.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.yith-wacp-related-product.loading:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2e6bc6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Quantity Input Styling */
.yith-wacp-wrapper input.qty {
    width: 60px !important;
    padding: 8px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    text-align: center;
    font-size: 14px !important;
    transition: border-color 0.2s ease;
}

.yith-wacp-wrapper input.qty:focus {
    border-color: #2e6bc6 !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(46, 107, 198, 0.1);
}

/* Responsive Design for Mobile */
@media (max-width: 768px) {
    .yith-wacp-content {
        width: 95vw !important;
        max-width: none !important;
        margin: 10px auto !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }

    .yith-wacp-related-products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .yith-wacp-related-product .woocommerce-loop-product__title {
        font-size: 12px !important;
    }

    .yith-wacp-actions {
        flex-direction: column;
    }

    .yith-wacp-actions a.button {
        width: 100%;
        text-align: center;
    }

    .yith-wacp-message {
        font-size: 14px !important;
        padding: 15px !important;
    }
}

/* RTL Support */
.rtl .yith-wacp-wrapper table.cart-list tr:hover {
    transform: translateX(-2px);
}

.rtl .yith-wacp-close:hover {
    transform: rotate(-90deg) scale(1.1);
}

/* Accessibility Improvements */
.yith-wacp-wrapper a:focus,
.yith-wacp-wrapper button:focus {
    outline: 2px solid #2e6bc6 !important;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .yith-wacp-content {
        border: 2px solid #000;
    }

    .yith-popup-add-btn .add-to-cart-loop {
        border: 2px solid #000 !important;
    }
}

/* Ensure proper z-index layering */
.yith-wacp-overlay {
    z-index: 99998 !important;
}

.yith-wacp-wrapper {
    z-index: 99999 !important;
}