/**
 * Custom Product Carousel Widget Styles
 */

/* ==================== Grid Layout ==================== */
.custom-product-grid-widget {
    width: 100%;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
}

.product-grid-item {
    width: 100%;
}

/* Responsive Grid */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* ==================== Carousel Layout ==================== */
/* Container - Force overflow visible on all parent elements */
.custom-product-carousel-widget {
    position: relative;
    width: 100%;
    overflow: visible !important;
}

.custom-product-carousel-widget .product-carousel-swiper {
    position: static;
    overflow: hidden;
    padding-bottom: 50px;
    margin: 0;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

/* Force all Elementor parents to allow overflow */
.elementor-widget-container,
.elementor-element.elementor-widget,
.elementor-column-wrap,
.elementor-widget-wrap,
.elementor-column,
.elementor-row,
.elementor-section,
.elementor-container,
.e-con,
.e-con-inner {
    overflow: visible !important;
}

/* Navigation positioned relative to widget container */
.custom-product-carousel-widget .swiper-button-prev,
.custom-product-carousel-widget .swiper-button-next {
    position: absolute;
    top: 35%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    transition: all 0.3s ease;
}

.custom-product-carousel-widget .swiper-button-prev {
    left: -50px;
}

.custom-product-carousel-widget .swiper-button-next {
    right: -50px;
}

.custom-product-carousel-widget:hover .swiper-button-prev,
.custom-product-carousel-widget:hover .swiper-button-next {
    opacity: 1;
}

.custom-product-carousel-widget .swiper-button-prev:hover,
.custom-product-carousel-widget .swiper-button-next:hover {
    background: #c62828;
}

.custom-product-carousel-widget .swiper-button-prev:hover svg,
.custom-product-carousel-widget .swiper-button-next:hover svg {
    fill: #fff;
}

.custom-product-carousel-widget .swiper-button-prev svg,
.custom-product-carousel-widget .swiper-button-next svg {
    width: 20px;
    height: 20px;
    fill: #333;
    transition: fill 0.3s ease;
}

.custom-product-carousel-widget .swiper-button-prev::after,
.custom-product-carousel-widget .swiper-button-next::after {
    display: none;
}

/* Custom navigation icon images */
.custom-product-carousel-widget .swiper-button-prev .nav-icon,
.custom-product-carousel-widget .swiper-button-next .nav-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

/* Product Card */
.product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* Image Container */
.product-card-image {
    position: relative;
    overflow: hidden;
    background: #f8f8f8;
}

.product-card-image .product-image-link {
    display: block;
    position: relative;
    overflow: hidden;
}

.product-card-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.product-card-image .primary-image {
    position: relative;
    z-index: 2;
    opacity: 1;
    transition: opacity 0.4s ease-in-out;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.product-card-image .secondary-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    z-index: 1;
    pointer-events: none;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.product-card:hover .product-card-image.has-gallery .primary-image {
    opacity: 0;
}

.product-card:hover .product-card-image.has-gallery .secondary-image {
    opacity: 1;
}

/* 取消悬停时图片圆角 */
.product-card:hover .product-card-image img {
    border-radius: 0 !important;
}

/* Sale Badge */
.product-badge-sale {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #c62828;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    width: 50px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    border-radius: 50%;
    z-index: 10;
}

/* Action Icons (Right Side) */
.product-action-icons {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.product-action-icons .action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.product-action-icons .action-icon svg {
    width: 18px;
    height: 18px;
    fill: #333;
    transition: fill 0.3s ease;
}

/* Wishlist Icon - Heart outline/filled states */
.product-action-icons .wishlist-icon .heart-outline {
    display: block;
}

.product-action-icons .wishlist-icon .heart-filled {
    display: none;
}

.product-action-icons .wishlist-icon:hover svg {
    fill: #c62828;
}

.product-action-icons .wishlist-icon.active .heart-outline {
    display: none;
}

.product-action-icons .wishlist-icon.active .heart-filled {
    display: block;
    fill: #c62828;
}

/* Quickview and Compare Icons */
.product-action-icons .quickview-icon,
.product-action-icons .compare-icon {
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
}

.product-card:hover .product-action-icons .quickview-icon,
.product-card:hover .product-action-icons .compare-icon {
    opacity: 1;
    transform: translateX(0);
}

.product-action-icons .quickview-icon:hover {
    background: #333;
}

.product-action-icons .quickview-icon:hover svg {
    fill: #fff;
}

/* Compare button - 使用Woodmart主题样式 */
.product-action-icons .wd-compare-btn.compare-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
}

/* 比较按钮选中状态 - 红色图标 */
.product-action-icons .wd-compare-btn.added::before,
.product-action-icons .wd-compare-btn.compare-icon.added::before,
.product-action-icons .wd-compare-icon.added::before {
    color: #c62828 !important;
}

/* 比较按钮悬停状态 */
.product-action-icons .wd-compare-btn:hover::before,
.product-action-icons .wd-compare-btn.compare-icon:hover::before,
.product-action-icons .wd-compare-icon:hover::before {
    color: #c62828 !important;
}

/* 如果图标在a标签上 */
.product-action-icons .wd-compare-btn.added a::before,
.product-action-icons .wd-compare-icon.added a::before {
    color: #c62828 !important;
}

.product-action-icons .wd-compare-btn:hover a::before,
.product-action-icons .wd-compare-icon:hover a::before {
    color: #c62828 !important;
}


/* Card Content */
.product-card-content {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Title */
.product-card-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    margin: 0 0 10px 0;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 40px;
}

.product-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-card-title a:hover {
    color: #c62828;
}

/* Price */
.product-card-price {
    text-align: center;
    margin-bottom: 15px;
    font-size: 16px;
}

.product-card-price del {
    color: #999;
    font-size: 14px;
    margin-right: 8px;
}

.product-card-price ins {
    color: #c62828;
    font-weight: 600;
    text-decoration: none;
}

.product-card-price .woocommerce-Price-amount {
    font-weight: 600;
}

/* Add to Cart Button */
.product-card-button {
    margin-top: auto;
}

.product-card-button .add-to-cart-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    background: #c62828;
    color: #fff;
    text-align: center;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.product-card-button .add-to-cart-btn:hover {
    background: #a52222;
}

.product-card-button .add-to-cart-btn.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.swiper-button-disabled {
    opacity: 0.3 !important;
    cursor: not-allowed;
}

/* Pagination */
.swiper-pagination {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 10;
}

.swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #ccc;
    opacity: 1;
    margin: 0 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    cursor: pointer;
}

.swiper-pagination-bullet-active {
    background: #c62828;
    transform: scale(1.2);
}

/* Quick View Modal */
.product-quickview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}

