/* index-products.css - EXACT clone of products.css styles for Homepage */

.products-section {
    margin-top: 25px;
    padding: 0 5px;
    contain: layout style;
    /* Isolate layout from wrapper */
    min-height: 950px;
    /* Header (~40px) + Grid (~915px) on mobile */
}

@media (min-width: 768px) {
    .products-section {
        min-height: 650px;
        /* Header + 2 rows on Desktop */
    }
}

/* Product Grid - Premium Row Flow */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* Default mobile: 2 items */
    gap: 15px;
    margin-bottom: 20px;
    min-height: 600px;
    /* 3 rows * 245px on mobile */
    contain: layout;
    /* Isolate layout to prevent reflows affecting footer */
}

@media (min-width: 768px) {
    .product-grid {
        min-height: 590px;
        /* 2 rows * 295px on tablet/desktop */
    }
}

/* Product Card */
.product-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: 295px;
    /* Precision Match: Aligned with product-card-skeleton on Desktop */
}

@media (max-width: 480px) {
    .product-card {
        max-height: 295px;
        /* Precision Match: Aligned with product-card-skeleton on Mobile */
    }
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 166, 81, 0.1), transparent);
    transition: left 0.5s ease;
}

.product-card:hover::before {
    left: 100%;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 166, 81, 0.3);
}

.product-image-wrapper {
    position: relative;
    width: 110px;
    height: 110px;
    margin: 0 auto 12px;
}

.product-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #00A651;
    box-shadow: 0 6px 20px rgba(0, 166, 81, 0.2);
    transition: transform 0.3s ease;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.product-image-secondary {
    width: 75%;
    height: 75%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #00A651;
    box-shadow: 0 3px 10px rgba(0, 166, 81, 0.3);
    transition: transform 0.3s ease;
    position: absolute;
    top: 23%;
    left: -37%;
    rotate: -40deg;
    /* z-index: 2; */
    transform: scale(1);
}

.product-card:hover .product-image {
    transform: scale(1.1) rotate(5deg);
}

.nursery-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0px 0 -2px 0;
    padding: 6px 0px;
    background: linear-gradient(135deg, rgba(0, 166, 81, 0.08), rgba(0, 212, 106, 0.08));
    border-radius: 20px;
    border: 1px solid rgba(0, 166, 81, 0.15);
}

.nursery-logo-img {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #00A651;
}

.nursery-name {
    font-size: 9px;
    font-weight: 600;
    color: #007a3b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.nursery-business-type {
    /* position: absolute; */
    /* left: 111px; */
    /* top: 127px; */
    font-size: 7px;
    font-weight: 600;
    color: black;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: rgba(139, 69, 19, 0.2);
    padding: 2px 6px;
    border-radius: 10px;
    display: inline-block;
    margin-top: 2px;
}

.category-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #008f45, #00a651);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 10px rgba(0, 166, 81, 0.3);
}

/* Badges Container - Right Aligned */
.product-badges-container {
    position: absolute;
    top: 195px;
    right: 0px;
    /* Hang slightly off right edge */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    z-index: 6;
}

.promo-badge {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
    font-size: 6px;
    font-weight: 700;
    padding: 1px 3px;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    text-transform: uppercase;
    box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.1);
}

.badge-bestseller {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: #000;
}

.badge-trending {
    background: linear-gradient(135deg, #FF5252, #D32F2F);
}

.availability-badge {
    position: absolute;
    top: 100px;
    right: 5px;
    padding: 5px 5px;
    border-radius: 50px;
    font-size: 7px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    z-index: 0;
}

.availability-badge.in-stock {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    box-shadow: 0 0 15px rgba(40, 167, 69, 0.4);
}

.availability-badge.low-stock {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: #212529;
    box-shadow: 0 0 15px rgba(253, 126, 20, 0.4);
}

.availability-badge.out-of-stock {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    box-shadow: 0 0 15px rgba(220, 53, 69, 0.4);
}

@keyframes badgeGlow {
    0% {
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    }

    100% {
        box-shadow: 0 0 15px currentColor, 0 0 20px currentColor;
    }
}

.product-top-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 5;
}

.wishlist-btn {
    position: relative;
    top: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 15px rgba(0, 0, 0, 0.1);
}

