/* Unified Product Card CSS */
/* This file prevents 404 errors from theme layouts */

/* Unified Product Card Layout */
.unified-product-card {
    position: relative;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    transition: all 0.3s ease;
    height: 100%;
}

.unified-product-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Product Image Container */
.product-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
}

.product-image-wrapper {
    width: 100%;
    height: 100%;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.unified-product-card:hover .product-image {
    transform: scale(1.05);
}

/* Wishlist Button - Top right for LTR, Top left for RTL */
.wishlist-button-top {
    position: absolute;
    top: 10px;
    right: 10px; /* Default LTR position */
    z-index: 15;
}

.btn-wishlist {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-wishlist:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wishlist-heart-icon {
    width: 20px;
    height: 20px;
    filter: hue-rotate(340deg) saturate(150%) brightness(0.8);
    transition: all 0.3s ease;
}

.btn-wishlist:hover .wishlist-heart-icon {
    filter: hue-rotate(340deg) saturate(200%) brightness(1);
    transform: scale(1.1);
}

.wishlist_icon_active {
    filter: hue-rotate(340deg) saturate(200%) brightness(1) !important;
}

.wishlist_icon_active .wishlist-heart-icon {
    filter: hue-rotate(340deg) saturate(200%) brightness(1) !important;
}

/* Loading states */
.btn-wishlist.loading,
.btn-cart.loading {
    opacity: 0.6;
    pointer-events: none;
}

.btn-wishlist.loading::after,
.btn-cart.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Cart animation */
.cart-added {
    animation: cartPulse 0.6s ease-in-out;
}

@keyframes cartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* RTL Support for wishlist button */
[dir="rtl"] .wishlist-button-top {
    right: auto;
    left: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .wishlist-button-top {
        top: 8px;
        right: 8px;
    }
    
    [dir="rtl"] .wishlist-button-top {
        right: auto;
        left: 8px;
    }
    
    .btn-wishlist {
        width: 36px;
        height: 36px;
    }
    
    .wishlist-heart-icon {
        width: 18px;
        height: 18px;
    }
}

/* Product Info */
.product-info {
    padding: 0 !important; /* No padding to eliminate spaces */
}

.product-brand {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 500;
}

.product-brand-placeholder {
    height: 20px;
}

.product-title {
    font-size: 12px !important; /* Added !important to override theme.css */
    font-weight: 600;
    color: #333;
    margin-bottom: 0 !important; /* No space below title */
    line-height: 1.5 !important; /* Increased line height for better readability */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
    word-wrap: break-word;
}

.product-title a {
    color: inherit;
    text-decoration: none;
}

.product-title a:hover {
    color: var(--web-primary);
}

/* Price Styling - Top of product info */
.product-price-container {
    margin-bottom: 8px;
}

.old-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
    margin-bottom: 0 !important; /* No space below old price */
}

.new-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--web-primary);
    text-decoration: none;
}

.discount-percentage {
    font-size: 11px;
    color: #fff;
    background: #ff4757;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Rating and Cart Row - Bottom */
.rating-cart-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-top: 1px solid #f0f0f0;
    margin-top: 0 !important; /* No space above the button row */
    margin-bottom: 0 !important; /* No space below the button row */
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 5px;
}

.star-rating {
    display: flex;
    gap: 1px;
}

.star-rating i {
    color: #ffc107;
    font-size: 12px;
}

.rating-count {
    font-size: 11px;
    color: #666;
}

