/* Loading Screen */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0a0a0a 100%);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    text-align: center;
}

.loader-logo {
    width: 90px;
    height: 90px;
    margin: 0 auto 2rem;
    animation: logoFloat 3s ease-in-out infinite, logoPulse 2s ease-in-out infinite;
    position: relative;
}

.loader-logo::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(224, 47, 58, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.loader-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 25px rgba(224, 47, 58, 0.6));
    position: relative;
    z-index: 1;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
}

@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.loader-spinner {
    width: 55px;
    height: 55px;
    margin: 0 auto 1.5rem;
    position: relative;
}

.spinner-ring {
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 255, 255, 0.08);
    border-top-color: #9D0913;
    border-right-color: rgba(224, 47, 58, 0.6);
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    box-shadow: 0 0 15px rgba(224, 47, 58, 0.3);
}

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

.loader-text {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    font-weight: 500;
    margin-top: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

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

.loader-dots {
    display: inline-block;
    width: 20px;
}

.loader-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

/* Loading Bar */
.loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 4px;
    background: linear-gradient(90deg, #9D0913 0%, #ff4444 50%, #9D0913 100%);
    background-size: 200% 100%;
    z-index: 10000;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px rgba(224, 47, 58, 0.6), 0 2px 8px rgba(224, 47, 58, 0.4);
    animation: barShimmer 2s ease-in-out infinite;
}

@keyframes barShimmer {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.loading-bar.complete {
    width: 100%;
}

/* Smooth Page Transition */
body {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Only hide body if JavaScript is enabled and loader exists */
body:has(.page-loader) {
    opacity: 0;
}

body.loaded {
    opacity: 1 !important;
}

/* Skeleton Loading for Content */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

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

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

.skeleton-title {
    height: 2rem;
    margin-bottom: 1rem;
    width: 60%;
}

.skeleton-card {
    height: 200px;
    margin-bottom: 1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .loader-logo {
        width: 60px;
        height: 60px;
    }

    .loader-spinner {
        width: 40px;
        height: 40px;
    }

    .loader-text {
        font-size: 0.9rem;
    }
}
