/* ==========================================================================
   GGZ AI - Frontend SPA (Single Page Application) Styling
   ========================================================================== */

/* Top SPA Loading Progress Bar */
#frontendLoadingBar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent, #d4a32a), #38bdf8, #2ed573);
    box-shadow: 0 0 12px rgba(212, 163, 42, 0.8), 0 0 6px rgba(56, 189, 248, 0.8);
    z-index: 99999;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

#frontendLoadingBar.loading {
    opacity: 1;
}

/* Fullscreen Glassmorphism Preloader */
#frontendPreloader {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(10, 15, 29, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#frontendPreloader.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-brand-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.preloader-logo-ring {
    position: relative;
    width: 86px;
    height: 86px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preloader-logo-ring::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--accent, #d4a32a);
    border-right-color: #38bdf8;
    animation: preloaderSpin 1.2s linear infinite;
}

.preloader-logo-img {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent, #d4a32a);
    box-shadow: 0 0 25px rgba(212, 163, 42, 0.5);
    animation: preloaderPulse 2s ease-in-out infinite alternate;
}

.preloader-title {
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, var(--accent, #d4a32a) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.01em;
}

.preloader-dots-spinner {
    display: flex;
    gap: 6px;
}

.preloader-dots-spinner span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent, #d4a32a);
    animation: preloaderBounce 1.4s infinite ease-in-out both;
}

.preloader-dots-spinner span:nth-child(1) { animation-delay: -0.32s; }
.preloader-dots-spinner span:nth-child(2) { animation-delay: -0.16s; }

@keyframes preloaderSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes preloaderPulse {
    0% { transform: scale(0.96); box-shadow: 0 0 15px rgba(212, 163, 42, 0.3); }
    100% { transform: scale(1.04); box-shadow: 0 0 30px rgba(212, 163, 42, 0.7); }
}

@keyframes preloaderBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Reset & Box-Sizing Protection */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    max-width: 100vw;
    overflow-x: clip;
}

/* Section Division 1: Header Section */
.frontend-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    box-sizing: border-box;
}

/* Section Division 2: Main Content Area */
.frontend-main-content {
    flex: 1 0 auto;
    width: 100%;
    box-sizing: border-box;
    overflow-x: clip;
}

/* Section Division 3: Footer Section */
.frontend-footer {
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    overflow-x: clip;
}

/* Smooth SPA Content Fade-in Animation */
.spa-fade-in {
    animation: spaContentFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes spaContentFadeIn {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }
    99% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================================
   Preloader Active & Silky Smooth Entry Animations
   ========================================================================== */
body.preloader-active {
    overflow: hidden !important;
}

/* Default state for entry elements: subtle offset & zero opacity */
.hero-banner,
.category-bar,
.featured-section,
.characters-section {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.hero-banner { transition-delay: 0.05s; }
.category-bar { transition-delay: 0.12s; }
.featured-section { transition-delay: 0.18s; }
.characters-section { transition-delay: 0.24s; }

/* Smooth fade-in once page is loaded */
body.page-loaded .hero-banner,
body.page-loaded .category-bar,
body.page-loaded .featured-section,
body.page-loaded .characters-section {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Main Content Area Preloader Overlay
   ========================================================================== */
.content-preloader {
    position: absolute;
    inset: 0;
    z-index: 500;
    background: rgba(11, 15, 25, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: all;
    min-height: 380px;
}

.content-preloader.active {
    display: flex !important;
    opacity: 1;
}

.content-preloader.fade-out {
    opacity: 0;
    pointer-events: none;
}

.content-preloader-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    padding: 22px 34px;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.content-preloader-text {
    font-size: 0.88rem;
    font-weight: 700;
    color: #f1f5f9;
    letter-spacing: 0.03em;
}
