/* ===============================================
   UNIFIED LOADING SYSTEM
   =============================================== */

/* BASE OVERLAY STYLES */
.core-page-loading,
.core-form-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-out;
    z-index: 999999;
}

.core-page-loading {
    background: linear-gradient(135deg, #0158ad 0%, #4a8bdb 100%);
    z-index: 999998; /* Lower than form loading */
}

.core-form-loading {
    background: linear-gradient(135deg, #0158ad 0%, #4a8bdb 100%);
    z-index: 999999; /* Higher than page loading */
}

.core-page-loading.hiding,
.core-form-loading.hiding {
    opacity: 0;
}

/* ===============================================
   PAGE LOADING (SIMPLE LOGO)
   =============================================== */

.page-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.logo-spinner-simple {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
}

.logo-ring {
    width: 100%;
    height: 100%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top: 3px solid #ffc107;
    animation: spin-smooth 1.5s linear infinite;
}

.logo-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.logo-text {
    font-size: 16px;
    font-weight: 900;
    color: #ffc107;
    letter-spacing: 1.5px;
}

.loading-text-simple {
    color: white;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
}

/* ===============================================
   FORM LOADING (COMPLEX)
   =============================================== */

.form-loading-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.spinner-complex {
    position: relative;
    margin-bottom: 24px;
}

.spinner-ring {
    width: 80px;
    height: 80px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top: 4px solid #ffc107;
    border-right: 4px solid #ffc107;
    animation: spin-complex 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    position: relative;
}

.spinner-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border: 2px solid rgba(255, 193, 7, 0.3);
    border-radius: 50%;
    border-bottom: 2px solid #ffc107;
    animation: spin-reverse 0.8s linear infinite;
}

.spinner-ring::after {
    content: 'CORE';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 900;
    color: #ffc107;
    letter-spacing: 1px;
}

.loading-text-main {
    color: white;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.loading-subtext {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 400;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Animated Dots */
.dots::after {
    content: '';
    animation: dots 1.5s linear infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Progress Bar */
.loading-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 24px;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #ffc107 0%, #ffd43b 50%, #ffc107 100%);
    transform: translateX(-100%);
    transition: transform 3s ease-out;
}

.loading-progress-bar.animate {
    transform: translateX(0%);
}

/* Floating Particles */
.loading-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 193, 7, 0.6);
    border-radius: 50%;
    animation: float-particle 8s linear infinite;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: 1s; }
.particle:nth-child(3) { left: 30%; animation-delay: 2s; }
.particle:nth-child(4) { left: 40%; animation-delay: 3s; }
.particle:nth-child(5) { left: 50%; animation-delay: 4s; }
.particle:nth-child(6) { left: 60%; animation-delay: 5s; }
.particle:nth-child(7) { left: 70%; animation-delay: 6s; }
.particle:nth-child(8) { left: 80%; animation-delay: 7s; }
.particle:nth-child(9) { left: 90%; animation-delay: 8s; }

@keyframes float-particle {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100vh) scale(1); opacity: 0; }
}

/* ===============================================
   ANIMATIONS
   =============================================== */

@keyframes spin-smooth {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spin-complex {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spin-reverse {
    0% { transform: translate(-50%, -50%) rotate(360deg); }
    100% { transform: translate(-50%, -50%) rotate(0deg); }
}

/* ===============================================
   THEME VARIATIONS
   =============================================== */

.admin-theme {
    background: linear-gradient(135deg, #0158ad 0%, #013f7a 100%);
}

.staff-theme {
    background: linear-gradient(135deg, #0158ad 0%, #4a8bdb 100%);
}

.logout-theme {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
}

.logout-theme .logo-text,
.logout-theme .spinner-ring::after {
    color: #fbbf24;
}

.logout-theme .logo-ring,
.logout-theme .spinner-ring {
    border-top-color: #fbbf24;
    border-right-color: #fbbf24;
}

/* ===============================================
   MOBILE RESPONSIVE
   =============================================== */

@media (max-width: 768px) {
    .logo-spinner-simple {
        width: 80px;
        height: 80px;
        margin-bottom: 16px;
    }
    
    .logo-center {
        width: 60px;
        height: 60px;
    }
    
    .logo-text {
        font-size: 14px;
    }
    
    .spinner-ring {
        width: 60px;
        height: 60px;
        margin-bottom: 20px;
    }
    
    .spinner-ring::before {
        width: 45px;
        height: 45px;
    }
    
    .loading-progress {
        width: 150px;
    }
}