/* Terminal Matrix Loading - Universal */
.matrix-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    background: #000;
    border: 2px solid #0f0;
    border-radius: 8px;
    box-shadow: 
        0 0 50px rgba(0, 255, 0, 0.5),
        inset 0 0 30px rgba(0, 255, 0, 0.1),
        0 0 100px rgba(0, 255, 0, 0.2);
    z-index: 99999;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    animation: terminalBoot 0.5s ease-out;
}

@keyframes terminalBoot {
    0% {
        transform: translate(-50%, -50%) scale(0) rotateX(90deg);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1) rotateX(0);
    }
    100% {
        transform: translate(-50%, -50%) scale(1) rotateX(0);
        opacity: 1;
    }
}

.matrix-loader::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 255, 0, 0.03) 2px,
            rgba(0, 255, 0, 0.03) 4px
        );
    pointer-events: none;
    animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

.terminal-header {
    background: linear-gradient(90deg, #0a0a0a, #1a1a1a);
    padding: 8px 15px;
    border-bottom: 1px solid #0f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.terminal-button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 255, 0, 0.3);
}

.terminal-button.close {
    background: #ff5f56;
}

.terminal-button.minimize {
    background: #ffbd2e;
}

.terminal-button.maximize {
    background: #27c93f;
}

.terminal-title {
    flex: 1;
    text-align: center;
    color: #0f0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px #0f0;
}

.terminal-body {
    padding: 20px;
    min-height: 200px;
    background: rgba(0, 0, 0, 0.95);
    position: relative;
    overflow: hidden;
}

.matrix-loader.hiding {
    animation: terminalShutdown 0.4s ease-out forwards;
}

@keyframes terminalShutdown {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
        filter: brightness(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1, 0.01);
        filter: brightness(2);
    }
    100% {
        transform: translate(-50%, -50%) scale(0, 0);
        opacity: 0;
        visibility: hidden;
    }
}

.terminal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 99998;
    animation: overlayFade 0.3s ease-out;
}

.terminal-overlay.hiding {
    animation: overlayFadeOut 0.4s ease-out forwards;
}

@keyframes overlayFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes overlayFadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}

.terminal-prompt {
    color: #0f0;
    margin-bottom: 10px;
    font-size: 14px;
}

.terminal-prompt::before {
    content: 'sophia@lorebary:~$ ';
    color: #0f0;
    text-shadow: 0 0 5px #0f0;
}

.terminal-output {
    color: #0f0;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
}

.terminal-line {
    margin: 4px 0;
    opacity: 0;
    animation: typeIn 0.1s forwards;
}

@keyframes typeIn {
    to {
        opacity: 1;
    }
}

.terminal-cursor {
    display: inline-block;
    width: 10px;
    height: 20px;
    background: #0f0;
    animation: blink 1s infinite;
    vertical-align: text-bottom;
    margin-left: 2px;
}

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

.terminal-progress {
    margin: 20px 0;
    color: #0f0;
}

.terminal-progress-bar {
    width: 100%;
    height: 20px;
    border: 1px solid #0f0;
    background: #000;
    position: relative;
    overflow: hidden;
    margin: 10px 0;
}

.terminal-progress-fill {
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        #0f0 0px,
        #0f0 10px,
        #0a0 10px,
        #0a0 20px
    );
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px #0f0;
}

.terminal-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 11px;
    text-shadow: 0 0 5px #000;
    z-index: 1;
}

.matrix-loader-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 2rem;
}