.product-quickview-modal.active {
    display: flex;
}

.quickview-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.quickview-modal-content {
    position: relative;
    background: #fff;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    border-radius: 8px;
    overflow: hidden;
    z-index: 1;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.quickview-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    font-size: 36px;
    font-weight: 300;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
    z-index: 100;
    color: #333;
    transition: color 0.3s ease, transform 0.3s ease;
}

.quickview-modal-close:hover {
    color: #c62828;
    transform: scale(1.1);
}

.quickview-modal-body {
    padding: 30px;
    max-height: 90vh;
    overflow-y: auto;
}

.quickview-modal-body .quickview-product {
    display: flex;
    gap: 30px;
}

.quickview-modal-body .quickview-product-image {
    flex: 0 0 45%;
}

.quickview-modal-body .quickview-product-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.quickview-modal-body .quickview-product-details {
    flex: 1;
}

.quickview-modal-body .quickview-product-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
}

.quickview-modal-body .quickview-product-price {
    font-size: 24px;
    margin-bottom: 20px;
}

.quickview-modal-body .quickview-product-price del {
    color: #999;
    font-size: 18px;
    margin-right: 10px;
}

.quickview-modal-body .quickview-product-price ins {
    color: #c62828;
    text-decoration: none;
    font-weight: 600;
}

.quickview-modal-body .quickview-product-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

