/* ============================================
   CODE LOADER - Portfolio Loading Screen
   ============================================ */

.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #0a0a0a;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Terminal Window */
.loader-terminal {
    width: 90%;
    max-width: 500px;
    background: #1a1a2e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 20px 50px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(7, 115, 204, 0.2);
}

/* Terminal Header */
.terminal-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #16162a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.terminal-buttons {
    display: flex;
    gap: 8px;
}

.terminal-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-btn.red { background: #ff5f56; }
.terminal-btn.yellow { background: #ffbd2e; }
.terminal-btn.green { background: #27ca40; }

.terminal-title {
    flex: 1;
    text-align: center;
    font-family: var(--pixel-font, 'Courier New', monospace);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.1em;
}

/* Terminal Body */
.terminal-body {
    padding: 20px;
    min-height: 200px;
    font-family: var(--text-font, 'Space Mono', monospace);
    font-size: 0.85rem;
    line-height: 1.8;
}

/* Code Lines */
.code-line {
    display: flex;
    align-items: flex-start;
    opacity: 0;
    transform: translateY(10px);
    margin-bottom: 4px;
}

.code-line.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.line-number {
    color: rgba(255, 255, 255, 0.2);
    min-width: 30px;
    user-select: none;
}

.line-content {
    flex: 1;
}

/* Syntax Highlighting */
.keyword { color: #c678dd; }
.function { color: #61afef; }
.string { color: #98c379; }
.variable { color: #e5c07b; }
.comment { color: #5c6370; font-style: italic; }
.operator { color: #56b6c2; }
.number { color: #d19a66; }
.property { color: #e06c75; }

/* Cursor */
.cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: var(--blue, #0773CC);
    margin-left: 2px;
    animation: cursorBlink 1s step-start infinite;
    vertical-align: middle;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Progress Section */
.loader-progress {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-text {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-family: var(--pixel-font, 'Courier New', monospace);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.1em;
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--blue, #0773CC), var(--light-blue, #34b5ff));
    border-radius: 2px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: progressShine 1.5s ease-in-out infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Loading Status */
.loader-status {
    margin-top: 24px;
    text-align: center;
}

.status-text {
    font-family: var(--pixel-font, 'Courier New', monospace);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.status-text .dots {
    display: inline-block;
    width: 20px;
    text-align: left;
}

/* Glitch Effect on Complete */
.loader-overlay.complete .loader-terminal {
    animation: terminalGlitch 0.5s ease;
}

@keyframes terminalGlitch {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-2px, 1px); }
    20% { transform: translate(2px, -1px); }
    30% { transform: translate(-1px, 2px); }
    40% { transform: translate(1px, -2px); }
    50% { transform: translate(-2px, -1px); }
    60% { transform: translate(2px, 1px); }
    70% { transform: translate(0, -2px); }
    80% { transform: translate(-1px, 0); }
    90% { transform: translate(1px, 1px); }
}

/* Scanlines overlay */
.loader-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.1) 2px,
        rgba(0, 0, 0, 0.1) 4px
    );
    pointer-events: none;
    z-index: 1;
}

.loader-terminal {
    position: relative;
    z-index: 2;
}

/* Responsive */
@media (max-width: 600px) {
    .loader-terminal {
        width: 95%;
        max-width: none;
    }
    
    .terminal-body {
        padding: 15px;
        font-size: 0.75rem;
    }
    
    .loader-logo {
        font-size: 0.45rem;
    }
    
    .code-line {
        font-size: 0.7rem;
    }
}
