/* Loading Screen Styles */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.dark .loading-screen {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.cube-container {
    perspective: 1000px;
    margin-bottom: 2rem;
}

.cube-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    transform-style: preserve-3d;
    animation: cubeFloat 3s ease-in-out infinite;
}

.cube {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    animation: cubeRotate 8s linear infinite;
}

.cube-face {
    position: absolute;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.cube-front { transform: translateZ(60px); animation: faceFrontOpen 4s ease-in-out infinite; }
.cube-back { transform: rotateY(180deg) translateZ(60px); animation: faceBackOpen 4s ease-in-out infinite 0.5s; }
.cube-left { transform: rotateY(-90deg) translateZ(60px); animation: faceLeftOpen 4s ease-in-out infinite 0.25s; }
.cube-right { transform: rotateY(90deg) translateZ(60px); animation: faceRightOpen 4s ease-in-out infinite 0.75s; }
.cube-top { transform: rotateX(90deg) translateZ(60px); animation: faceTopOpen 4s ease-in-out infinite 1s; }
.cube-bottom { transform: rotateX(-90deg) translateZ(60px); animation: faceBottomOpen 4s ease-in-out infinite 1.25s; }

.cogwheel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    animation: cogSpin 3s linear infinite;
    z-index: 1;
}

.loading-text {
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    letter-spacing: 0.2em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    animation: textPulse 2s ease-in-out infinite;
}

.loading-progress {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.loading-progress-bar {
    height: 100%;
    background: white;
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dot {
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

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

@keyframes cubeRotate {
    0% { transform: rotateX(0deg) rotateY(0deg); }
    100% { transform: rotateX(360deg) rotateY(360deg); }
}

@keyframes faceFrontOpen {
    0%, 100% { opacity: 0.8; transform: translateZ(60px); }
    50% { opacity: 0.1; transform: translateZ(150px); }
}

@keyframes faceBackOpen {
    0%, 100% { opacity: 0.8; transform: rotateY(180deg) translateZ(60px); }
    50% { opacity: 0.1; transform: rotateY(180deg) translateZ(150px); }
}

@keyframes faceLeftOpen {
    0%, 100% { opacity: 0.8; transform: rotateY(-90deg) translateZ(60px); }
    50% { opacity: 0.1; transform: rotateY(-90deg) translateZ(150px); }
}

@keyframes faceRightOpen {
    0%, 100% { opacity: 0.8; transform: rotateY(90deg) translateZ(60px); }
    50% { opacity: 0.1; transform: rotateY(90deg) translateZ(150px); }
}

@keyframes faceTopOpen {
    0%, 100% { opacity: 0.8; transform: rotateX(90deg) translateZ(60px); }
    50% { opacity: 0.1; transform: rotateX(90deg) translateZ(150px); }
}

@keyframes faceBottomOpen {
    0%, 100% { opacity: 0.8; transform: rotateX(-90deg) translateZ(60px); }
    50% { opacity: 0.1; transform: rotateX(-90deg) translateZ(150px); }
}

@keyframes cogSpin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(0.8);
        opacity: 0.3;
    }
    25% {
        transform: translate(-50%, -50%) rotate(180deg) scale(1.2);
        opacity: 0.8;
    }
    50% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1.5);
        opacity: 1;
        filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
    }
    75% {
        transform: translate(-50%, -50%) rotate(540deg) scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) rotate(720deg) scale(0.8);
        opacity: 0.3;
    }
}

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

@keyframes bounce {
    0%, 80%, 100% { 
        transform: translateY(0) scale(0.8);
        opacity: 0.5;
    }
    40% { 
        transform: translateY(-15px) scale(1);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .cube-wrapper { width: 100px; height: 100px; }
    .cube-face { width: 100px; height: 100px; }
    .cube-front { transform: translateZ(50px); }
    .cube-back { transform: rotateY(180deg) translateZ(50px); }
    .cube-left { transform: rotateY(-90deg) translateZ(50px); }
    .cube-right { transform: rotateY(90deg) translateZ(50px); }
    .cube-top { transform: rotateX(90deg) translateZ(50px); }
    .cube-bottom { transform: rotateX(-90deg) translateZ(50px); }
    .cogwheel { font-size: 2.5rem; }
    .loading-text { font-size: 1.2rem; }
    .loading-progress { width: 250px; }
}

@media (max-width: 480px) {
    .cube-wrapper { width: 80px; height: 80px; }
    .cube-face { width: 80px; height: 80px; }
    .cube-front { transform: translateZ(40px); }
    .cube-back { transform: rotateY(180deg) translateZ(40px); }
    .cube-left { transform: rotateY(-90deg) translateZ(40px); }
    .cube-right { transform: rotateY(90deg) translateZ(40px); }
    .cube-top { transform: rotateX(90deg) translateZ(40px); }
    .cube-bottom { transform: rotateX(-90deg) translateZ(40px); }
    .cogwheel { font-size: 2rem; }
    .loading-text { font-size: 1rem; }
    .loading-progress { width: 200px; }
}
