/**
 * Blog Over Theme - Loading Screen
 * 
 * Beautiful loading animation that appears while theme loads
 * Customizable via WordPress Customizer (Appearance → Customize → Theme Design → Loading Screen)
 * 
 * @package Blog_Over
 */

/* CSS Variables for Customization */
:root {
    --blog-over-loader-color: #ffffff;
    --blog-over-loader-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Loading Screen Overlay */
.blog-over-loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--blog-over-loader-bg, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.blog-over-loading-screen.loaded {
    opacity: 0;
    visibility: hidden;
}

/* Dark Mode Loading Screen */
html.blog-over-dark-mode .blog-over-loading-screen,
body.blog-over-dark-mode .blog-over-loading-screen {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

/* Loading Content Container */
.blog-over-loader-content {
    text-align: center;
    perspective: 800px;
}

/* Spinner Container */
.blog-over-loader-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

/* Spinner Rings */
.blog-over-spinner-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: #fff;
    border-radius: 50%;
    animation: blog-over-spin 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.blog-over-spinner-ring:nth-child(2) {
    width: 90%;
    height: 90%;
    top: 5%;
    left: 5%;
    border-top-color: rgba(255, 255, 255, 0.7);
    animation-delay: -0.15s;
}

.blog-over-spinner-ring:nth-child(3) {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-top-color: rgba(255, 255, 255, 0.5);
    animation-delay: -0.3s;
}

/* Spinner Animation */
@keyframes blog-over-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Loading Text */
.blog-over-loader-text {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.9;
    animation: blog-over-pulse 2s ease-in-out infinite;
}

/* Pulse Animation for Text */
@keyframes blog-over-pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Loading Dots Animation */
.blog-over-loader-text::after {
    content: '';
    animation: blog-over-dots 1.5s steps(4, end) infinite;
}

@keyframes blog-over-dots {

    0%,
    20% {
        content: '';
    }

    40% {
        content: '.';
    }

    60% {
        content: '..';
    }

    80%,
    100% {
        content: '...';
    }
}

/* Logo/Brand in Loader (Optional) */
.blog-over-loader-brand {
    margin-bottom: 30px;
}

.blog-over-loader-brand h1 {
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    margin: 0;
    letter-spacing: 1px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Progress Bar (Optional enhancement) */
.blog-over-loader-progress {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 20px auto 0;
    overflow: hidden;
}

.blog-over-loader-progress-bar {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    animation: blog-over-progress 2s ease-in-out infinite;
}

@keyframes blog-over-progress {
    0% {
        width: 0%;
        transform: translateX(0);
    }

    50% {
        width: 100%;
        transform: translateX(0);
    }

    100% {
        width: 100%;
        transform: translateX(200px);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .blog-over-spinner-ring {
        animation: blog-over-spin 3s linear infinite;
    }

    .blog-over-loader-text {
        animation: none;
        opacity: 0.9;
    }

    .blog-over-loader-progress-bar {
        animation: none;
        width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════
   LOADER DESIGN 2: BOUNCING DOTS
   ══════════════════════════════════════════════════════ */

.blog-over-loader-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.blog-over-loader-dots span {
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    animation: blog-over-bounce 1.4s ease-in-out infinite;
}

.blog-over-loader-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.blog-over-loader-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes blog-over-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════
   LOADER DESIGN 3: PULSE CIRCLE
   ══════════════════════════════════════════════════════ */

.blog-over-loader-pulse {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    position: relative;
}

.blog-over-loader-pulse span {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 4px solid #fff;
    border-radius: 50%;
    animation: blog-over-pulse-ring 1.5s ease-out infinite;
}

.blog-over-loader-pulse span:nth-child(2) {
    animation-delay: -0.5s;
}

.blog-over-loader-pulse span:nth-child(3) {
    animation-delay: -1s;
}

@keyframes blog-over-pulse-ring {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ═══════════════════════════════════════════════════════
   LOADER DESIGN 4: SINGLE RING
   ══════════════════════════════════════════════════════ */

.blog-over-loader-ring {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: blog-over-spin 1s linear infinite;
}

/* ═══════════════════════════════════════════════════════
   LOADER DESIGN 5: ANIMATED BARS
   ══════════════════════════════════════════════════════ */

.blog-over-loader-bars {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
}

.blog-over-loader-bars span {
    width: 6px;
    height: 100%;
    background: #fff;
    border-radius: 3px;
    animation: blog-over-bars 1.2s ease-in-out infinite;
}

.blog-over-loader-bars span:nth-child(1) {
    animation-delay: -0.4s;
}

.blog-over-loader-bars span:nth-child(2) {
    animation-delay: -0.3s;
}

.blog-over-loader-bars span:nth-child(3) {
    animation-delay: -0.2s;
}

.blog-over-loader-bars span:nth-child(4) {
    animation-delay: -0.1s;
}

.blog-over-loader-bars span:nth-child(5) {
    animation-delay: 0s;
}

@keyframes blog-over-bars {

    0%,
    40%,
    100% {
        transform: scaleY(0.4);
        opacity: 0.6;
    }

    20% {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════
   LOADER DESIGN 6: 3D ROTATING CUBE
   ══════════════════════════════════════════════════════ */

.blog-over-loader-cube {
    width: 60px;
    height: 60px;
    margin: 30px auto;
    position: relative;
    transform-style: preserve-3d;
    perspective: 1000px;
    animation: blog-over-cube-rotate 2s linear infinite;
}

.blog-over-loader-cube span {
    position: absolute;
    width: 100%;
    height: 100%;
    margin-left: -50%;
    margin-top: -50%;
    left: 50%;
    top: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.blog-over-loader-cube span:nth-child(1) {
    transform: rotateY(0deg) translateZ(30px);
}

.blog-over-loader-cube span:nth-child(2) {
    transform: rotateY(90deg) translateZ(30px);
}

.blog-over-loader-cube span:nth-child(3) {
    transform: rotateY(180deg) translateZ(30px);
}

.blog-over-loader-cube span:nth-child(4) {
    transform: rotateY(-90deg) translateZ(30px);
}

.blog-over-loader-cube span:nth-child(5) {
    transform: rotateX(90deg) translateZ(30px);
}

.blog-over-loader-cube span:nth-child(6) {
    transform: rotateX(-90deg) translateZ(30px);
}

@keyframes blog-over-cube-rotate {
    0% {
        transform: rotateX(0deg) rotateY(0deg);
    }

    100% {
        transform: rotateX(360deg) rotateY(360deg);
    }
}

/* Hide inactive loaders */
.blog-over-loading-screen:not([data-loader="spinner"]) .blog-over-loader-spinner,
.blog-over-loading-screen:not([data-loader="dots"]) .blog-over-loader-dots,
.blog-over-loading-screen:not([data-loader="pulse"]) .blog-over-loader-pulse,
.blog-over-loading-screen:not([data-loader="ring"]) .blog-over-loader-ring,
.blog-over-loading-screen:not([data-loader="bars"]) .blog-over-loader-bars,
.blog-over-loading-screen:not([data-loader="cube"]) .blog-over-loader-cube {
    display: none;
}

/* ═══════════════════════════════════════════════════════
   LOADER SIZE VARIANTS (Customizer: Small/Medium/Large)
   ══════════════════════════════════════════════════════ */

/* Small Size */
.blog-over-loader-small .blog-over-loader-spinner,
.blog-over-loader-small .blog-over-loader-dots,
.blog-over-loader-small .blog-over-loader-pulse,
.blog-over-loader-small .blog-over-loader-ring,
.blog-over-loader-small .blog-over-loader-bars,
.blog-over-loader-small .blog-over-loader-cube {
    transform: scale(0.6);
}

.blog-over-loader-small .blog-over-loader-text {
    font-size: 12px;
}

.blog-over-loader-small .blog-over-loader-progress {
    width: 120px;
}

/* Medium Size (Default) */
.blog-over-loader-medium .blog-over-loader-spinner,
.blog-over-loader-medium .blog-over-loader-dots,
.blog-over-loader-medium .blog-over-loader-pulse,
.blog-over-loader-medium .blog-over-loader-ring,
.blog-over-loader-medium .blog-over-loader-bars,
.blog-over-loader-medium .blog-over-loader-cube {
    transform: scale(1);
}

/* Large Size */
.blog-over-loader-large .blog-over-loader-spinner,
.blog-over-loader-large .blog-over-loader-dots,
.blog-over-loader-large .blog-over-loader-pulse,
.blog-over-loader-large .blog-over-loader-ring,
.blog-over-loader-large .blog-over-loader-bars,
.blog-over-loader-large .blog-over-loader-cube {
    transform: scale(1.4);
}

.blog-over-loader-large .blog-over-loader-text {
    font-size: 20px;
}

.blog-over-loader-large .blog-over-loader-progress {
    width: 280px;
}

/* ═══════════════════════════════════════════════════════
   LOADER COLOR CUSTOMIZATION (Via CSS Variables)
   ══════════════════════════════════════════════════════ */

/* Apply custom loader color from Customizer */
.blog-over-loading-screen .blog-over-spinner-ring {
    border-top-color: var(--blog-over-loader-color, #fff);
}

.blog-over-loading-screen .blog-over-spinner-ring:nth-child(2) {
    border-top-color: color-mix(in srgb, var(--blog-over-loader-color, #fff) 70%, transparent);
}

.blog-over-loading-screen .blog-over-spinner-ring:nth-child(3) {
    border-top-color: color-mix(in srgb, var(--blog-over-loader-color, #fff) 50%, transparent);
}

.blog-over-loading-screen .blog-over-loader-dots span,
.blog-over-loading-screen .blog-over-loader-bars span {
    background: var(--blog-over-loader-color, #fff);
}

.blog-over-loading-screen .blog-over-loader-pulse span {
    border-color: var(--blog-over-loader-color, #fff);
}

.blog-over-loading-screen .blog-over-loader-ring {
    border-color: color-mix(in srgb, var(--blog-over-loader-color, #fff) 20%, transparent);
    border-top-color: var(--blog-over-loader-color, #fff);
}

.blog-over-loading-screen .blog-over-loader-cube span {
    background: color-mix(in srgb, var(--blog-over-loader-color, #fff) 90%, transparent);
    border-color: var(--blog-over-loader-color, #fff);
    box-shadow: 0 0 20px color-mix(in srgb, var(--blog-over-loader-color, #fff) 30%, transparent);
}

.blog-over-loading-screen .blog-over-loader-text,
.blog-over-loading-screen .blog-over-loader-progress-bar {
    color: var(--blog-over-loader-color, #fff);
    background: var(--blog-over-loader-color, #fff);
}

.blog-over-loading-screen .blog-over-loader-text {
    background: transparent;
}