/* New Loading Screen Styles */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    font-family: 'Poppins', sans-serif;
    color: #e0e0e0;
    transition: all 0.3s ease;
}

/* Light Theme Loading Screen */
body.light-theme #loading-screen {
    background: #f8f9fa;
    color: #333;
}

.boot-logo-container {
    position: relative;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    animation: pulseGlow 2s infinite alternate;
    -webkit-animation: pulseGlow 2s infinite alternate;
    /* Force hardware acceleration for smooth mobile performance */
    transform: translateZ(0);
    will-change: transform;
    -webkit-transform: translateZ(0);
    -webkit-will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.boot-logo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    z-index: 2;
    position: relative;
}

.boot-logo {
    background: transparent;
    border-radius: 50%;
    padding: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 170px;
    height: 170px;
    box-shadow: none;
    transition: all 0.3s ease;
    z-index: 2;
    position: relative;
}

/* Light Theme Boot Logo */
body.light-theme .boot-logo {
    background: transparent;
    box-shadow: none;
}

.boot-logo i {
    font-size: 100px;
    color: #7289da; /* Discord brand color */
    text-shadow: 
        0 0 20px rgba(114, 137, 218, 0.8),
        0 0 40px rgba(114, 137, 218, 0.6),
        0 0 60px rgba(114, 137, 218, 0.4),
        0 0 80px rgba(114, 137, 218, 0.2);
    transition: all 0.3s ease;
    animation: iconGlow 3s infinite alternate;
    -webkit-animation: iconGlow 3s infinite alternate;
    /* Force hardware acceleration for smooth mobile performance */
    transform: translateZ(0);
    will-change: transform;
    -webkit-transform: translateZ(0);
    -webkit-will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Light Theme Boot Logo Icon */
body.light-theme .boot-logo i {
    color: #1976d2;
    text-shadow: 
        0 0 20px rgba(25, 118, 210, 0.8),
        0 0 40px rgba(25, 118, 210, 0.6),
        0 0 60px rgba(25, 118, 210, 0.4),
        0 0 80px rgba(25, 118, 210, 0.2);
    animation: iconGlowLight 3s infinite alternate;
    -webkit-animation: iconGlowLight 3s infinite alternate;
}

.boot-title {
    font-size: 4em;
    font-weight: 700;
    color: #e0e0e0;
    text-shadow: 0 0 20px rgba(0, 123, 255, 0.4);
    margin-bottom: 20px;
    animation: fadeInScale 1.5s ease-out forwards;
    -webkit-animation: fadeInScale 1.5s ease-out forwards;
    transition: all 0.3s ease;
    /* Force hardware acceleration for smooth mobile performance */
    transform: translateZ(0);
    will-change: transform;
    -webkit-transform: translateZ(0);
    -webkit-will-change: transform;
}

/* Light Theme Boot Title */
body.light-theme .boot-title {
    color: #333;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Loading Ring Animation */
.loading-ring {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 240px;
    height: 240px;
    border: 4px solid rgba(114, 137, 218, 0.2);
    border-top: 4px solid #7289da;
    border-radius: 50%;
    animation: spinWithPause 3s ease-in-out infinite;
    -webkit-animation: spinWithPause 3s ease-in-out infinite;
    z-index: 1;
    box-shadow: 
        0 0 20px rgba(114, 137, 218, 0.5),
        inset 0 0 20px rgba(114, 137, 218, 0.1);
    /* Force hardware acceleration for smooth mobile performance */
    transform: translateZ(0);
    will-change: transform;
    -webkit-transform: translateZ(0);
    -webkit-will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Loading Ring Stopped State */
.loading-ring.stopped {
    animation: none !important;
    transform: rotate(0deg) !important;
    transition: transform 0.3s ease;
}

/* Light Theme Loading Ring */
body.light-theme .loading-ring {
    border: 4px solid rgba(25, 118, 210, 0.2);
    border-top: 4px solid #1976d2;
    box-shadow: 
        0 0 20px rgba(25, 118, 210, 0.5),
        inset 0 0 20px rgba(25, 118, 210, 0.1);
}

/* Animations for new loading screen */
@keyframes pulseGlow {
    0% { 
        box-shadow: 
            0 0 40px rgba(0, 123, 255, 0.6),
            0 0 80px rgba(0, 123, 255, 0.4),
            0 0 120px rgba(0, 123, 255, 0.2),
            inset 0 0 30px rgba(255, 255, 255, 0.1);
        transform: scale(1); 
    }
    100% { 
        box-shadow: 
            0 0 60px rgba(0, 123, 255, 0.9),
            0 0 120px rgba(0, 123, 255, 0.6),
            0 0 180px rgba(0, 123, 255, 0.3),
            inset 0 0 40px rgba(255, 255, 255, 0.2);
        transform: scale(1.02); 
    }
}

@-webkit-keyframes pulseGlow {
    0% { 
        box-shadow: 
            0 0 40px rgba(0, 123, 255, 0.6),
            0 0 80px rgba(0, 123, 255, 0.4),
            0 0 120px rgba(0, 123, 255, 0.2),
            inset 0 0 30px rgba(255, 255, 255, 0.1);
        -webkit-transform: scale(1); 
    }
    100% { 
        box-shadow: 
            0 0 60px rgba(0, 123, 255, 0.9),
            0 0 120px rgba(0, 123, 255, 0.6),
            0 0 180px rgba(0, 123, 255, 0.3),
            inset 0 0 40px rgba(255, 255, 255, 0.2);
        -webkit-transform: scale(1.02); 
    }
}

@keyframes iconGlow {
    0% { 
        text-shadow: 
            0 0 20px rgba(114, 137, 218, 0.8),
            0 0 40px rgba(114, 137, 218, 0.6),
            0 0 60px rgba(114, 137, 218, 0.4),
            0 0 80px rgba(114, 137, 218, 0.2);
    }
    100% { 
        text-shadow: 
            0 0 30px rgba(114, 137, 218, 1),
            0 0 60px rgba(114, 137, 218, 0.8),
            0 0 90px rgba(114, 137, 218, 0.6),
            0 0 120px rgba(114, 137, 218, 0.4);
    }
}

@-webkit-keyframes iconGlow {
    0% { 
        text-shadow: 
            0 0 20px rgba(114, 137, 218, 0.8),
            0 0 40px rgba(114, 137, 218, 0.6),
            0 0 60px rgba(114, 137, 218, 0.4),
            0 0 80px rgba(114, 137, 218, 0.2);
    }
    100% { 
        text-shadow: 
            0 0 30px rgba(114, 137, 218, 1),
            0 0 60px rgba(114, 137, 218, 0.8),
            0 0 90px rgba(114, 137, 218, 0.6),
            0 0 120px rgba(114, 137, 218, 0.4);
    }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@-webkit-keyframes fadeInScale {
    from { opacity: 0; -webkit-transform: scale(0.8); }
    to { opacity: 1; -webkit-transform: scale(1); }
}

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

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

@keyframes spinTopToTop {
    0% { 
        transform: translateZ(0) rotate(0deg);
    }
    50% { 
        transform: translateZ(0) rotate(180deg);
    }
    100% { 
        transform: translateZ(0) rotate(360deg);
    }
}

@-webkit-keyframes spinTopToTop {
    0% { 
        -webkit-transform: translateZ(0) rotate(0deg);
    }
    50% { 
        -webkit-transform: translateZ(0) rotate(180deg);
    }
    100% { 
        -webkit-transform: translateZ(0) rotate(360deg);
    }
}

@keyframes spinWithPause {
    0% { 
        transform: translateZ(0) rotate(0deg);
    }
    5% { 
        transform: translateZ(0) rotate(0deg);
    }
    25% { 
        transform: translateZ(0) rotate(360deg);
    }
    30% { 
        transform: translateZ(0) rotate(360deg);
    }
    50% { 
        transform: translateZ(0) rotate(720deg);
    }
    55% { 
        transform: translateZ(0) rotate(720deg);
    }
    75% { 
        transform: translateZ(0) rotate(1080deg);
    }
    80% { 
        transform: translateZ(0) rotate(1080deg);
    }
    100% { 
        transform: translateZ(0) rotate(1080deg);
    }
}

@-webkit-keyframes spinWithPause {
    0% { 
        -webkit-transform: translateZ(0) rotate(0deg);
    }
    5% { 
        -webkit-transform: translateZ(0) rotate(0deg);
    }
    25% { 
        -webkit-transform: translateZ(0) rotate(360deg);
    }
    30% { 
        -webkit-transform: translateZ(0) rotate(360deg);
    }
    50% { 
        -webkit-transform: translateZ(0) rotate(720deg);
    }
    55% { 
        -webkit-transform: translateZ(0) rotate(720deg);
    }
    75% { 
        -webkit-transform: translateZ(0) rotate(1080deg);
    }
    80% { 
        -webkit-transform: translateZ(0) rotate(1080deg);
    }
    100% { 
        -webkit-transform: translateZ(0) rotate(1080deg);
    }
}


@keyframes iconGlowLight {
    0% { 
        text-shadow: 
            0 0 20px rgba(25, 118, 210, 0.8),
            0 0 40px rgba(25, 118, 210, 0.6),
            0 0 60px rgba(25, 118, 210, 0.4),
            0 0 80px rgba(25, 118, 210, 0.2);
    }
    100% { 
        text-shadow: 
            0 0 30px rgba(25, 118, 210, 1),
            0 0 60px rgba(25, 118, 210, 0.8),
            0 0 90px rgba(25, 118, 210, 0.6),
            0 0 120px rgba(25, 118, 210, 0.4);
    }
}

@-webkit-keyframes iconGlowLight {
    0% { 
        text-shadow: 
            0 0 20px rgba(25, 118, 210, 0.8),
            0 0 40px rgba(25, 118, 210, 0.6),
            0 0 60px rgba(25, 118, 210, 0.4),
            0 0 80px rgba(25, 118, 210, 0.2);
    }
    100% { 
        text-shadow: 
            0 0 30px rgba(25, 118, 210, 1),
            0 0 60px rgba(25, 118, 210, 0.8),
            0 0 90px rgba(25, 118, 210, 0.6),
            0 0 120px rgba(25, 118, 210, 0.4);
    }
}

/* Mobile Responsive Styles for Loading Screen */
@media (max-width: 768px) {
    .boot-logo-container {
        width: 180px;
        height: 180px;
        margin-bottom: 25px;
        /* Ensure animations work on mobile */
        transform: translateZ(0);
        will-change: transform;
    }

    .boot-logo-image {
        width: 100%;
        height: 100%;
    }

    .loading-ring {
        top: -8px;
        left: -8px;
        width: 196px;
        height: 196px;
        border-width: 3px;
        /* Force hardware acceleration for smooth animation on mobile */
        transform: translateZ(0);
        will-change: transform;
        -webkit-transform: translateZ(0);
        -webkit-will-change: transform;
    }

    /* Ensure animation continues on mobile */
    .loading-ring:not(.stopped) {
        animation: spinWithPause 3s ease-in-out infinite !important;
        -webkit-animation: spinWithPause 3s ease-in-out infinite !important;
    }

    .boot-title {
        font-size: 3em;
        margin-bottom: 15px;
        text-align: center;
        padding: 0 20px;
    }
}

@media (max-width: 480px) {
    #loading-screen {
        padding: 20px;
        /* Ensure smooth performance on mobile */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }

    .boot-logo-container {
        width: 150px;
        height: 150px;
        margin-bottom: 20px;
        /* Force hardware acceleration */
        transform: translateZ(0);
        will-change: transform;
        -webkit-transform: translateZ(0);
        -webkit-will-change: transform;
    }

    .boot-logo-image {
        width: 100%;
        height: 100%;
    }

    .loading-ring {
        top: -6px;
        left: -6px;
        width: 162px;
        height: 162px;
        border-width: 3px;
        /* Critical: Force hardware acceleration and ensure animation works */
        transform: translateZ(0);
        will-change: transform;
        -webkit-transform: translateZ(0);
        -webkit-will-change: transform;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    /* Ensure animation continues on mobile */
    .loading-ring:not(.stopped) {
        animation: spinWithPause 3s ease-in-out infinite !important;
        -webkit-animation: spinWithPause 3s ease-in-out infinite !important;
    }

    .boot-title {
        font-size: 2.2em;
        margin-bottom: 15px;
        text-align: center;
        padding: 0 15px;
        line-height: 1.2;
    }
}

@media (max-width: 320px) {
    .boot-logo-container {
        width: 120px;
        height: 120px;
        margin-bottom: 15px;
        /* Force hardware acceleration */
        transform: translateZ(0);
        will-change: transform;
        -webkit-transform: translateZ(0);
        -webkit-will-change: transform;
    }

    .boot-logo-image {
        width: 100%;
        height: 100%;
    }

    .loading-ring {
        top: -5px;
        left: -5px;
        width: 130px;
        height: 130px;
        border-width: 2px;
        /* Critical: Force hardware acceleration and ensure animation works */
        transform: translateZ(0);
        will-change: transform;
        -webkit-transform: translateZ(0);
        -webkit-will-change: transform;
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    /* Ensure animation continues on mobile */
    .loading-ring:not(.stopped) {
        animation: spinWithPause 3s ease-in-out infinite !important;
        -webkit-animation: spinWithPause 3s ease-in-out infinite !important;
    }

    .boot-title {
        font-size: 1.8em;
        margin-bottom: 12px;
        padding: 0 10px;
    }
}
