/* =====================================================
   UNIFIED PRODUCT CARD STYLES
   A consistent product card system for the entire platform
   ===================================================== */

/* =====================================================
   1. BASE CARD STYLES
   ===================================================== */
.unified-product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.unified-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* =====================================================
   2. IMAGE CONTAINER
   ===================================================== */
.upc-image-container {
    position: relative;
    overflow: hidden;
    background: #f8f9fa;
}

.upc-image-container::before {
    content: "";
    display: block;
    padding-top: 100%; /* 1:1 Aspect Ratio */
}

.upc-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

.upc-image-link {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Placeholder Image */
.upc-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
    background: #e9ecef;
}

.upc-placeholder i {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

/* =====================================================
   3. BADGES SYSTEM
   ===================================================== */
.upc-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.upc-badge {
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.upc-badge-discount {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: #fff;
}

.upc-badge-new {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
}

.upc-badge-bestseller {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    color: #000;
}

.upc-badge-featured {
    background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%);
    color: #fff;
}

.upc-badge-out-of-stock {
    background: #6c757d;
    color: #fff;
}

/* Origin Badges */
.upc-badge-local {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: #fff;
}

.upc-badge-international {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: #fff;
}

/* Rank Badge (for bestsellers) */
.upc-rank-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    color: #000;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Media Count Badge */
.upc-media-count {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* =====================================================
   4. ACTION OVERLAY (Quick Actions)
   ===================================================== */
.upc-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.unified-product-card:hover .upc-overlay {
    opacity: 1;
}

.upc-overlay-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
}

.upc-overlay-btn:hover {
    background: var(--primary-color, #007bff);
    color: #fff;
    transform: scale(1.1);
}

/* Wishlist Button (top right corner) */
.upc-wishlist {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #dc3545;
    opacity: 0;
}

.unified-product-card:hover .upc-wishlist {
    opacity: 1;
}

.upc-wishlist:hover {
    background: #dc3545;
    color: #fff;
    transform: scale(1.1);
}

.upc-wishlist.active {
    opacity: 1;
    background: #dc3545;
    color: #fff;
}

.upc-wishlist.active i {
    font-weight: 900;
}

/* =====================================================
   5. CARD BODY
   ===================================================== */
.upc-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Title */
.upc-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upc-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.upc-title a:hover {
    color: var(--primary-color, #007bff);
}

/* Rating */
.upc-rating {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.upc-rating .stars {
    color: #ffc107;
    margin-right: 0.5rem;
}

.upc-rating .stars i {
    margin-right: 1px;
}

.upc-rating .count {
    color: #6c757d;
    font-size: 0.8rem;
}

/* Price */
.upc-price {
    margin-bottom: 0.5rem;
}

.upc-price-current {
    font-size: 1.1rem;
    font-weight: 700;
    color: #dc3545;
}

.upc-price-original {
    font-size: 0.85rem;
    color: #6c757d;
    text-decoration: line-through;
    margin-left: 0.5rem;
}

.upc-price-regular {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color, #007bff);
}

/* Seller Info */
.upc-seller {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.upc-seller i {
    margin-right: 5px;
}

/* Stock Status */
.upc-stock {
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.upc-stock-in {
    color: #28a745;
}

.upc-stock-out {
    color: #dc3545;
}

.upc-stock-low {
    color: #fd7e14;
}

/* =====================================================
   6. ACTION BUTTONS
   ===================================================== */
.upc-actions {
    margin-top: auto;
    display: flex;
    gap: 0.5rem;
}

.upc-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.upc-btn-primary {
    background: linear-gradient(135deg, var(--primary-color, #007bff) 0%, #0056b3 100%);
    color: #fff;
    flex: 1;
}

.upc-btn-primary:hover {
    background: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.upc-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.upc-btn-outline {
    background: transparent;
    border: 1px solid #dee2e6;
    color: #6c757d;
    padding: 0.5rem;
}

.upc-btn-outline:hover {
    border-color: var(--primary-color, #007bff);
    color: var(--primary-color, #007bff);
    background: rgba(0, 123, 255, 0.05);
}

/* =====================================================
   7. CARD VARIANTS
   ===================================================== */

/* COMPACT MODE */
.unified-product-card.upc-compact {
    flex-direction: row;
    height: auto;
}

.upc-compact .upc-image-container {
    width: 120px;
    flex-shrink: 0;
}

.upc-compact .upc-image-container::before {
    padding-top: 100%;
}

.upc-compact .upc-body {
    padding: 0.75rem;
}

.upc-compact .upc-title {
    font-size: 0.85rem;
    -webkit-line-clamp: 1;
}

.upc-compact .upc-rating {
    font-size: 0.75rem;
}

.upc-compact .upc-price-current,
.upc-compact .upc-price-regular {
    font-size: 0.95rem;
}

.upc-compact .upc-actions {
    flex-wrap: wrap;
}

.upc-compact .upc-btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.5rem;
}

/* MINIMAL MODE (just image, title, price) */
.unified-product-card.upc-minimal .upc-rating,
.unified-product-card.upc-minimal .upc-seller,
.unified-product-card.upc-minimal .upc-stock {
    display: none;
}

.upc-minimal .upc-body {
    padding: 0.75rem;
}

.upc-minimal .upc-title {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.upc-minimal .upc-actions {
    display: none;
}

/* FEATURED MODE (larger, more prominent) */
.unified-product-card.upc-featured {
    border: 2px solid transparent;
    background: linear-gradient(#fff, #fff) padding-box,
                linear-gradient(135deg, #6f42c1, #e83e8c) border-box;
}

.upc-featured .upc-badge-featured {
    display: inline-block;
}

/* HORIZONTAL MODE (for list view) */
.unified-product-card.upc-horizontal {
    flex-direction: row;
    max-height: 200px;
}

.upc-horizontal .upc-image-container {
    width: 200px;
    flex-shrink: 0;
}

.upc-horizontal .upc-image-container::before {
    padding-top: 100%;
}

.upc-horizontal .upc-body {
    overflow: hidden;
}

.upc-horizontal .upc-title {
    -webkit-line-clamp: 1;
}

/* =====================================================
   8. GALLERY DOTS (for multiple images)
   ===================================================== */
.upc-gallery-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 10;
}

.upc-gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s ease;
}

.upc-gallery-dot.active {
    background: #fff;
    transform: scale(1.2);
}

/* =====================================================
   9. RESPONSIVE ADJUSTMENTS
   ===================================================== */
@media (max-width: 768px) {
    .unified-product-card:hover {
        transform: none;
    }
    
    .upc-overlay {
        display: none;
    }
    
    .upc-wishlist {
        opacity: 1;
    }
    
    .upc-body {
        padding: 0.75rem;
    }
    
    .upc-title {
        font-size: 0.85rem;
    }
    
    .upc-price-current,
    .upc-price-regular {
        font-size: 1rem;
    }
    
    .upc-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }
    
    /* Compact mode stacks on mobile */
    .upc-compact {
        flex-direction: column;
    }
    
    .upc-compact .upc-image-container {
        width: 100%;
    }
    
    /* Horizontal mode stacks on mobile */
    .upc-horizontal {
        flex-direction: column;
        max-height: none;
    }
    
    .upc-horizontal .upc-image-container {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .upc-badges {
        top: 5px;
        left: 5px;
    }
    
    .upc-badge {
        font-size: 0.65rem;
        padding: 3px 6px;
    }
    
    .upc-rank-badge {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
}

/* =====================================================
   10. ANIMATIONS
   ===================================================== */
@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.upc-badge-new,
.upc-badge-discount {
    animation: pulse-badge 2s infinite;
}

/* Loading State */
.unified-product-card.loading {
    pointer-events: none;
}

.unified-product-card.loading .upc-image-container {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* =====================================================
   11. LEGACY COMPATIBILITY (gradual migration)
   ===================================================== */
/* Map old class names to new unified styles */
.product-card {
    /* Old cards can gradually adopt unified styles */
}