.wishlist-btn i {
    color: #94a3b8;
    /* Professional slate default */
    font-size: 16px;
    transition: all 0.3s ease;
}

.wishlist-btn:hover {
    transform: scale(1.1);
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.wishlist-btn:hover i {
    color: #00A651;
    /* Match brand color on hover */
}

.compare-btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 15px rgba(0, 0, 0, 0.1);
}

.compare-btn-icon i {
    color: #007a3b;
    font-size: 14px;
}

.compare-btn-icon:hover {
    background: #f34141;
    transform: scale(1.1);
}

.compare-btn-icon:hover i {
    color: white;
}

.wishlist-btn.active i {
    color: #ef4444;
    /* Brighter, more modern red */
    animation: heartPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heartPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1);
    }
}

.product-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: left;
}

.product-price {
    font-size: 18px;
    font-weight: 700;
    color: #007a3b;
    margin-bottom: 8px;
}

/* Sold Badge Positioning & Styling */
.product-pricing {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Left align to match title */
    gap: 4px;
    margin-bottom: -10px;
}

.product-price {
    font-size: 19px;
    font-weight: 800;
    color: #007a3b;
    margin-bottom: 0;
    letter-spacing: -0.5px;
}

.sold-badge {
    display: flex;
    position: absolute;
    top: 110px;
    left: 10px;
    align-items: center;
    gap: 3px;
}

.sold-badge i {
    font-size: 10px;
    color: #666;
}

.sold-badge span {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
}

html.dark-mode .sold-badge {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark-mode .sold-badge span {
    color: #cbd5e1;
}

.rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin-bottom: 12px;
}

.rating i {
    color: #FFC107;
    font-size: 13px;
}

.quick-add-btn {
    position: absolute;
    bottom: 9px;
    right: 9px;
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid rgba(0, 166, 81, 0.2);
    border-radius: 50%;
    color: #00A651;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 10;
}

.quick-add-btn:hover {
    background: #00A651;
    color: white;
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 8px 20px rgba(0, 166, 81, 0.3);
    border-color: #00A651;
}

.quick-add-btn.success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #00A651;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-state p {
    color: #666;
    font-size: 16px;
    font-weight: 500;
}

/* No Results State */
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.no-results i {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 20px;
}

.no-results h3 {
    font-size: 20px;
    color: #666;
    margin-bottom: 10px;
}

.no-results p {
    font-size: 14px;
    color: #999;
}

/* Responsive Row Flow */
@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        min-height: 600px;
        /* 2 rows on tablet */
    }
}

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        /* 4 products per row on PC */
        gap: 25px;
        min-height: 600px;
        /* 2 rows on desktop */
    }
}

@media (min-width: 1440px) {
    .product-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 30px;
        min-height: 600px;
    }
}

@media (max-width: 480px) {
    .product-image-wrapper {
        margin-top: 9px;
        width: 90px;
        height: 90px;
    }

    .product-name {
        font-size: 15px;
        min-height: 36px;
    }

    .product-price {
        font-size: 18px !important;
    }

    .view-details-btn {
        font-size: 9px;
        padding: 0px 0px;
    }

    .quick-add-btn {
        width: 40px;
        height: 40px;
    }

    .nursery-business-type {
        position: absolute;
        left: 111px;
        top: 127px;
        font-size: 7px;
        font-weight: 600;
        color: #000000;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        background: transparent;
        /* padding: 2px 6px; */
        border-radius: 10px;
        display: inline-block;
        margin-top: 2px;
    }

    .discount-percentage-badge {
        /* position: absolute !important; Removed to allow flow alignment */
        /* left: 12px !important; */
        background: linear-gradient(135deg, #ff3366 0%, #ff6b9d 100%);
        color: white;
        font-size: 0.75rem;
        font-weight: 700;
        padding: 3px 8px;
        border-radius: 20px;
        display: inline-flex;
        align-items: center;
        gap: 3px;
        box-shadow: 0 2px 8px rgba(255, 51, 102, 0.3);
        align-self: flex-start;
        /* Ensure it stays left */
        margin-left: 0;
    }
}

/* Dark Mode Overrides */
body.dark-mode .product-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .product-name {
    color: #f1f5f9;
}

body.dark-mode .wishlist-btn {
    background: rgba(15, 23, 42, 0.8);
}