/* CinePlex Cinematic Loader - High-Fidelity Google Stitch Design */

:root {
    --cinema-bg: #000000;
    --cinema-accent: #00D2FF;
    --cinema-accent-dark: #0095ff;
    --cinema-text: #e5e2e1;
    --cinema-text-variant: #bbc9cf;
    --cinema-silver: #E0E0E0;
    
    /* Spacing tokens from DESIGN.md */
    --stack-sm: 4px;
    --stack-md: 12px;
    --stack-lg: 32px;
}

.cineplex-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background-color: var(--cinema-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
    overflow: hidden;
}

.cineplex-loader.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Atmospheric Background Layers (Surface 1) */
.loader-bg-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../img/stitch_splash_bg.jpg');
    background-size: cover;
    filter: blur(5px); /* Soft blur to see the theater detail */
    transform: scale(1.05);
    opacity: 0.55; /* Slightly brighter to see the background clearly */
    z-index: 1;
}

.loader-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 20%, rgba(0,0,0,0.8) 100%);
    z-index: 2;
}

/* Centered Loading Core */
.cinematic-container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 440px;
    padding: 0 var(--stack-lg);
    text-align: center;
}

/* Logo Section */
.logo-section {
    margin-bottom: var(--stack-lg);
}

.logo-metallic {
    font-family: 'Sora', sans-serif; /* PRD: Sora for headlines */
    font-size: clamp(2.5rem, 8vw, 3.5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    background: linear-gradient(180deg, #FFFFFF 0%, #A0A0A0 50%, #707070 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
    animation: logo-pulse 4s infinite ease-in-out;
    margin: 0;
    line-height: 1.1;
}

.logo-subtext {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    opacity: 0.6;
}

.logo-subtext-icon {
    font-size: 13px;
    color: var(--cinema-silver);
}

.logo-subtext-text {
    font-family: 'JetBrains Mono', monospace; /* PRD: JetBrains Mono for metadata */
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cinema-silver);
}

/* Progress Section */
.progress-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--stack-md);
}

/* Loading Progress Bar - Capsule Shape */
.loader-progress-container {
    position: relative;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 9999px; /* Capsule track */
    overflow: visible; /* Allow glow cap to overflow naturally */
}

.loader-line {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #a9c7ff, var(--cinema-accent));
    border-radius: 9999px; /* Capsule fill */
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.5);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Glowing Cap Micro-interaction */
.loader-glow-cap {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translate(50%, -50%);
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-radius: 50%;
    filter: blur(4px);
    box-shadow: 0 0 20px 4px var(--cinema-accent);
}

.status-section {
    display: flex;
    flex-direction: column;
    gap: var(--stack-sm);
}

.loading-status-text {
    font-family: 'Montserrat', sans-serif; /* PRD: Montserrat for body info */
    font-size: 16px;
    font-weight: 500;
    color: var(--cinema-accent);
    letter-spacing: 0.02em;
    margin: 0;
}

.loading-status-detail {
    font-family: 'JetBrains Mono', monospace; /* PRD: JetBrains Mono for status metadata */
    font-size: 10px;
    font-weight: 500;
    color: var(--cinema-text-variant);
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin: 0;
    transition: opacity 0.2s ease;
}

/* --- PRD Requirement: Error Handling & Update Overlay --- */
.loader-overlay-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(20px); /* PRD: 20px background blur */
    -webkit-backdrop-filter: blur(20px);
    animation: fadeIn 0.4s ease-out forwards;
}

.loader-card {
    background: rgba(20, 20, 20, 0.7); /* PRD: glass-surface */
    border: 1px solid rgba(255, 255, 255, 0.1); /* PRD: 1px inner border at 10% opacity */
    border-radius: 12px; /* PRD: 12px corner radius */
    padding: 2.5rem;
    width: 90%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.75), 0 0 20px rgba(0, 210, 255, 0.05);
    color: var(--cinema-text);
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.error-icon {
    font-size: 3rem;
    color: #ffb4ab;
    margin-bottom: 1.2rem;
    filter: drop-shadow(0 0 10px rgba(255, 180, 171, 0.3));
}

.update-icon {
    font-size: 3rem;
    color: var(--cinema-accent);
    margin-bottom: 1.2rem;
    filter: drop-shadow(0 0 10px rgba(0, 210, 255, 0.3));
}

.card-title {
    font-family: 'Sora', sans-serif; /* PRD: Sora for headlines */
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
    color: #ffffff;
    text-transform: uppercase;
}

.card-text {
    font-family: 'Montserrat', sans-serif; /* PRD: Montserrat for body info */
    font-size: 0.92rem;
    color: #bbc9cf;
    line-height: 1.6;
    margin-bottom: 1.8rem;
}

.loader-card-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.loader-btn {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.75rem 2rem;
    border-radius: 12px; /* PRD: 12px corner radius */
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.02em;
}

.primary-btn {
    background: var(--cinema-accent-dark);
    border: none;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.3);
}

.primary-btn:hover {
    background: var(--cinema-accent);
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.6);
}

.secondary-btn {
    background: rgba(20, 20, 20, 0.7); /* glass-surface */
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #bbc9cf;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* Animations */
@keyframes logo-pulse {
    0%, 100% { 
        opacity: 0.85; 
        filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.1)); 
    }
    50% { 
        opacity: 1; 
        filter: drop-shadow(0 0 20px rgba(0, 210, 255, 0.3)); 
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Optimization for rendering performance */
.cineplex-loader * {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cinematic-container {
        padding: 0 var(--stack-md);
    }

    .loader-progress-container {
        width: 100%;
    }

    .loading-status-text {
        font-size: 14px;
    }

    .logo-metallic {
        letter-spacing: -0.01em;
    }
    
    .loader-card {
        padding: 2rem 1.5rem;
    }
}