/**
 * Apex Academy Preloader Styles
 * تنسيقات صفحة الانتظار مع شعار Apex
 */

/* تحسين Preloader الأساسي */
.apex-preloader {
    background: linear-gradient(135deg, #0f1419 0%, #1a2332 100%);
}

.apex-preloader .animation-preloader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

/* حاوية الشعار */
.apex-logo-container {
    position: relative;
    z-index: 10;
    animation: logoFloat 3s ease-in-out infinite;
}

/* شعار Apex */
.apex-preloader-logo {
    max-width: 200px;
    height: auto;
    filter: drop-shadow(0 10px 30px rgba(120, 203, 166, 0.4));
    animation: logoPulse 2s ease-in-out infinite;
}

/* شعار افتراضي نصي */
.apex-default-logo {
    font-size: 36px;
    font-weight: 700;
    background: linear-gradient(135deg, #78CBA6 0%, #4CAF50 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 20px rgba(120, 203, 166, 0.3);
    letter-spacing: 3px;
}

/* Spinner محسّن بألوان Apex */
.apex-preloader .spinner {
    width: 80px;
    height: 80px;
    border: 4px solid rgba(120, 203, 166, 0.1);
    border-top-color: #78CBA6;
    border-radius: 50%;
    animation: apexSpin 1s linear infinite;
    position: relative;
}

.apex-preloader .spinner::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 3px solid rgba(76, 175, 80, 0.1);
    border-top-color: #4CAF50;
    border-radius: 50%;
    animation: apexSpin 1.5s linear infinite reverse;
}

/* نص Loading متحرك */
.loading-text {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.loading-text-words {
    font-size: 18px;
    font-weight: 600;
    color: #78CBA6;
    animation: loadingBounce 1.4s ease-in-out infinite;
    text-shadow: 0 2px 10px rgba(120, 203, 166, 0.3);
}

.loading-text-words:nth-child(1) { animation-delay: 0s; }
.loading-text-words:nth-child(2) { animation-delay: 0.1s; }
.loading-text-words:nth-child(3) { animation-delay: 0.2s; }
.loading-text-words:nth-child(4) { animation-delay: 0.3s; }
.loading-text-words:nth-child(5) { animation-delay: 0.4s; }
.loading-text-words:nth-child(6) { animation-delay: 0.5s; }
.loading-text-words:nth-child(7) { animation-delay: 0.6s; }

/* إخفاء pseudo-element القديم */
.apex-preloader .animation-preloader::after {
    display: none;
}

/* ===== Animations ===== */

/* تحويم الشعار */
@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-15px);
    }
}

/* نبض الشعار */
@keyframes logoPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.85;
        transform: scale(1.05);
    }
}

/* دوران Spinner */
@keyframes apexSpin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* قفز حروف Loading */
@keyframes loadingBounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 1;
    }
    40% {
        transform: translateY(-15px);
        opacity: 0.7;
    }
}

/* تأثير الاختفاء عند التحميل */
.apex-preloader.loaded .apex-logo-container {
    animation: fadeOutUp 0.6s ease forwards;
}

.apex-preloader.loaded .spinner {
    animation: fadeOut 0.4s ease forwards;
}

.apex-preloader.loaded .loading-text {
    animation: fadeOutDown 0.6s ease forwards;
}

@keyframes fadeOutUp {
    to {
        opacity: 0;
        transform: translateY(-30px);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

@keyframes fadeOutDown {
    to {
        opacity: 0;
        transform: translateY(30px);
    }
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
    .apex-preloader-logo {
        max-width: 150px;
    }
    
    .apex-default-logo {
        font-size: 28px;
    }
    
    .apex-preloader .spinner {
        width: 60px;
        height: 60px;
    }
    
    .loading-text-words {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .apex-preloader-logo {
        max-width: 120px;
    }
    
    .apex-default-logo {
        font-size: 24px;
    }
    
    .apex-preloader .spinner {
        width: 50px;
        height: 50px;
    }
    
    .loading-text-words {
        font-size: 12px;
        gap: 5px;
    }
}

/* ===== Theme Support ===== */

/* Dark Mode Enhancement */
@media (prefers-color-scheme: dark) {
    .apex-preloader {
        background: linear-gradient(135deg, #0a0e13 0%, #141b27 100%);
    }
}

/* RTL Support */
[dir="rtl"] .loading-text {
    direction: ltr; /* Keep LOADING in LTR */
}
