/* ==========================================================================
   Product Card and Grid Styles
   ========================================================================== */

.product-grid {
    display: grid;
    grid-template-columns: repeat(var(--products-per-row-desktop, 5), 1fr);
    gap: 0.8rem;
    align-items: center;
}

@media (max-width: 767px) {
    .product-grid {
        grid-template-columns: repeat(var(--products-per-row-mobile, 2), 1fr);
        gap: 0.5rem;
    }
}

.product-card {
    position: relative;
    height: 450px;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    text-decoration: none;
    color: #333;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    z-index: 1;
}

.product-card::before {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
    background-size: 400%;
    border-radius: 17px;
    z-index: -1;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    animation: glowing 40s linear infinite;
}

.product-card:hover::before {
    opacity: 1;
}

@keyframes glowing {
    0% { background-position: 0 0; }
    50% { background-position: 400% 0; }
    100% { background-position: 0 0; }
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.12);
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.3s ease;
    z-index: 1;
}

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

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.78) 0%, rgba(0,0,0,0.18) 45%, rgba(0,0,0,0) 75%);
    opacity: 0.82;
    transition: opacity 0.3s ease, background 0.3s ease;
    z-index: 2;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-card:hover .product-overlay {
    opacity: 0.9;
    background: linear-gradient(to top, rgba(0,0,0,0.84) 0%, rgba(0,0,0,0.28) 48%, rgba(0,0,0,0) 80%);
}

.overlay-top {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 60px;
}

.overlay-middle {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    min-height: 80px;
}

.overlay-bottom {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 140px;
    gap: 0.5rem;
}

.product-name {
    font-weight: 800;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: #ffffff;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.8), 0 0 20px rgba(0,0,0,0.6);
    z-index: 3;
    text-align: center;
    min-height: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.price-block {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    z-index: 3;
    min-height: 2em;
}

.price-regular {
    font-size: 1.3em;
    color: #ff8787;
    text-decoration: line-through;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.8), 0 0 15px rgba(0,0,0,0.6);
    font-weight: 600;
}

.price-discount {
    font-size: 1.9em;
    font-weight: 800;
    color: #69db7c;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.9), 0 0 20px rgba(0,0,0,0.7);
}

.bulk-pricing {
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    z-index: 3;
    width: 100%;
    margin-bottom: 4px;
}

.bulk-price-item {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 0.75rem;
    color: #ffffff;
    background: rgba(10, 12, 16, 0.88);
    padding: 2px 7px;
    border-radius: 6px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 193, 7, 0.4);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: all 0.15s ease;
    cursor: default;
    font-weight: 600;
    white-space: nowrap;
}

.bulk-price-item:hover {
    background: rgba(20, 24, 30, 0.95);
    border-color: #ffc107;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(255, 193, 7, 0.35);
}

.bulk-price-item .bulk-label {
    color: #ffc107;
    font-weight: 800;
    font-size: 0.68rem;
    background: rgba(255, 193, 7, 0.15);
    padding: 1px 3px;
    border-radius: 3px;
}

.bulk-price-item .price {
    font-weight: 700;
    color: #4ade80;
    font-size: 0.75rem;
    margin-left: 2px;
}

@media (max-width: 767px) {
    .bulk-pricing {
        gap: 3px; 
        margin-bottom: 2px;
    }

    .bulk-price-item {
        padding: 1px 5px;
        font-size: 0.68rem;
        border-radius: 5px;
    }

    .bulk-price-item .bulk-label {
        font-size: 0.62rem;
        padding: 0 2px;
    }

    .bulk-price-item .price {
        font-size: 0.68rem;
    }
}

.quantity-showcase {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 3;
    width: 100%;
    min-height: 40px;
}

.quantity-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85em;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    background: rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 15px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.3);
    font-weight: 600;
    transition: all 0.2s ease;
}

.quantity-badge:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

.quantity-badge i {
    font-size: 1em;
}

.stock-critical {
    background: rgba(239, 68, 68, 0.8);
    border-color: rgba(239, 68, 68, 0.5);
}

.stock-low {
    background: rgba(245, 158, 11, 0.8);
    border-color: rgba(245, 158, 11, 0.5);
}

.stock-medium {
    background: rgba(59, 130, 246, 0.8);
    border-color: rgba(59, 130, 246, 0.5);
}

.stock-good {
    background: rgba(34, 197, 94, 0.8);
    border-color: rgba(34, 197, 94, 0.5);
}

.stock-excellent {
    background: rgba(16, 185, 129, 0.8);
    border-color: rgba(16, 185, 129, 0.5);
}

.product-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    text-decoration: none;
    color: inherit;
}

/* Product Card Actions Container */
.product-card-actions {
    position: absolute;
    top: 42%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    z-index: 10;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* On desktop with mouse hover: reveal smoothly only on card hover */
@media (min-width: 769px) and (hover: hover) {
    .product-card-actions {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translate(-50%, -35%) scale(0.92);
    }

    .product-card:hover .product-card-actions {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translate(-50%, -50%) scale(1);
    }
}

.quick-buy-btn {
    background: rgba(18, 18, 18, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(243, 156, 18, 0.85);
    color: #f39c12;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.5rem 0.95rem;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.65);
    white-space: nowrap;
}

.quick-buy-btn:hover {
    background: #f39c12;
    color: #121212;
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.55);
}

.quick-buy-btn:active {
    transform: scale(0.94);
}

.add-to-cart-btn {
    position: relative;
    top: auto;
    right: auto;
    background-color: #f39c12;
    color: #121212;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.add-to-cart-btn:hover {
    background-color: #e67e22;
    transform: scale(1.12);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.65);
}

.add-to-cart-btn:active {
    transform: scale(0.92);
}

.add-to-cart-btn.btn-added {
    background-color: #2ecc71 !important;
    color: white !important;
    transform: scale(1.1) !important;
    box-shadow: 0 6px 16px rgba(46, 204, 113, 0.6) !important;
}

.add-to-cart-btn.btn-loading {
    background-color: #d35400 !important;
    color: white !important;
}

@media (max-width: 576px) {
    .product-card-actions {
        top: 45%;
        gap: 0.35rem;
    }
    .quick-buy-btn {
        font-size: 0.75rem;
        padding: 0.4rem 0.7rem;
    }
    .add-to-cart-btn {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }
}
