/* Page Transition Animations */
.page-content {
    opacity: 1;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
    transform: translateY(0);
}

.page-content.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

.page-content.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.page-content.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.loading-spinner.show {
    opacity: 1;
}

/* Loading overlay to cover entire page including footer */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.loading-overlay.show {
    opacity: 1;
    pointer-events: all;
}

/* Hide footer during page transitions */
.footer {
    transition: opacity 0.3s ease-in-out;
}

body.loading .footer {
    opacity: 0;
    pointer-events: none;
}

/* Ensure content sections don't show footer during transitions */
#index-content.hidden .footer,
#chapter-content.hidden .footer,
#category-content.hidden .footer {
    opacity: 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Content Loading States */
.content-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-title {
    height: 2em;
    margin-bottom: 1em;
    width: 70%;
}

.skeleton-paragraph {
    height: 0.8em;
    margin-bottom: 0.3em;
}

.skeleton-paragraph:nth-child(3n) {
    width: 80%;
}

.skeleton-paragraph:nth-child(4n) {
    width: 60%;
}

/* Smooth content reveal - Simple fade only */
.content-reveal {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.content-reveal.revealed {
    opacity: 1;
}

/* Sidebar specific animation - keep the slide for navigation */
.side-bar.content-reveal {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.side-bar.content-reveal.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* Ensure sidebar nav items don't have individual animations */
.sidebar-nav-items .nav-item {
    transition: none;
}

/* Staggered animations for lists */
.animate-list-item {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.animate-list-item.animate-in {
    opacity: 1;
    transform: translateX(0);
}

/* Add delay classes for staggered effects */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }

/* Page specific transitions */
.category-grid-item {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.category-grid-item.animate-in {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.featured-item {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.featured-item.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Navigation transition */
.navbar {
    transition: background-color 0.3s ease-in-out;
}

/* Progress bar for loading */
.loading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #007bff, #0056b3);
    transition: width 0.3s ease-out;
    z-index: 10000;
}

.loading-progress.show {
    width: 100%;
}

/* Fade transition for content sections */
#index-content,
#chapter-content,
#category-content {
    opacity: 1;
    transition: opacity 0.4s ease-in-out;
    width: 100%;
    position: relative;
    z-index: 1;
}

#index-content.hidden,
#chapter-content.hidden,
#category-content.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Ensure only one content section is visible at a time */
body {
    position: relative;
}

#index-content,
#chapter-content,
#category-content {
    display: none; /* Default hidden */
}

/* When a section is active, it should be visible */
#index-content:not(.hidden),
#chapter-content:not(.hidden),
#category-content:not(.hidden) {
    display: block;
}

/* Prevent content sections from stacking */
.content-section {
    position: relative;
    min-height: 100vh;
}

/* Add smooth transitions to main containers */
.page-header-wrapper,
.help-content-wrapper,
.help-featured-section,
.help-category-section {
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

/* Loading state for main content areas */
.content-loading {
    opacity: 0.3;
    pointer-events: none;
    transform: translateY(10px);
}

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

/* Error state animations */
.error-message {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.error-message.show {
    opacity: 1;
    transform: translateY(0);
} 