﻿/* ============================================================
   loading.css — Loading Page Overlay
   Sistem Informasi Absensi
   Selaras dengan tema carbon-dark + purple-blue accent di style.css
   ============================================================ */

/* ── Overlay utama ── */
#app-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0b0c10;
    transition: opacity 0.45s ease, visibility 0.45s ease;
    will-change: opacity;
}

/* State: tersembunyi */
#app-loading-overlay.loading-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ── Glowing ambient blobs ── */
#app-loading-overlay::before,
#app-loading-overlay::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(110px);
    pointer-events: none;
    animation: blobPulse 6s ease-in-out infinite alternate;
}
#app-loading-overlay::before {
    width: 320px; height: 320px;
    background: rgba(99, 102, 241, 0.12);
    top: 10%; left: 15%;
    animation-delay: 0s;
}
#app-loading-overlay::after {
    width: 280px; height: 280px;
    background: rgba(37, 99, 235, 0.10);
    bottom: 12%; right: 12%;
    animation-delay: 3s;
}
@keyframes blobPulse {
    from { transform: scale(1);   opacity: 0.7; }
    to   { transform: scale(1.2); opacity: 1;   }
}

/* ── Bungkus konten ── */
.loading-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    animation: contentFadeIn 0.6s ease both;
}
@keyframes contentFadeIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Logo wrapper ── */
.loading-logo-wrapper {
    position: relative;
    width: 88px; height: 88px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Spinner ring */
.loading-spinner-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #6366f1;
    border-right-color: #2563eb;
    animation: spinRing 1.4s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}
.loading-spinner-ring::after {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 1.5px solid transparent;
    border-bottom-color: rgba(139, 92, 246, 0.45);
    animation: spinRing 2.1s linear infinite reverse;
}
@keyframes spinRing {
    to { transform: rotate(360deg); }
}

/* Logo circle */
.loading-logo-circle {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06),
                0 0 24px rgba(99, 102, 241, 0.5),
                0 0 48px rgba(37, 99, 235, 0.2);
    animation: logoPulse 2.8s ease-in-out infinite;
}
@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 0 24px rgba(99,102,241,0.5),  0 0 48px rgba(37,99,235,0.2); }
    50%       { box-shadow: 0 0 0 1px rgba(255,255,255,0.09), 0 0 36px rgba(99,102,241,0.75), 0 0 64px rgba(37,99,235,0.35); }
}
.loading-logo-circle i { font-size: 26px; color: #ffffff; }

/* ── Teks ── */
.loading-app-name {
    font-family: 'Outfit', sans-serif;
    font-size: 22px; font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    text-align: center;
}
.loading-app-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 13px; font-weight: 400;
    color: #54575f;
    text-align: center;
    margin-bottom: 36px;
}

/* ── Progress bar ── */
.loading-progress-track {
    width: 180px; height: 3px;
    background: rgba(255,255,255,0.06);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 20px;
}
.loading-progress-bar {
    height: 100%; width: 0%;
    border-radius: 99px;
    background: linear-gradient(90deg, #2563eb, #6366f1, #8b5cf6);
    background-size: 200% 100%;
    animation: progressSlide 2s ease-out forwards, gradientShift 1.5s linear infinite;
}
@keyframes progressSlide {
    0%   { width: 0%;  }
    40%  { width: 55%; }
    70%  { width: 75%; }
    90%  { width: 88%; }
    100% { width: 95%; }
}
@keyframes gradientShift {
    0%   { background-position: 200% 0;  }
    100% { background-position: -200% 0; }
}

/* ── Status text ── */
.loading-status-text {
    font-family: 'Inter', sans-serif;
    font-size: 12px; color: #54575f;
    letter-spacing: 0.4px;
    animation: textBlink 2s ease-in-out infinite;
    text-align: center;
}
@keyframes textBlink {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 1; }
}

/* ── Error box ── */
.loading-error-box {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 24px;
    padding: 20px 28px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 14px;
    max-width: 300px;
    text-align: center;
    animation: contentFadeIn 0.4s ease both;
}
.loading-error-box.show { display: flex; }
.loading-error-icon { font-size: 28px; color: #ef4444; }
.loading-error-title { font-family: 'Outfit', sans-serif; font-size: 15px; font-weight: 600; color: #fca5a5; }
.loading-error-msg  { font-family: 'Inter', sans-serif; font-size: 12px; color: #8a8f98; line-height: 1.5; }
.loading-retry-btn {
    padding: 9px 22px;
    background: linear-gradient(135deg, #2563eb, #6366f1);
    color: white; border: none; border-radius: 8px;
    font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
}
.loading-retry-btn:hover  { opacity: 0.88; transform: translateY(-1px); }
.loading-retry-btn:active { transform: translateY(0); }

/* ── Footer ── */
.loading-footer {
    position: absolute; bottom: 24px; left: 0; right: 0;
    text-align: center;
    font-family: 'Inter', sans-serif; font-size: 11px; color: #2d2f35;
    z-index: 2;
}

/* ── reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner-ring, .loading-spinner-ring::after,
    .loading-logo-circle, .loading-progress-bar,
    .loading-status-text,
    #app-loading-overlay::before, #app-loading-overlay::after {
        animation: none !important;
    }
    .loading-progress-bar { width: 88%; background: linear-gradient(90deg, #2563eb, #6366f1); }
    #app-loading-overlay  { transition: opacity 0.2s ease, visibility 0.2s ease; }
}

/* ── Mobile ── */
@media (max-width: 480px) {
    .loading-logo-wrapper   { width: 76px; height: 76px; }
    .loading-logo-circle    { width: 52px; height: 52px; }
    .loading-logo-circle i  { font-size: 22px; }
    .loading-app-name       { font-size: 19px; }
    .loading-progress-track { width: 150px; }
}
