/* Modern Product Grid Configuration */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.1rem;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
        padding: 1.5rem;
    }
}

@media (min-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2rem;
    }
}

/* Premium Product Card */
.product-card {
    background: #ffffff;
    border-radius: 0.35rem;
    border: 1px solid #f1f5f9;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: auto;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

@media (min-width: 768px) {
    .product-card {
        border-radius: 1.5rem;
    }

    .product-card:hover {
        transform: translateY(-0.5rem);
        box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
        border-color: #2563eb33;
    }
}

/* Image Presentation */
.product-img-wrapper {
    position: relative;
    height: auto;
    aspect-ratio: 1 / 1;
    background: #f8f9fa;
    overflow: hidden;
    padding: 0;
    margin: 0;
    display: block;
}

/* Restore aspect-ratio on desktop */
@media (min-width: 768px) {
    .product-img-wrapper {
        height: auto;
        aspect-ratio: 4 / 3;
    }
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    transition: all 0.5s ease;
    display: block;
    background: #f8f9fa;
}

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

/* Badges */
.product-badges {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.badge {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    border-radius: 0.6rem;
    font-size: 0.7rem;
    font-weight: 800;
    color: white;
    box-shadow: var(--shadow);
    backdrop-filter: blur(4px);
}

.badge-secondhand {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge-new {
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge-discount {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@media (min-width: 768px) {
    .badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}

/* Favorite Button */
.fav-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    width: 2rem;
    height: 2rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
}

@media (min-width: 768px) {
    .fav-btn {
        width: 2.5rem;
        height: 2.5rem;
        top: 1rem;
        right: 1rem;
    }
}

.fav-btn.active {
    color: #ef4444;
}

/* Product Content */
.product-info {
    padding: 0.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    text-align: center;
    /* Center content including name */
}

@media (min-width: 768px) {
    .product-info {
        padding: 1.25rem;
        gap: 0.75rem;
    }
}

.product-name {
    font-size: 9px !important;
    font-weight: 500;
    line-height: 1.1;
    color: #334155;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    /* Increased line clamp for full name visibility */
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 3.3em;
    /* Adjusted height for 3 lines */
    margin-bottom: 2px;
}

@media (min-width: 768px) {
    .product-name {
        font-size: 1rem;
        font-weight: 700;
    }
}

.product-price-wrapper {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.old-price {
    font-size: 0.75rem;
    color: #94a3b8;
    text-decoration: line-through;
}

.current-price {
    font-size: 11px !important;
    /* Center and resize price */
    font-weight: 900;
    color: #2563eb;
    letter-spacing: -0.01em;
    display: block;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .current-price {
        font-size: 1.5rem;
    }
}

/* Add to Cart Area */
.product-actions {
    padding: 0 0.2rem 0.25rem 0.2rem;
}

@media (min-width: 768px) {
    .product-actions {
        padding: 0 1.25rem 1.25rem 1.25rem;
    }
}

.btn-add-cart {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    background: #0f172a;
    color: #ffffff;
    padding: 0.35rem;
    border-radius: 0.3rem;
    font-weight: 700;
    font-size: 0.6rem;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

@media (min-width: 768px) {
    .btn-add-cart {
        padding: 0.875rem;
        font-size: 0.875rem;
        border-radius: 1rem;
    }

    .btn-add-cart:hover {
        background: #2563eb;
    }
}

.btn-out-of-stock {
    width: 100%;
    background: #f1f5f9;
    color: #94a3b8;
    padding: 0.65rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 0.8rem;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}