/* ============================================
   COSMIC FANTASY 502 PAGE
   Профессиональная страница 502 в стиле космического фэнтези
   ============================================ */

:root {
    /* Cosmic Fantasy Color Palette */
    --cosmic-primary: #6B46C1;
    --cosmic-secondary: #8B5CF6;
    --cosmic-accent: #EC4899;
    --cosmic-cyan: #06B6D4;
    --cosmic-blue: #3B82F6;
    --cosmic-purple: #A855F7;
    --cosmic-pink: #F472B6;
    
    /* Dark Space Backgrounds */
    --space-dark: #0A0A0F;
    --space-darker: #050508;
    --space-card: rgba(15, 15, 25, 0.8);
    --space-glass: rgba(20, 20, 35, 0.6);
    
    /* Text Colors */
    --text-cosmic: #E0E7FF;
    --text-neon: #F0F9FF;
    --text-muted: #9CA3AF;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Rajdhani', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
}

.error-502-page {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--space-dark) 0%, var(--space-darker) 100%);
}

.error-502-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

/* Floating Orbs */
.floating-elements {
    position: absolute;
    width: 100%;
    height: 100%;
}

.floating-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.3;
    animation: float-orb 20s ease-in-out infinite;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #8B5CF6 0%, transparent 70%);
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, #EC4899 0%, transparent 70%);
    top: 60%;
    right: 15%;
    animation-delay: 5s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, #06B6D4 0%, transparent 70%);
    bottom: 20%;
    left: 20%;
    animation-delay: 10s;
}

.orb-4 {
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, #3B82F6 0%, transparent 70%);
    top: 30%;
    right: 30%;
    animation-delay: 15s;
}

.orb-5 {
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, #A855F7 0%, transparent 70%);
    bottom: 10%;
    right: 10%;
    animation-delay: 7s;
}

@keyframes float-orb {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(50px, -50px) scale(1.1);
    }
    50% {
        transform: translate(-30px, 30px) scale(0.9);
    }
    75% {
        transform: translate(30px, 50px) scale(1.05);
    }
}

/* Magical Particles */
.magical-particles {
    position: absolute;
    width: 100%;
    height: 100%;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--cosmic-purple);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--cosmic-purple), 0 0 20px var(--cosmic-purple);
    animation: particle-float 15s linear infinite;
}

.particle-1 { top: 20%; left: 10%; animation-delay: 0s; }
.particle-2 { top: 40%; left: 30%; animation-delay: 2s; }
.particle-3 { top: 60%; left: 50%; animation-delay: 4s; }
.particle-4 { top: 80%; left: 70%; animation-delay: 6s; }
.particle-5 { top: 30%; right: 20%; animation-delay: 1s; }
.particle-6 { top: 50%; right: 40%; animation-delay: 3s; }
.particle-7 { top: 70%; right: 60%; animation-delay: 5s; }
.particle-8 { top: 10%; right: 80%; animation-delay: 7s; }

@keyframes particle-float {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(50px);
        opacity: 0;
    }
}

.error-502-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.error-502-content {
    text-align: center;
    position: relative;
}

/* Animated 502 Number */
.error-502-number {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: clamp(80px, 15vw, 200px);
    line-height: 1;
    perspective: 1000px;
}

.number-digit {
    display: inline-block;
    background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 50%, #06B6D4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(139, 92, 246, 0.5),
                 0 0 80px rgba(236, 72, 153, 0.3),
                 0 0 120px rgba(6, 182, 212, 0.2);
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.6));
    animation: digit-glow 3s ease-in-out infinite;
    position: relative;
}

.number-digit.floating {
    animation: float-digit 3s ease-in-out infinite;
}

@keyframes digit-glow {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.6));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 40px rgba(236, 72, 153, 0.8));
        transform: scale(1.05);
    }
}

@keyframes float-digit {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(-5deg);
    }
    75% {
        transform: translateY(-10px) rotate(5deg);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.6));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 50px rgba(236, 72, 153, 1));
    }
}

/* Icon */
.error-502-icon {
    margin-bottom: 30px;
    font-size: 80px;
    color: var(--cosmic-purple);
    animation: satellite-float 4s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(139, 92, 246, 0.6));
}

@keyframes satellite-float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-15px) rotate(-10deg);
    }
    75% {
        transform: translateY(-5px) rotate(10deg);
    }
}

/* Title */
.error-502-title {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: clamp(32px, 5vw, 56px);
    line-height: 1.2;
    margin-bottom: 24px;
    color: var(--text-cosmic);
}

.error-502-title .title-line {
    display: block;
    margin-bottom: 8px;
}

.error-502-title .gradient-text {
    background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 50%, #06B6D4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
}

/* Description */
.error-502-description {
    font-size: clamp(16px, 2vw, 20px);
    line-height: 1.6;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 40px;
    padding: 0 20px;
}

/* Loader */
.error-502-loader {
    margin: 40px auto;
    max-width: 300px;
}

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

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: var(--cosmic-purple);
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
}

.spinner-ring:nth-child(2) {
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    border-top-color: var(--cosmic-pink);
    animation-duration: 1s;
    animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
    width: 50%;
    height: 50%;
    top: 25%;
    left: 25%;
    border-top-color: var(--cosmic-cyan);
    animation-duration: 0.8s;
}

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

.loader-text {
    font-size: 16px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 1px;
    animation: pulse-text 2s ease-in-out infinite;
}

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

/* Action Buttons */
.error-502-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-bottom: 60px;
    padding: 0 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 16px;
    text-decoration: none;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--cosmic-purple) 0%, var(--cosmic-pink) 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.6);
}

.btn-secondary {
    background: rgba(20, 20, 35, 0.6);
    color: var(--text-cosmic);
    border: 2px solid var(--cosmic-purple);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--cosmic-pink);
    transform: translateY(-2px);
}

.btn-large {
    min-width: 200px;
    padding: 18px 36px;
    font-size: 18px;
}

.btn i {
    font-size: 18px;
}

/* Status Info */
.error-502-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.status-card {
    display: flex;
    gap: 20px;
    padding: 30px;
    background: rgba(15, 15, 25, 0.6);
    border-radius: 20px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: left;
    transition: all 0.3s ease;
}

.status-card:hover {
    border-color: var(--cosmic-purple);
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.4);
    transform: translateY(-5px);
}

.status-card i {
    font-size: 32px;
    color: var(--cosmic-purple);
    filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.6));
    flex-shrink: 0;
}

.status-content h3 {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--text-cosmic);
    margin-bottom: 10px;
}

.status-content p {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 768px) {
    .error-502-number {
        gap: 10px;
        margin-bottom: 30px;
    }

    .error-502-icon {
        font-size: 60px;
        margin-bottom: 20px;
    }

    .error-502-description {
        margin-bottom: 30px;
    }

    .error-502-actions {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 40px;
    }

    .error-502-actions .btn {
        width: 100%;
        min-width: unset;
    }

    .error-502-status {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .status-card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .error-502-page {
        padding: 20px 15px;
    }

    .error-502-number {
        font-size: 80px;
        gap: 5px;
    }

    .status-card {
        flex-direction: column;
        text-align: center;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .error-502-number,
    .error-502-icon,
    .floating-orb,
    .particle,
    .status-card,
    .spinner-ring {
        animation: none !important;
        transition: none !important;
    }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
    .error-502-page {
        background: linear-gradient(135deg, #050508 0%, #0A0A0F 100%);
    }
}
