/* ========================================================================
   ADIP RMX — Dashboard Toggle Switch (adapted from toggleswitch.zip / slider-v1)
   + Two-stage loading overlay (Audio Waveform Equalizer)
   Non-destructive add-on. Scoped classes only, tidak mengubah style asli.
   ======================================================================== */

/* ---------- Toggle switch (dipakai di navbar lama & topbar baru) ---------- */
.dash-switch-wrap {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px; /* base scale — ubah nilai ini utk resize proporsional seluruh toggle */
    flex-shrink: 0;
}

.dash-switch-label {
    font-family: var(--font-primary, 'Inter', sans-serif);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.55);
    user-select: none;
    transition: color 0.25s ease;
    white-space: nowrap;
}

.dash-switch-input {
    position: absolute;
    left: -9999px;
}

.dash-switch-input:checked ~ .dash-switch-label-new,
.dash-switch-wrap:has(.dash-switch-input:not(:checked)) .dash-switch-label-old {
    color: #fff;
}

/* Fallback tanpa :has() — atur via JS class jika perlu, warna default tetap aman */

.dash-switch {
    position: relative;
    display: block;
    width: 5.5em;
    height: 3em;
    cursor: pointer;
    border-radius: 1.5em;
    transition: background 350ms ease;
    background: linear-gradient(rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0.02)), #2c2c2c;
    box-shadow:
        0 0.07em 0.1em -0.1em rgba(0, 0, 0, 0.5) inset,
        0 0.05em 0.08em -0.01em rgba(255, 255, 255, 0.12),
        0 0 0 1px rgba(255, 255, 255, 0.06);
}

.dash-switch::before {
    position: absolute;
    content: '';
    width: 2em;
    height: 2em;
    top: 0.5em;
    left: 0.5em;
    border-radius: 50%;
    transition: left 250ms ease-in-out, background 250ms ease-in-out;
    background: linear-gradient(#f5f5f5 10%, #e2e2e2);
    box-shadow:
        0 0.1em 0.15em -0.05em rgba(255, 255, 255, 0.9) inset,
        0 0.4em 0.3em -0.1em rgba(0, 0, 0, 0.35);
}

.dash-switch-input:checked + .dash-switch {
    background: linear-gradient(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.05)), #3ddc97;
}

.dash-switch-input:checked + .dash-switch::before {
    left: 3em;
}

.dash-switch-input:focus-visible + .dash-switch {
    outline: 2px solid rgba(61, 220, 151, 0.6);
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .dash-switch-wrap {
        font-size: 11px;
        gap: 4px;
    }
    .dash-switch-label {
        display: none;
    }
}

/* ---------- Two-stage loading overlay ---------- */
#loaderOverlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    background: radial-gradient(circle at 50% 40%, rgba(30, 30, 32, 0.97), rgba(4, 4, 5, 0.98));
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#loaderOverlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.loader-eq {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    height: 64px;
}

.loader-eq span {
    display: block;
    width: 6px;
    border-radius: 4px;
    background: linear-gradient(180deg, #ffffff, #3ddc97);
    animation: dashEqBounce 1.1s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(61, 220, 151, 0.35);
}

.loader-eq span:nth-child(1) { animation-delay: -1.05s; }
.loader-eq span:nth-child(2) { animation-delay: -0.85s; }
.loader-eq span:nth-child(3) { animation-delay: -0.65s; }
.loader-eq span:nth-child(4) { animation-delay: -0.45s; }
.loader-eq span:nth-child(5) { animation-delay: -0.25s; }

@keyframes dashEqBounce {
    0%, 100% { height: 10px; opacity: 0.65; }
    50% { height: 64px; opacity: 1; }
}

.loader-text {
    font-family: var(--font-primary, 'Inter', sans-serif);
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #f2f2f2;
    text-align: center;
    min-height: 20px;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.loader-text.dash-fade {
    opacity: 0;
}

@media (max-width: 480px) {
    .loader-eq { height: 48px; }
    .loader-text { font-size: 13px; padding: 0 24px; }
}