.matrix-loader-text {
    font-family: 'Orbitron', 'Courier New', monospace;
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(45deg, #0f0, #0ff, #f0f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 255, 0, 0.8);
    margin-bottom: 2rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    animation: matrixTextGlitch 0.4s infinite;
    filter: drop-shadow(0 0 20px rgba(0, 255, 0, 0.5));
}

@keyframes matrixTextGlitch {
    0%, 100% { 
        transform: translate(0);
        filter: hue-rotate(0deg) drop-shadow(0 0 20px rgba(0, 255, 0, 0.5));
    }
    10% { 
        transform: translate(-2px, 2px);
        filter: hue-rotate(90deg) drop-shadow(0 0 30px rgba(255, 0, 255, 0.8));
    }
    20% { 
        transform: translate(2px, -2px);
        filter: hue-rotate(-90deg) drop-shadow(0 0 30px rgba(0, 255, 255, 0.8));
    }
    30% {
        transform: translate(-1px, 1px);
        filter: hue-rotate(180deg) drop-shadow(0 0 25px rgba(255, 255, 0, 0.8));
    }
}

.matrix-loader-bar {
    width: 400px;
    max-width: 90vw;
    height: 6px;
    background: linear-gradient(90deg, 
        rgba(0, 255, 0, 0.1),
        rgba(0, 255, 0, 0.05),
        rgba(0, 255, 0, 0.1)
    );
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: 
        0 0 20px rgba(0, 255, 0, 0.3),
        inset 0 0 10px rgba(0, 255, 0, 0.1);
}

.matrix-loader-progress {
    height: 100%;
    width: 200%;
    background: linear-gradient(90deg, 
        transparent,
        rgba(0, 255, 0, 0.3),
        #0f0,
        rgba(0, 255, 0, 0.3),
        transparent
    );
    animation: matrixScan 1.8s ease-in-out infinite;
    box-shadow: 0 0 15px #0f0;
}

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

.matrix-loader-status {
    margin-top: 2rem;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: rgba(0, 255, 0, 0.9);
    letter-spacing: 0.05em;
    animation: matrixBlink 0.6s infinite;
    text-transform: uppercase;
}

@keyframes matrixBlink {
    0%, 100% { 
        opacity: 1;
        text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
    }
    50% { 
        opacity: 0.6;
        text-shadow: 0 0 5px rgba(0, 255, 0, 0.4);
    }
}

.matrix-loader-binary {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: rgba(0, 255, 0, 0.4);
    letter-spacing: 0.3em;
    animation: matrixBinaryScroll 4s linear infinite;
    opacity: 0.6;
}

@keyframes matrixBinaryScroll {
    0% { 
        transform: translateX(-50%) translateY(0);
        opacity: 0.3;
    }
    50% {
        opacity: 0.6;
    }
    100% { 
        transform: translateX(-50%) translateY(-30px);
        opacity: 0.3;
    }
}

.matrix-logo-loader {
    width: 120px;
    height: 120px;
    margin-bottom: 2rem;
    position: relative;
    animation: matrixLogoFloat 3s ease-in-out infinite;
}

.matrix-logo-loader img {
    width: 100%;
    height: 100%;
    filter: 
        drop-shadow(0 0 30px #0f0)
        drop-shadow(0 0 60px #0f0)
        hue-rotate(120deg)
        brightness(1.5);
    animation: matrixLogoRotate 10s linear infinite;
}

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

@keyframes matrixLogoRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .matrix-loader {
        width: 95%;
        max-width: none;
        margin: 10px;
        transform: translate(-50%, -50%) scale(0.95);
    }
    
    .terminal-header {
        padding: 6px 10px;
    }
    
    .terminal-buttons {
        gap: 5px;
    }
    
    .terminal-button {
        width: 10px;
        height: 10px;
    }
    
    .terminal-title {
        font-size: 10px;
        letter-spacing: 1px;
    }
    
    .terminal-body {
        padding: 12px;
        min-height: 150px;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .terminal-prompt {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .terminal-prompt::before {
        content: 'sophia@lb:~$ ';
        font-size: 11px;
    }
    
    .terminal-output {
        font-size: 11px;
        line-height: 1.4;
        max-height: 200px;
        overflow-y: auto;
    }
    
    .terminal-line {
        margin: 2px 0;
        font-size: 11px;
    }
    
    .terminal-progress-bar {
        height: 16px;
        margin: 8px 0;
    }
    
    .terminal-progress-text {
        font-size: 10px;
    }
    
    .terminal-cursor {
        width: 6px;
        height: 12px;
    }
    
    /* Hide some lines on mobile to save space */
    .terminal-line:nth-child(n+8) {
        display: none;
    }
    
    @keyframes terminalBoot {
        0% {
            transform: translate(-50%, -50%) scale(0);
            opacity: 0;
        }
        100% {
            transform: translate(-50%, -50%) scale(0.95);
            opacity: 1;
        }
    }
}

@media (max-width: 480px) {
    .matrix-loader {
        width: 98%;
        border-radius: 4px;
        border-width: 1px;
    }
    
    .terminal-body {
        padding: 8px;
        min-height: 120px;
    }
    
    .terminal-output {
        max-height: 150px;
    }
    
    /* Show even fewer lines on very small screens */
    .terminal-line:nth-child(n+5) {
        display: none;
    }
    
    .terminal-progress {
        margin: 10px 0;
    }
}