/* Home Page API Integration Styles */

/* Loading States */
#products-loading,
#categories-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    min-height: 300px;
}

#products-loading > div,
#categories-loading > div {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Loading Spinner Animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Fade-in animation for dynamically loaded content */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* API Status Indicator */
.api-status-badge {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.api-status-badge.loading {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.api-status-badge.success {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #0f4c5c;
}

.api-status-badge.error {
    background: linear-gradient(135deg, #fc4a1a 0%, #f7b733 100%);
    color: white;
}

.api-status-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Enhanced product and category cards for dynamic content */
#products-grid .card,
#categories-grid .collection-card {
    opacity: 1; /* Show by default for fallback content */
    transform: translateY(0);
}

#products-grid .card.loaded,
#categories-grid .collection-card.loaded {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Stagger animation for multiple items */
#products-grid .card:nth-child(1) { animation-delay: 0.1s; }
#products-grid .card:nth-child(2) { animation-delay: 0.2s; }
#products-grid .card:nth-child(3) { animation-delay: 0.3s; }
#products-grid .card:nth-child(4) { animation-delay: 0.4s; }
#products-grid .card:nth-child(5) { animation-delay: 0.5s; }
#products-grid .card:nth-child(6) { animation-delay: 0.6s; }
#products-grid .card:nth-child(7) { animation-delay: 0.7s; }
#products-grid .card:nth-child(8) { animation-delay: 0.8s; }

#categories-grid .collection-card:nth-child(1) { animation-delay: 0.1s; }
#categories-grid .collection-card:nth-child(2) { animation-delay: 0.2s; }
#categories-grid .collection-card:nth-child(3) { animation-delay: 0.3s; }
#categories-grid .collection-card:nth-child(4) { animation-delay: 0.4s; }
#categories-grid .collection-card:nth-child(5) { animation-delay: 0.5s; }
#categories-grid .collection-card:nth-child(6) { animation-delay: 0.6s; }

/* Empty state for when no products/categories are available */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 1rem;
    opacity: 0.7;
}

.dark #products-loading,
.dark #categories-loading {
    color: #d1d5db;
}

.dark .empty-state {
    color: #9ca3af;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .api-status-badge {
        bottom: 10px;
        left: 10px;
        font-size: 11px;
        padding: 6px 12px;
    }

    #products-loading,
    #categories-loading {
        padding: 40px 20px;
        min-height: 200px;
    }
}

/* ===================================
   SLIDER STYLES
   =================================== */

.slider-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0 auto;
    padding: 0 1rem;
}

.slider-track-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.slider-track {
    display: flex !important;
    gap: 1.5rem;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* Products Grid - Show 4 cards */
.best-sellers-grid.slider-track {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
}

.best-sellers-grid.slider-track > * {
    flex: 0 0 calc(25% - 1.125rem);
    min-width: 280px;
}

/* Categories Grid - Show 3 cards */
.collections-grid.slider-track {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) !important;
}

.collections-grid.slider-track > * {
    flex: 0 0 calc(33.333% - 1rem);
    min-width: 300px;
}

/* Slider Navigation Buttons */
.slider-btn {
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.9), rgba(124, 58, 237, 0.9));
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    flex-shrink: 0;
}

.slider-btn:hover {
    background: linear-gradient(135deg, rgba(124, 58, 237, 1), rgba(109, 40, 217, 1));
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.slider-btn:active {
    transform: scale(0.95);
}

.slider-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.5), rgba(124, 58, 237, 0.5));
}

.slider-btn:disabled:hover {
    transform: scale(1);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.slider-btn svg {
    width: 24px;
    height: 24px;
}

/* Hide description in product cards when in slider */
.slider-track .card__description {
    display: none;
}

/* Make product cards equal height in slider */
.slider-track .card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.slider-track .card__content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.slider-track .card__text {
    flex: 0 0 auto;
}

.slider-track .card__footer {
    margin-top: auto;
}

/* Responsive Slider Adjustments */
@media (max-width: 1536px) {
    .best-sellers-grid.slider-track > * {
        flex: 0 0 calc(33.333% - 1rem);
    }
}

@media (max-width: 1280px) {
    .best-sellers-grid.slider-track > * {
        flex: 0 0 calc(50% - 0.75rem);
        min-width: 260px;
    }

    .collections-grid.slider-track > * {
        flex: 0 0 calc(50% - 0.75rem);
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .slider-container {
        padding: 0 0.5rem;
        gap: 0.5rem;
    }

    .best-sellers-grid.slider-track > *,
    .collections-grid.slider-track > * {
        flex: 0 0 100%;
        min-width: 100%;
    }

    .slider-btn {
        width: 40px;
        height: 40px;
    }

    .slider-btn svg {
        width: 20px;
        height: 20px;
    }

    .slider-track {
        gap: 1rem;
    }
}

@media (max-width: 640px) {
    .slider-btn {
        width: 36px;
        height: 36px;
    }

    .slider-btn svg {
        width: 18px;
        height: 18px;
    }
}
