/* Preloader Styles - Electric Gallery */

/* Preloader Container */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1E1E2D 0%, #2a1a18 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

/* Hide preloader when loaded */
.preloader.loaded {
    opacity: 0;
    visibility: hidden;
}

/* Preloader Content */
.preloader-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    animation: fadeIn 0.6s ease;
}


/* Loading Spinner - Centered */
.preloader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(254, 63, 34, 0.2);
    border-top-color: #FE3F22;
    border-right-color: #FE3F22;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0;
    position: relative;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .preloader-spinner {
        width: 50px;
        height: 50px;
        border-width: 3px;
    }
}

/* Logo Container */
.preloader-logo {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

/* Logo Image */
.preloader-logo img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    animation: spin 3s linear infinite;
}

/* Electric Icon */
.preloader-icon {
    font-size: 4rem;
    color: #FFD700;
    animation: electric 1.5s ease-in-out infinite;
}

/* Loading Text */
.preloader-text {
    color: #FFD700;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    margin-top: 20px;
    animation: blink 1.5s ease-in-out infinite;
}

/* Loading Dots */
.preloader-dots {
    display: inline-flex;
    gap: 8px;
    margin-top: 15px;
}

.preloader-dots span {
    width: 12px;
    height: 12px;
    background: #FFD700;
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.preloader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.preloader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Loading Spinner */
.preloader-spinner {
    width: 80px;
    height: 80px;
    border: 4px solid rgba(255, 215, 0, 0.2);
    border-top-color: #FFD700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .preloader-logo {
        width: 100px;
        height: 100px;
    }
    
    .preloader-logo img {
        width: 60px;
        height: 60px;
    }
    
    .preloader-icon {
        font-size: 3rem;
    }
    
    .preloader-text {
        font-size: 1rem;
    }
    
    .preloader-spinner {
        width: 60px;
        height: 60px;
    }
}

/* Additional Loading Effect */
.preloader-ring {
    position: relative;
    width: 130px;
    height: 130px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preloader-ring::before,
.preloader-ring::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: #FFD700;
    border-radius: 50%;
    animation: spin 2s linear infinite;
    transform: translate(-50%, -50%);
}

.preloader-ring::after {
    width: 80%;
    height: 80%;
    border-top-color: rgba(255, 215, 0, 0.5);
    animation-duration: 1.5s;
    animation-direction: reverse;
    border-width: 3px;
}

/* Center logo inside the spinning ring using flex */
.preloader-ring img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 50%;
    background: #ffffff;
    padding: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 2;
}

/* Fallback text if logo doesn't exist */
.preloader-logo-text {
    color: #FFD700;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    text-align: center;
    z-index: 2;
    padding: 10px;
    max-width: 100px;
    word-wrap: break-word;
}

@media (max-width: 768px) {
    .preloader-ring {
        width: 100px;
        height: 100px;
    }
    .preloader-ring img {
        width: 42px;
        height: 42px;
        padding: 3px;
    }
}