.quickview-modal-body .quickview-product-quantity {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.quickview-modal-body .quantity-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.quickview-modal-body .quantity-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.quickview-modal-body .quantity-btn:hover {
    background: #f5f5f5;
}

.quickview-modal-body .quantity-input {
    width: 50px;
    height: 40px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 16px;
}

.quickview-modal-body .quickview-add-to-cart {
    padding: 12px 30px;
    background: #c62828;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.quickview-modal-body .quickview-add-to-cart:hover {
    background: #c62828;
}

.quickview-modal-body .quickview-buy-now {
    padding: 12px 30px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
    margin-left: 10px;
}

.quickview-modal-body .quickview-buy-now:hover {
    background: #000;
}

/* 弹窗操作区域 - 仿产品详情页样式 */
.quickview-modal-body .quickview-product-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    margin-top: 20px;
}

.quickview-modal-body .quickview-product-actions .quantity-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.quickview-modal-body .quickview-product-actions .quantity-wrapper .quantity-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.quickview-modal-body .quickview-product-actions .quantity-wrapper .quantity-btn:hover {
    background: #f5f5f5;
}

.quickview-modal-body .quickview-product-actions .quantity-wrapper .quantity-input {
    width: 50px;
    height: 40px;
    text-align: center;
    font-size: 16px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    -moz-appearance: textfield;
    appearance: textfield;
}

