/* Unified Product Card Styles */
.product-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

/* Section Headers */
.products-section {
    margin: 3rem 0;
}

.products-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
}

.products-section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.products-section-subtitle {
    color: #666;
    font-size: 1rem;
    margin-top: 0.25rem;
}

/* Sort Dropdown */
.products-sort-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.products-sort-label {
    color: #666;
    font-size: 0.9rem;
}

.products-sort-select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

/* Product Card */
.product-card-wrapper {
    position: relative;
    height: 100%;
}

.product-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.product-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-color, #7FB069);
}

/* Product Image */
.product-card-image-container {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    background: #f8f8f8;
    overflow: hidden;
}

.product-card-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    height: 85%;
    object-fit: contain;
}

.product-card-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Discount Badge */
.product-card-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #ff4757;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1;
}

/* Product Info */
.product-card-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
    min-height: 2.8em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Stock Status */
.product-card-stock {
    margin: 0.25rem 0;
    font-size: 0.85rem;
}

.stock-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.stock-indicator.in-stock {
    color: #27ae60;
}

.stock-indicator.out-of-stock {
    color: #e74c3c;
}

/* Seller Info */
.product-card-seller {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
    font-size: 0.85rem;
    color: #666;
}

.seller-favicon {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.seller-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Price */
.product-card-price-container {
    margin-top: auto;
    padding-top: 0.5rem;
}

.product-card-price {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 0.75rem;
}

.price-currency {
    font-size: 1rem;
    color: #666;
}

.price-amount {
    color: var(--primary-color, #7FB069);
}

.product-card-price.view-price {
    color: var(--primary-color, #7FB069);
    font-size: 1rem;
    font-weight: 600;
}

/* Action Button */
.product-card-action {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color, #7FB069);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.product-card-action:hover {
    background: var(--primary-hover, #6A9456);
    transform: translateX(2px);
}

.product-card-action svg {
    transition: transform 0.2s ease;
}

.product-card-action:hover svg {
    transform: translateX(4px);
}

/* Grid View Toggle */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.view-toggle-btn {
    padding: 0.5rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    background: #f5f5f5;
}

.view-toggle-btn.active {
    background: var(--primary-color, #7FB069);
    border-color: var(--primary-color, #7FB069);
    color: white;
}

/* List View */
.product-cards-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-cards-list .product-card {
    flex-direction: row;
    height: auto;
    min-height: 140px;
}

.product-cards-list .product-card-image-container {
    width: 140px;
    min-width: 140px;
    padding-top: 140px;
}

.product-cards-list .product-card-info {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.product-cards-list .product-card-title {
    min-height: auto;
    flex: 1;
}

.product-cards-list .product-card-price-container {
    margin-top: 0;
    padding-top: 0;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-cards-list .product-card-action {
    width: auto;
    padding: 0.5rem 1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .product-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .products-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .products-sort-container {
        width: 100%;
    }
    
    .products-sort-select {
        flex: 1;
    }
    
    .product-card-title {
        font-size: 0.9rem;
    }
    
    .product-card-price {
        font-size: 1.1rem;
    }
    
    .product-card-action {
        font-size: 0.85rem;
        padding: 0.6rem;
    }
    
    /* Force grid view on mobile */
    .product-cards-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .product-cards-list .product-card {
        flex-direction: column;
    }
    
    .product-cards-list .product-card-image-container {
        width: 100%;
        padding-top: 100%;
    }
    
    .product-cards-list .product-card-info {
        flex-direction: column;
        padding: 0.75rem;
    }
    
    .product-cards-list .product-card-action {
        width: 100%;
    }
    
    .view-toggle {
        display: none;
    }
}

/* Loading State */
.product-card-skeleton {
    background: #f5f5f5;
    border-radius: 12px;
    overflow: hidden;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

.product-card-skeleton .product-card-image-container {
    background: #e0e0e0;
}

.product-card-skeleton .product-card-info {
    padding: 1rem;
}

.skeleton-text {
    height: 1em;
    background: #e0e0e0;
    border-radius: 4px;
    margin: 0.5rem 0;
}

.skeleton-text.title {
    width: 80%;
    height: 1.2em;
}

.skeleton-text.price {
    width: 40%;
    height: 1.5em;
}

.skeleton-button {
    height: 2.5rem;
    background: #e0e0e0;
    border-radius: 8px;
    margin-top: 0.5rem;
}