/* Product Grid Layout Fix */

/* Ensure the products container fills available space */
#products-container {
    flex: 1;
    align-self: flex-start;
}

/* Make each product card a flex container with equal heights */
.product-card-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 420px; /* Ensure consistent minimum height */
}

/* Image container should not flex-grow */
.product-card-container > a {
    flex-shrink: 0;
}

/* Title with fixed height */
.product-card-container h4 {
    flex-shrink: 0;
    height: 48px;
    line-height: 1.2;
}

/* Price section - remove nested p tags issue */
.product-card-container > p {
    flex-shrink: 0;
    min-height: 32px;
}

.product-card-container > p > p {
    margin: 0 !important;
}

/* Button area should push to bottom */
.product-card-container > a:last-child,
.product-card-container > p:last-child {
    margin-top: auto;
}

/* Ensure images are consistent */
.product-card-container img.product-thumb {
    width: 100%;
    height: 252px;
    object-fit: cover;
}

/* Loading indicator and load more button styling */
#loading-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    margin: 2rem auto;
    padding: 1rem;
}

#loading-indicator.show {
    display: flex;
}

.loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid #fff;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#load-more-container {
    text-align: center;
    margin: 2rem auto;
    padding: 1rem;
}

#load-more-btn {
    background-color: #988558;
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

#load-more-btn:hover {
    background-color: #d3aa4a;
}

#load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.infinite-scroll-message {
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
}

.infinite-scroll-error {
    color: #ff6b6b;
    text-align: center;
    padding: 1rem;
    margin: 1rem 0;
}
