/* ═══════════════════════════════════════════════════════════
   Premium Loading Screen - Cargo Portal Theme
   ═══════════════════════════════════════════════════════════ */

.page-loader {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(145deg, #0a1628 0%, #132743 40%, #1a3558 70%, #0d2137 100%);
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    transition: opacity 0.6s ease;
}

/* ── Background Image (from WhiteLabeling) ── */
.loader-bg-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

/* ── Background Video (from WhiteLabeling, above image) ── */
.loader-bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* ── Gradient overlay on top of media, below content ── */
.loader-bg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, rgba(10, 22, 40, 0.85) 0%, rgba(19, 39, 67, 0.8) 40%, rgba(26, 53, 88, 0.75) 70%, rgba(13, 33, 55, 0.85) 100%);
    z-index: 0;
}

.page-loader.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* ── Background Decorations ── */
.page-loader::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 80%, rgba(14, 165, 233, 0.04) 0%, transparent 40%);
    animation: bgShift 8s ease-in-out infinite;
}

@keyframes bgShift {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-2%, -1%); }
}

/* ── Logo ── */
.loader-logo {
    position: relative;
    z-index: 1;
    width: 300px;
    height: 150px;
    margin-bottom: 24px;
    animation: logoFloat 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 20px rgba(59, 130, 246, 0.3));
}

.loader-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

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

/* ── App Name ── */
.loader-app-name {
    position: relative;
    z-index: 1;
    font-size: 1.5rem;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.loader-tagline {
    position: relative;
    z-index: 1;
    font-size: 0.8rem;
    font-weight: 400;
    color: #64748b;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 40px;
}

/* ── Progress Container ── */
.loader-progress-wrap {
    position: relative;
    z-index: 1;
    width: 280px;
    margin-bottom: 16px;
}

.loader-progress-track {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.loader-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #0ea5e9, #3b82f6);
    background-size: 200% 100%;
    border-radius: 4px;
    width: 0%;
    transition: width 0.5s ease;
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Progress Percentage ── */
.loader-progress-text {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.loader-percent {
    font-size: 0.85rem;
    font-weight: 600;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
}

.loader-status {
    font-size: 0.75rem;
    color: #475569;
}

/* ── Loading Steps ── */
.loader-steps {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 8px;
    margin-top: 32px;
}

.loader-step {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.loader-step.active {
    background: #3b82f6;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.loader-step.done {
    background: #0ea5e9;
}

/* ── Cargo Wave Animation (bottom decoration) ── */
.loader-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    z-index: 0;
    opacity: 0.15;
}

.loader-wave svg {
    width: 100%;
    height: 100%;
}

.loader-wave path {
    fill: #3b82f6;
    animation: wave 6s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { d: path('M0,40 C150,20 350,60 500,40 C650,20 850,50 1000,35 L1000,60 L0,60 Z'); }
    50% { d: path('M0,35 C150,50 350,20 500,45 C650,30 850,55 1000,40 L1000,60 L0,60 Z'); }
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .loader-logo {
        width: 56px;
        height: 56px;
    }
    .loader-app-name {
        font-size: 1.25rem;
    }
    .loader-progress-wrap {
        width: 220px;
    }
}

/* ── Hide when app loaded ── */
#ApplicationContainer > .page-loader:not(:only-child) {
    display: none !important;
}
