/* Moon Phase Loader Styles */
.page-load-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, rgba(15,15,20,0.97), rgba(25,25,35,0.95));
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(5px);
    font-family: Arial, sans-serif;
}

.loader-content {
    text-align: center;
    animation: contentFloat 3s ease-in-out infinite;
    max-width: 400px;
    width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loader-content p {
    color: #ffffff;
    font-size: 1.1rem;
    margin-bottom: 25px;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    min-height: 1.5rem;
}

/* Moon Loader */
.moon-loader {
    width: 4em;
    height: 4em;
    border-radius: 50%;
    background: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 15px #fff;
    animation: glow 2s infinite alternate ease-in-out;
    margin-bottom: 20px;
}

.moon-loader::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4em;
    height: 4em;
    border-radius: 50%;
    background: #000;
    transform: translateX(-100%);
    animation: moon-phase 2s infinite linear;
}

.moon-percentage {
    font-size: 2em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px #fff;
    margin-top: 10px;
}

/* Keep legacy progress bar for fallback */
.progress-bar {
    width: 100%;
    max-width: 320px;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    margin: 20px auto 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
    display: none; /* Hidden by default for moon loader */
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, 
        #3498db 0%, 
        #00e5ff 50%, 
        #1abc9c 100%
    );
    border-radius: 10px;
    transition: all 0.1s ease-out;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.6);
    position: relative;
}

/* Moon animations */
@keyframes moon-phase {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0); }
    100% { transform: translateX(100%); }
}

@keyframes glow {
    from { box-shadow: 0 0 5px #888; }
    to { box-shadow: 0 0 20px #fff; }
}

@keyframes contentFloat {
    0%, 100% { 
        transform: translateY(0px); 
    }
    50% { 
        transform: translateY(-8px); 
    }
}

/* Loading dots animation for text */
.loader-content p.loading::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* BLACK BACKGROUND - Prevents content flash */
#page-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  z-index: 9998;
  opacity: 1;
  transition: opacity 0.4s ease-out;
}

/* LOADER OVERLAY - Enhanced styles */
#page-load-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.675);
  backdrop-filter: blur(10px);

  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  color: white;
  font-family: 'Arial', sans-serif;
  z-index: 9999;
  transition: opacity 0.4s ease-out;
}

/* Navigation loader styles */
.nav-loader {
    background: rgba(0, 0, 0, 0.8) !important;
}

.nav-loader .loader-content {
    animation: none;
}

.nav-loader .progress-bar {
    display: none;
}

.nav-loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* HTML Loader - displays immediately */
.html-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, rgba(15,15,20,0.97), rgba(25,25,35,0.95));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 1;
    visibility: visible;
    backdrop-filter: blur(5px);
    font-family: Arial, sans-serif;
}

/* Main content wrapper - hidden initially */
.main-content-wrapper {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease-out, visibility 0.4s ease-out;
}

/* Prevent content flash during loader transition */
body {
    overflow: hidden;
}

body.loaded {
    overflow: auto;
}