.btn-cart {
    background: rgba(255, 255, 255, 0.95); /* Same as wishlist button */
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: var(--web-primary); /* Use primary color for icon */
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-cart:hover {
    background: white;
    transform: scale(1.1);
    color: var(--web-primary);
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Promotional Badges - Top left for LTR, Top right for RTL */
.promo-tag {
    position: absolute;
    top: 10px;
    left: 10px; /* Default LTR position */
    z-index: 10;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: white;
    text-align: center;
    max-width: 80px;
    line-height: 1.2;
}

/* Deal of the Day Badge */
.deal-of-the-day-badge {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
}

/* Clearance Sale Badge */
.clearance-sale-badge {
    background: linear-gradient(135deg, #a55eea, #8854d0);
    box-shadow: 0 2px 4px rgba(165, 94, 234, 0.3);
}

/* Flash Deal Badge */
.flash-deal-badge {
    background: linear-gradient(135deg, #fd79a8, #e84393);
    box-shadow: 0 2px 4px rgba(253, 121, 168, 0.3);
}

/* Featured Badge */
.featured-badge {
    background: linear-gradient(135deg, #54a0ff, #2e86de);
    box-shadow: 0 2px 4px rgba(84, 160, 255, 0.3);
}

/* New Arrival Badge */
.new-arrival-badge {
    background: linear-gradient(135deg, #5f27cd, #341f97);
    box-shadow: 0 2px 4px rgba(95, 39, 205, 0.3);
}

/* Top Rated Badge */
.top-rated-badge {
    background: linear-gradient(135deg, #ffa726, #fb8c00);
    box-shadow: 0 2px 4px rgba(255, 167, 38, 0.3);
}

/* Best Selling Badge */
.best-selling-badge {
    background: linear-gradient(135deg, #66bb6a, #43a047);
    box-shadow: 0 2px 4px rgba(102, 187, 106, 0.3);
}

/* Discount Badge */
.discount-badge {
    background: linear-gradient(135deg, #ef5350, #e53935);
    box-shadow: 0 2px 4px rgba(239, 83, 80, 0.3);
}

/* Fixed Heights for Uniform Cards */
.unified-product-card {
    min-height: 406px !important; /* Increased height to accommodate larger content */
    display: flex !important;
    flex-direction: column !important;
}

.product-image-container {
    height: 200px !important; /* Fixed height for image section */
    flex-shrink: 0 !important;
}

.rating-cart-row {
    height: 40px !important; /* Fixed height for rating/cart section */
    flex-shrink: 0 !important;
}

.product-info {
    min-height: 146px !important; /* Increased height to accommodate larger title section */
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    justify-content: flex-start !important;
    margin-bottom: 0 !important; /* No margin at bottom */
}

/* Brand Container - Fixed Height */
.product-brand-container {
    height: 20px !important; /* Fixed height for brand section */
    margin-bottom: 0 !important; /* No space below brand */
    padding: 0 15px !important; /* Add horizontal padding only */
}

.product-brand-placeholder {
    height: 20px !important; /* Reserve space when no brand */
}

/* Product Title Container - Fixed Height */
.product-title-container {
    min-height: 34px !important; /* Increased height to accommodate 2 lines properly */
    margin-bottom: 0 !important; /* No space between title and price */
    display: flex !important;
    align-items: flex-start !important;
    padding: 0 15px !important; /* Add horizontal padding only */
}

.product-title {
    min-height: 34px !important;
    display: flex !important;
    align-items: flex-start !important;
}

/* Price Container - Fixed Height */
.product-price-container {
    min-height: 40px !important; /* Minimum height for price section */
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    margin-bottom: 0 !important; /* No space below price */
    margin-top: 0 !important; /* No space above price */
    padding: 0 15px !important; /* Add horizontal padding only */
}

.old-price-placeholder {
    height: 16px !important; /* Reserve space when no old price */
    margin-bottom: 0 !important; /* No space below placeholder */
}

.price-row {
    height: 20px !important; /* Fixed height for price row */
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 0 !important; /* No space below price row */
}

.discount-percentage-placeholder {
    width: 40px !important; /* Reserve space when no discount */
    height: 20px !important;
    margin-bottom: 0 !important; /* No space below placeholder */
}

/* RTL Support - Exact opposite positioning */
html[dir="rtl"] .unified-product-card {
    direction: rtl;
}

/* RTL: Favorites on top left, Promo on top right */
html[dir="rtl"] .wishlist-button-top {
    right: auto;
    left: 10px;
}

html[dir="rtl"] .promo-tag {
    left: auto;
    right: 10px;
}

/* RTL: Reviews on right, Add to Cart on left */
html[dir="rtl"] .rating-cart-row {
    flex-direction: row-reverse;
}

html[dir="rtl"] .product-rating {
    flex-direction: row-reverse;
}

html[dir="rtl"] .star-rating {
    flex-direction: row-reverse;
}

/* RTL: Original price on right, Discount on left */
html[dir="rtl"] .price-row {
    flex-direction: row-reverse;
}

/* RTL text alignment */
html[dir="rtl"] .product-info {
    text-align: right;
}

/* Ensure proper spacing and prevent content overflow */
.unified-product-card {
    box-sizing: border-box;
}

.product-info > *:last-child {
    margin-bottom: 0 !important;
}

/* Ensure the card content stays within bounds */
.unified-product-card .product-image-container,
.unified-product-card .rating-cart-row,
.unified-product-card .product-info {
    box-sizing: border-box;
}

html[dir="rtl"] .product-title {
    text-align: right;
}

html[dir="rtl"] .product-brand {
    text-align: right;
}

/* RTL-specific spacing adjustments */
html[dir="rtl"] .product-brand {
    margin-right: 0;
    margin-left: 0;
}

html[dir="rtl"] .product-title {
    margin-right: 0;
    margin-left: 0;
}

html[dir="rtl"] .rating-cart-row {
    padding-right: 15px;
    padding-left: 15px;
}

html[dir="rtl"] .product-info {
    padding: 0 !important; /* No padding to eliminate spaces */
}

/* RTL arrow direction for view all links */
html[dir="rtl"] .czi-arrow-left {
    transform: scaleX(-1);
}

html[dir="rtl"] .czi-arrow-right {
    transform: scaleX(-1);
}

/* Additional positioning rules for price elements */
.price-row .new-price {
    order: 1; /* Original price comes first */
}

.price-row .discount-percentage {
    order: 2; /* Discount comes second */
}

/* RTL price positioning */
html[dir="rtl"] .price-row .new-price {
    order: 2; /* Original price comes second in RTL */
}

html[dir="rtl"] .price-row .discount-percentage {
    order: 1; /* Discount comes first in RTL */
}
