/* Fennec Loader – frame-based animation using separate transparent PNG images.
 *
 * Frames (all under /images/):
 *  - fennec_0_0.png
 *  - fennec_0_1.png
 *  - fennec_0_2.png
 *  - fennec_1_0.png
 *  - fennec_1_1.png
 *  - fennec_1_2.png
 *
 * We stack the 6 frames on top of each other and animate their opacity
 * so that only one is visible at a time. All images are assumed to have
 * transparent backgrounds.
 */

.fennec-loader {
    position: relative;
    width: 160px;
    height: 160px;
}

/* Smaller loader for inline button usage */
.fennec-loader-small {
    width: 48px;
    height: 48px;
}

/* Larger loader for full-screen overlay */
.fennec-loader-large {
    width: 160px;
    height: 160px;
}

@media (max-width: 768px) {
    .fennec-loader {
        width: 120px;
        height: 120px;
    }

    .fennec-loader-large {
        width: 140px;
        height: 140px;
    }
}

.fennec-loader img.fennec-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
}

/* Each frame runs the same keyframes but with a different delay
 * so that only one frame is visible at any given time.
 * Total cycle time: 1.2s (0.2s per frame × 6 frames).
 */
.fennec-loader .frame-0 { animation: fennec-frames 1.2s infinite; animation-delay: 0s; }
.fennec-loader .frame-1 { animation: fennec-frames 1.2s infinite; animation-delay: 0.2s; }
.fennec-loader .frame-2 { animation: fennec-frames 1.2s infinite; animation-delay: 0.4s; }
.fennec-loader .frame-3 { animation: fennec-frames 1.2s infinite; animation-delay: 0.6s; }
.fennec-loader .frame-4 { animation: fennec-frames 1.2s infinite; animation-delay: 0.8s; }
.fennec-loader .frame-5 { animation: fennec-frames 1.2s infinite; animation-delay: 1.0s; }

@keyframes fennec-frames {
    0%   { opacity: 1; }
    16%  { opacity: 1; }
    20%  { opacity: 0; }
    100% { opacity: 0; }
}

/* Full-screen overlay for game generation */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* Semi-transparent dark background with purple/orange gradient */
    background:
        radial-gradient(circle at top, rgba(255, 165, 0, 0.2), transparent 55%),
        radial-gradient(circle at bottom, rgba(128, 90, 213, 0.35), rgba(26, 32, 44, 0.95));
    backdrop-filter: blur(6px);
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 1;
    visibility: visible;
}

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

.loading-overlay-content {
    background: rgba(15, 23, 42, 0.96);
    border-radius: 20px;
    padding: 24px 24px 20px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(251, 146, 60, 0.35); /* soft orange border */
    color: #e2e8f0;
}

.loading-overlay-content .fennec-loader {
    margin: 0 auto 16px;
}

.loading-text-ar {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: #fefcbf;
}

.loading-text-en {
    font-size: 0.9rem;
    margin: 0 0 8px;
    color: #e2e8f0;
}

.loading-powered {
    font-size: 0.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #a5b4fc;
}

@media (max-width: 768px) {
    .loading-overlay-content {
        max-width: 360px;
        padding: 20px 18px 16px;
    }

    .loading-text-ar {
        font-size: 0.95rem;
    }

    .loading-text-en {
        font-size: 0.85rem;
    }
}

/* Inline game button loader styles */
.game-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: 999px;
    padding-inline: 16px;
    min-width: 120px;
    overflow: hidden;
}

.game-btn .game-btn-text {
    display: inline-block;
}

.game-btn .game-btn-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
}

.game-btn .game-loading-label {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.game-btn.is-loading {
    cursor: default;
    opacity: 0.95;
}

.game-btn.is-loading .game-btn-text,
.game-btn.is-loading .fc-btn-mascot {
    display: none !important;
}

.game-btn.is-loading .game-btn-loading {
    display: inline-flex;
}