/* 隐藏input number的默认spinner */
.quickview-modal-body .quickview-product-actions .quantity-wrapper .quantity-input::-webkit-outer-spin-button,
.quickview-modal-body .quickview-product-actions .quantity-wrapper .quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.quickview-modal-body .quickview-product-actions .quickview-add-to-cart {
    height: 40px;
    padding: 0 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 弹窗比较按钮 - 使用主题图标 */
.quickview-modal-body .quickview-product-actions .quickview-compare {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    position: relative;
}

.quickview-modal-body .quickview-product-actions .quickview-compare:hover {
    border-color: #c62828;
}

.quickview-modal-body .quickview-product-actions .quickview-compare:hover::before {
    color: #c62828 !important;
}

.quickview-modal-body .quickview-product-actions .quickview-compare.added {
    border-color: #c62828;
}

.quickview-modal-body .quickview-product-actions .quickview-compare.added::before {
    color: #c62828 !important;
}

/* 弹窗收藏按钮 */
.quickview-modal-body .quickview-product-actions .quickview-wishlist {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.quickview-modal-body .quickview-product-actions .quickview-wishlist svg {
    width: 20px;
    height: 20px;
    fill: #666;
    transition: fill 0.3s ease;
}

.quickview-modal-body .quickview-product-actions .quickview-wishlist .heart-outline {
    display: block;
}

.quickview-modal-body .quickview-product-actions .quickview-wishlist .heart-filled {
    display: none;
}

.quickview-modal-body .quickview-product-actions .quickview-wishlist:hover {
    border-color: #c62828;
}

.quickview-modal-body .quickview-product-actions .quickview-wishlist:hover svg {
    fill: #c62828;
}

.quickview-modal-body .quickview-product-actions .quickview-wishlist.active {
    border-color: #c62828;
}

.quickview-modal-body .quickview-product-actions .quickview-wishlist.active .heart-outline {
    display: none;
}

.quickview-modal-body .quickview-product-actions .quickview-wishlist.active .heart-filled {
    display: block;
    fill: #c62828;
}

/* 服务说明列表 */
.quickview-modal-body .quickview-service-list {
    list-style: none;
    padding: 0;
    margin: 25px 0;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.quickview-modal-body .quickview-service-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
}

.quickview-modal-body .quickview-service-list li svg {
    flex-shrink: 0;
    color: #c62828;
    margin-top: 2px;
}

.quickview-modal-body .quickview-meta {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    font-size: 14px;
    color: #666;
}

.quickview-modal-body .quickview-meta p {
    margin: 5px 0;
}

.quickview-modal-body .quickview-meta strong {
    color: #333;
}

.quickview-modal-body .quickview-share {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.quickview-modal-body .quickview-share a,
.quickview-modal-body .quickview-share span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.3s ease;
    cursor: pointer;
}

.quickview-modal-body .quickview-share a:hover,
.quickview-modal-body .quickview-share span:hover {
    transform: scale(1.1);
    opacity: 0.9;
}

.quickview-modal-body .quickview-share .share-facebook {
    background: #1877f2;
    color: #fff;
}

.quickview-modal-body .quickview-share .share-whatsapp {
    background: #25d366;
    color: #fff;
}

.quickview-modal-body .quickview-share .share-telegram {
    background: #0088cc;
    color: #fff;
}

.quickview-modal-body .quickview-share .share-twitter {
    background: #000;
    color: #fff;
}

.quickview-modal-body .quickview-share .share-email {
    background: #ea4335;
    color: #fff;
}

.quickview-modal-body .quickview-share .share-pinterest {
    background: #e60023;
    color: #fff;
}

.quickview-modal-body .quickview-share .share-line {
    background: #00c300;
    color: #fff;
}

.quickview-modal-body .quickview-share .share-more {
    background: #2196f3;
    color: #fff;
}

.quickview-modal-body .quickview-share .share-twitter {
    background: #1da1f2;
    color: #fff;
}

.quickview-modal-body .quickview-share .share-pinterest {
    background: #bd081c;
    color: #fff;
}

/* Loading Spinner */
.quickview-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #c62828;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Compare Notification */
.compare-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: #fff;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 99998;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.compare-notification a {
    color: #c62828;
    margin-left: 10px;
}

/* Responsive */
@media (max-width: 1024px) {
    .swiper-button-prev {
        left: 10px;
    }
    
    .swiper-button-next {
        right: 10px;
    }
    
    .swiper-button-prev,
    .swiper-button-next {
        width: 40px;
        height: 40px;
        opacity: 1;
    }
}

@media (max-width: 768px) {
    /* 轮播手机端全宽显示 */
    .custom-product-carousel-widget .product-carousel-swiper {
        margin: 0;
        padding: 0 5px 50px 5px;
    }
    
    /* 手机端一排显示两个 */
    .custom-product-carousel-widget .swiper-slide {
        width: calc(50% - 5px) !important;
    }
    
    /* 手机端导航按钮 */
    .custom-product-carousel-widget .swiper-button-prev,
    .custom-product-carousel-widget .swiper-button-next {
        width: 35px;
        height: 35px;
        opacity: 1;
    }
    
    .custom-product-carousel-widget .swiper-button-prev {
        left: 5px;
    }
    
    .custom-product-carousel-widget .swiper-button-next {
        right: 5px;
    }
    
    /* 弹窗手机端样式 */
    .quickview-modal-body .quickview-product {
        flex-direction: column;
    }
    
    .quickview-modal-body .quickview-product-image {
        flex: none;
    }
    
    .quickview-modal-body {
        padding: 20px;
    }
    
    .quickview-modal-body .quickview-product-quantity {
        flex-wrap: wrap;
    }
    
}

@media (max-width: 480px) {
    .product-card-title {
        font-size: 13px;
    }
    
    .product-card-price {
        font-size: 14px;
    }
    
    .product-card-button .add-to-cart-btn {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .swiper-button-prev,
    .swiper-button-next {
        width: 35px;
        height: 35px;
    }
    
    .swiper-button-prev svg,
    .swiper-button-next svg {
        width: 16px;
        height: 16px;
    }
}

/* Compare notification with redirect */
.compare-notification.compare-redirect {
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px 30px;
}

.compare-notification .compare-actions {
    display: flex;
    gap: 10px;
}

.compare-notification .compare-view-btn {
    background: #c62828;
    color: #fff;
    padding: 8px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.3s ease;
}

.compare-notification .compare-view-btn:hover {
    background: #a52222;
    color: #fff;
}

.compare-notification .compare-close-btn {
    background: transparent;
    border: 1px solid #333;
    color: #333;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.compare-notification .compare-close-btn:hover {
    background: #333;
    color: #fff;
}
