
/* Modal Loading Styles */
.modal-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    backdrop-filter: blur(5px);
}

body.dark-mode .modal-loading {
    background: rgba(30, 30, 30, 0.95);
    color: #00ff00; /* Hacker green */
}

/* Reusable chart loader (non-modal) */
.chart-loader-wrapper {
    position: relative;
    width: 100%;
}

.chart-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: none; /* toggled by JS */
    justify-content: center;
    align-items: center;
    z-index: 15;
    backdrop-filter: blur(4px);
    pointer-events: none; /* allow interactions behind once hidden */
}

body.dark-mode .chart-loading-overlay {
    background: rgba(30, 30, 30, 0.92);
    color: #00ff00;
}

.nerd-loader {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-areas:
        "miner glitch"
        "miner msg";
    align-items: center;
    row-gap: 2px;
    justify-items: start;
    column-gap: 8px;
    width: fit-content;
    margin: 0 auto;
    font-family: 'Courier New', Courier, monospace;
}

.nerd-loader::before {
    content: "";
    grid-area: miner;
    width: 88px;
    height: 88px;
    background: url("/static/img/loader_miner.gif") no-repeat center / contain;
    image-rendering: pixelated;
    align-self: center;
    transform-origin: 50% 85%;
    animation: miner-idle 1.25s ease-in-out infinite;
}

.loading-msg {
    grid-area: msg;
    margin-top: 0;
    font-size: 1.1rem;
    color: #666;
    animation: blink 1s infinite;
    text-align: left;
}

body.dark-mode .loading-msg {
    color: #00ff00;
}

/* Glitch Effect */
.glitch-wrapper {
    grid-area: glitch;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
}

.glitch {
    position: relative;
    font-size: 3rem;
    font-weight: bold;
    color: #333;
    letter-spacing: 3px;
    z-index: 1;
}

body.dark-mode .glitch {
    color: #00ff00;
}

.glitch:before,
.glitch:after {
    display: block;
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.8;
}

.glitch:before {
    animation: glitch-it 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
    color: #e74c3c;
    z-index: -1;
}

.glitch:after {
    animation: glitch-it 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) reverse both infinite;
    color: #3498db;
    z-index: -2;
}

@media (max-width: 767px) {
    .nerd-loader {
        column-gap: 6px;
        row-gap: 2px;
    }

    .nerd-loader::before {
        width: 60px;
        height: 60px;
    }

    .glitch {
        font-size: 2rem;
        letter-spacing: 2px;
    }

    .loading-msg {
        font-size: 0.95rem;
    }
}

@keyframes glitch-it {
    0% { transform: translate(0) }
    20% { transform: translate(-2px, 2px) }
    40% { transform: translate(-2px, -2px) }
    60% { transform: translate(2px, 2px) }
    80% { transform: translate(2px, -2px) }
    100% { transform: translate(0) }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes miner-idle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}


