/**
 * PureStora Infinite Scroll Styles
 * Loading indicators, animations, and back-to-top button
 */

/* ==========================================
   LOADING INDICATOR
   ========================================== */
.infinite-scroll-loader {
    display: none;
    width: 100%;
    padding: 40px 20px;
    text-align: center;
    background: transparent;
}

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

/* Spinner Animation */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(150, 102, 51, 0.1); /* Light brown */
    border-top-color: #996633; /* Brand brown */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Loading Text */
.loading-text {
    margin: 0;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Error Container */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.error-text {
    margin: 0;
    font-size: 14px;
    color: #dc3545;
    font-weight: 500;
}

.error-container .btn {
    margin-top: 8px;
}

/* ==========================================
   BACK TO TOP BUTTON
   ========================================== */
.back-to-top-btn {
    position: fixed !important;
    bottom: 30px !important;
    left: 30px !important;  /* Changed from right to left */
    right: auto !important;  /* Override any right positioning */
    width: 50px;
    height: 50px;
    background: #996633; /* Brand brown */
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 999; /* Below modals (1050) but above content */
}

.back-to-top-btn:hover {
    background: #7a5228; /* Darker brown */
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.back-to-top-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.back-to-top-btn i {
    pointer-events: none;
}

/* ==========================================
   MOBILE RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    .back-to-top-btn {
        /* Position to avoid mobile bottom navigation (typically 60-70px tall) */
        bottom: 80px !important;  /* Above bottom nav */
        left: 15px !important;    /* Left side on mobile - doesn't conflict with filter button */
        right: auto !important;   /* Override any right positioning */
        width: 45px;
        height: 45px;
        font-size: 18px;
    }

    .spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }

    .loading-text {
        font-size: 13px;
    }

    .infinite-scroll-loader {
        padding: 30px 15px;
    }
}

/* ==========================================
   SMOOTH SCROLL BEHAVIOR
   ========================================== */
html {
    scroll-behavior: smooth;
}

/* Disable smooth scroll when user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .spinner {
        animation: none;
        border-top-color: #996633;
        border-right-color: #996633;
    }

    .back-to-top-btn {
        transition: none;
    }
}

/* ==========================================
   SENTINEL ELEMENT (INVISIBLE)
   ========================================== */
#infinite-scroll-sentinel {
    height: 1px;
    width: 100%;
    visibility: hidden;
    pointer-events: none;
}

/* ==========================================
   LOADING STATE STYLES
   ========================================== */
.infinite-scroll-loading .feature-item-card {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   END OF RESULTS MESSAGE
   ========================================== */
.infinite-scroll-end {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-size: 14px;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

.infinite-scroll-end::before {
    content: "•";
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
    color: #996633;
}
