/*
 Theme Name:   Woodmart Child
 Description:  Woodmart Child Theme
 Author:       XTemos
 Author URI:   http://xtemos.com
 Template:     woodmart
 Version:      1.0.0
 Text Domain:  woodmart
*/

/* WoodMart Add to Cart Popup - Upsell Products (3 Per Row) */

.wd-popup-upsell-section {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #e5e5e5;
}

.wd-popup-upsell-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 20px 0;
    text-align: center;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 3 columns grid layout */
.wd-popup-upsell-products {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

/* Single upsell product item */
.wd-popup-upsell-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.wd-popup-upsell-item:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.12);
    transform: translateY(-5px);
    border-color: #bbb;
}

/* Product link wrapper - now vertical layout */
.wd-popup-upsell-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    padding: 15px;
    flex: 1;
}

/* Product image - full width on top */
.wd-popup-upsell-img {
    width: 100%;
    height: 140px;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 6px;
    background: #f9f9f9;
    margin-bottom: 12px;
}

.wd-popup-upsell-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.wd-popup-upsell-item:hover .wd-popup-upsell-img img {
    transform: scale(1.15);
}

/* Product details */
.wd-popup-upsell-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: center;
}

/* Product name */
.wd-popup-upsell-name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 8px 0;
    color: #333;
    min-height: 38px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wd-popup-upsell-link:hover .wd-popup-upsell-name {
    color: #000;
}

/* Product price */
.wd-popup-upsell-price {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-top: auto;
}

.wd-popup-upsell-price .amount {
    color: #e74c3c;
}

.wd-popup-upsell-price del {
    opacity: 0.5;
    margin-right: 5px;
    font-size: 14px;
}

/* Sale badge */
.wd-popup-upsell-item .onsale {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    z-index: 1;
}

/* Actions (buttons) */
.wd-popup-upsell-actions {
    padding: 0 15px 15px;
}

/* Add to cart button */
.wd-popup-upsell-atc,
.wd-popup-upsell-view {
    width: 100%;
    display: block;
    text-align: center;
    padding: 10px 15px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 5px;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.wd-popup-upsell-atc:hover,
.wd-popup-upsell-view:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.wd-popup-upsell-atc.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Adjust popup width to accommodate 3 columns */
.wd-popup.popup-added_to_cart {
    max-width: 750px;
    width: 100%;
}

.wd-popup .added-to-cart {
    padding: 30px;
}

.wd-popup .added-to-cart h3 {
    margin-bottom: 20px;
}

/* Tablet - 2 columns */
@media (max-width: 768px) {
    .wd-popup-upsell-products {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .wd-popup.popup-added_to_cart {
        max-width: 95%;
    }
    
    .wd-popup .added-to-cart {
        padding: 25px;
    }
    
    .wd-popup-upsell-img {
        height: 120px;
    }
    
    .wd-popup-upsell-section {
        margin-top: 20px;
        padding-top: 20px;
    }
    
    .wd-popup-upsell-title {
        font-size: 16px;
        margin-bottom: 15px;
    }
}

/* Mobile - 1 column with horizontal layout */
@media (max-width: 480px) {
    .wd-popup-upsell-products {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .wd-popup .added-to-cart {
        padding: 20px;
    }
    
    /* Switch to horizontal layout on mobile */
    .wd-popup-upsell-link {
        flex-direction: row;
        padding: 12px;
        gap: 12px;
    }
    
    .wd-popup-upsell-img {
        width: 80px;
        height: 80px;
        margin-bottom: 0;
    }
    
    .wd-popup-upsell-details {
        text-align: left;
    }
    
    .wd-popup-upsell-name {
        font-size: 13px;
        min-height: auto;
    }
    
    .wd-popup-upsell-price {
        font-size: 14px;
    }
    
    .wd-popup-upsell-actions {
        padding: 0 12px 12px;
    }
    
    .wd-popup-upsell-atc,
    .wd-popup-upsell-view {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
}

/* Large screens - keep 3 columns */
@media (min-width: 1200px) {
    .wd-popup.popup-added_to_cart {
        max-width: 850px;
    }
    
    .wd-popup-upsell-img {
        height: 160px;
    }
}

/* Loading state for buttons */
.wd-popup-upsell-atc.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Smooth fade-in animation for upsells */
.wd-popup-upsell-section {
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Optional: Add subtle hover effect to entire section */
.wd-popup-upsell-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.wd-popup-upsell-item:hover::before {
    opacity: 0.3;
}

/* Better button styling */
.wd-popup-upsell-atc {
    background: #333;
    color: #fff;
}

.wd-popup-upsell-atc:hover {
    background: #000;
    color: #fff;
}

/* View product button alternate style */
.wd-popup-upsell-view {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.wd-popup-upsell-view:hover {
    background: #e5e5e5;
    color: #000;
}