/**
 * Infinite Posts - Styles
 *
 * Progress bar, loading indicator, and animations.
 */

/* Ensure loaded post wrappers stack vertically */
.infinite-post-wrapper,
[data-post-id] {
    max-width: 100%;
    width: 100%;
    display: block;
    float: none;
    clear: both;
    margin-top: 3rem;
    margin-bottom: 0;
}

/* Progress Bar */
.infinite-posts-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    width: 0%;
    background: linear-gradient(90deg, #a89777 0%, #c9b896 100%);
    transition: width 0.3s ease-out;
    z-index: 99999;
    pointer-events: none;
}

/* Loading Indicator */
.infinite-posts-loader {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: none;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    color: #333;
    align-items: center;
    gap: 12px;
}

.infinite-posts-loader.is-active {
    display: flex;
}

@media (prefers-color-scheme: dark) {
    .infinite-posts-loader {
        background: rgba(30, 30, 30, 0.95);
        color: #fff;
    }
}

/* Loader Spinner */
.loader-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(168, 151, 119, 0.3);
    border-top-color: #a89777;
    border-radius: 50%;
    animation: infinite-posts-spin 0.8s linear infinite;
}

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

/* Sentinel (hidden element for scroll detection) */
.infinite-posts-sentinel {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    opacity: 0;
}

/* Loaded Post Animation */
.infinite-post-loaded {
    animation: infinite-posts-fade-in 0.6s ease-out;
}

@keyframes infinite-posts-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth scroll behavior for entire page */
html {
    scroll-behavior: smooth;
}

/* Support for posts loaded dynamically */
[data-post-id] {
    position: relative;
}

/* Loading state for dynamic content */
.infinite-posts-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Progress bar customization via filters */
.infinite-posts-progress-bar {
    /* Can be customized with: */
    /* add_filter('infinite_posts_progress_bar_color', function() { return '#ff0000'; }); */
}

/* Dark mode support for progress bar */
@media (prefers-color-scheme: dark) {
    .infinite-posts-progress-bar {
        background: linear-gradient(90deg, #c9b896 0%, #e0d9c8 100%);
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .infinite-posts-loader {
        bottom: 20px;
        padding: 12px 20px;
        font-size: 13px;
    }

    .infinite-posts-progress-bar {
        height: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .infinite-post-loaded {
        animation: none;
    }

    html {
        scroll-behavior: auto;
    }

    .loader-spinner {
        animation-duration: 2s;
    }
}
