/* NEXUS Terminal Simulator - Realistic Linux Terminal */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Ubuntu:wght@400;500;700&display=swap');

:root {
    /* Terminal Colors - More authentic */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #666666;
    
    /* Terminal Accents - More realistic */
    --accent-green: #00ff41;
    --accent-red: #ff0040;
    --accent-yellow: #ffff00;
    --accent-blue: #0080ff;
    --accent-cyan: #00ffff;
    --accent-magenta: #ff00ff;
    --accent-orange: #ff8000;
    
    /* Terminal Effects */
    --glow-green: 0 0 8px rgba(0, 255, 65, 0.4);
    --glow-red: 0 0 8px rgba(255, 0, 64, 0.4);
    --glow-blue: 0 0 8px rgba(0, 128, 255, 0.4);
    --glow-cyan: 0 0 8px rgba(0, 255, 255, 0.4);
    
    /* Terminal specific */
    --cursor-color: #00ff41;
    --selection-bg: rgba(0, 255, 65, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'JetBrains Mono', 'Ubuntu Mono', 'Courier New', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    line-height: 1.2;
    font-size: 13px;
    height: 100vh;
    width: 100vw;
    cursor: text;
}

/* Terminal Container */
.terminal-container {
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Terminal Header - More realistic */
.terminal-header {
    background: linear-gradient(180deg, #2d2d2d 0%, #1a1a1a 100%);
    border-bottom: 1px solid #444;
    padding: 3px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 26px;
    flex-shrink: 0;
    min-height: 26px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.terminal-title {
    font-family: 'Ubuntu', sans-serif;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.terminal-controls {
    display: flex;
    gap: 6px;
}

.terminal-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

.terminal-btn.close { 
    background: linear-gradient(135deg, #ff5f56 0%, #e0443e 100%);
    border-color: #c31e1a;
}
.terminal-btn.minimize { 
    background: linear-gradient(135deg, #ffbd2e 0%, #e6a823 100%);
    border-color: #c19b1a;
}
.terminal-btn.maximize { 
    background: linear-gradient(135deg, #27ca3f 0%, #1f9d35 100%);
    border-color: #1a7a2a;
}

.terminal-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

/* Terminal Content */
.terminal-content {
    flex: 1;
    padding: 10px 15px;
    overflow-y: auto;
    overflow-x: hidden;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.3;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: calc(100vh - 76px);
    scrollbar-width: thin;
    scrollbar-color: var(--bg-tertiary) var(--bg-primary);
    background: var(--bg-primary);
    position: relative;
}

/* Custom scrollbar for webkit browsers */
.terminal-content::-webkit-scrollbar {
    width: 10px;
}

.terminal-content::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-left: 1px solid #333;
}

.terminal-content::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
    border: 1px solid #444;
}

.terminal-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.terminal-output {
    color: var(--text-primary);
    margin: 1px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.1);
}

.terminal-error {
    color: var(--accent-red);
    text-shadow: 0 0 3px rgba(255, 0, 64, 0.3);
}

.terminal-success {
    color: var(--accent-green);
    text-shadow: 0 0 3px rgba(0, 255, 65, 0.3);
}

.terminal-info {
    color: var(--accent-blue);
    text-shadow: 0 0 3px rgba(0, 128, 255, 0.3);
}

.terminal-warning {
    color: var(--accent-yellow);
    text-shadow: 0 0 3px rgba(255, 255, 0, 0.3);
}

/* Terminal Command Line at Bottom */
.terminal-command-line {
    background: var(--bg-primary);
    border-top: 1px solid #333;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-height: 34px;
    max-height: 34px;
    position: relative;
    z-index: 10;
    box-shadow: none;
    margin-top: 4px;
    /* Make it feel more integrated */
    border-radius: 0;
    background: var(--bg-primary);
}

.terminal-command-line::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--accent-green) 50%, transparent 100%);
    opacity: 0.5;
    box-shadow: 0 0 4px rgba(0, 255, 65, 0.3);
}

.terminal-input {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 18px;
}

.terminal-input-prompt {
    color: var(--accent-green);
    font-weight: bold;
    margin-right: 10px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    flex-shrink: 0;
    text-shadow: 0 0 3px rgba(0, 255, 65, 0.3);
    position: relative;
}

.terminal-input-prompt::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 1px;
    background: var(--accent-green);
    opacity: 0.5;
}

.terminal-input-field {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    outline: none;
    flex: 1;
    caret-color: var(--cursor-color);
}

.terminal-input-field::placeholder {
    color: var(--text-muted);
}

.terminal-input-display {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    outline: none;
    flex: 1;
    caret-color: var(--cursor-color);
    min-height: 18px;
    max-height: 20px;
    padding: 2px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    resize: none;
    position: relative;
    border-left: 1px solid transparent;
    transition: all 0.2s ease;
    border-radius: 0;
}

.terminal-input-display:focus {
    border-left-color: var(--accent-green);
    outline: none;
    background: rgba(0, 255, 65, 0.05);
    box-shadow: inset 0 0 0 1px rgba(0, 255, 65, 0.1);
}



/* Realistic cursor - only show when focused */
.terminal-input-display:focus::after {
    content: '';
    position: absolute;
    right: -2px;
    top: 2px;
    width: 2px;
    height: 14px;
    background: var(--cursor-color);
    animation: cursor-blink 1s infinite;
    box-shadow: 0 0 4px var(--cursor-color);
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Terminal Commands */
.terminal-command {
    color: var(--accent-cyan);
    font-weight: bold;
    text-shadow: 0 0 3px rgba(0, 255, 255, 0.3);
}

.terminal-command::before {
    content: '$ ';
    color: var(--accent-green);
}

/* Terminal ASCII Art */
.terminal-ascii {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    color: var(--accent-magenta);
    font-size: 10px;
    line-height: 1.1;
    margin: 10px 0;
    text-align: center;
    white-space: pre;
    text-shadow: 0 0 5px rgba(255, 0, 255, 0.5);
}

/* Terminal Progress */
.terminal-progress {
    margin: 8px 0;
}

.terminal-progress-bar {
    width: 100%;
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin: 4px 0;
    border: 1px solid #444;
}

.terminal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green) 0%, #00cc33 100%);
    transition: width 0.3s ease;
    box-shadow: 0 0 5px rgba(0, 255, 65, 0.5);
}

/* Terminal Menu */
.terminal-menu {
    background: var(--bg-secondary);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 8px;
    margin: 6px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.terminal-menu-title {
    color: var(--accent-blue);
    font-weight: bold;
    margin-bottom: 6px;
    border-bottom: 1px solid #444;
    padding-bottom: 4px;
    font-size: 12px;
    text-shadow: 0 0 3px rgba(0, 128, 255, 0.3);
}

.terminal-menu-item {
    color: var(--text-primary);
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    border-radius: 2px;
    margin: 1px 0;
}

.terminal-menu-item:hover {
    color: var(--accent-green);
    background: rgba(0, 255, 65, 0.1);
    text-shadow: 0 0 3px rgba(0, 255, 65, 0.3);
}

.terminal-menu-item.active {
    color: var(--accent-green);
    font-weight: bold;
    background: rgba(0, 255, 65, 0.15);
    text-shadow: 0 0 3px rgba(0, 255, 65, 0.5);
}

.terminal-menu-item.completed {
    color: var(--accent-cyan);
    text-shadow: 0 0 3px rgba(0, 255, 255, 0.3);
}

.terminal-menu-item.locked {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Terminal Status */
.terminal-status {
    background: var(--bg-secondary);
    border-top: 1px solid #444;
    padding: 3px 10px;
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    height: 20px;
    flex-shrink: 0;
    min-height: 20px;
    box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.3);
}

/* Terminal Cursor Blink */
.terminal-cursor {
    animation: blink 1s infinite;
    color: var(--cursor-color);
    text-shadow: 0 0 4px var(--cursor-color);
}

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

/* Terminal Typing Effect */
.terminal-typing {
    overflow: hidden;
    border-right: 2px solid var(--accent-green);
    white-space: nowrap;
    animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent-green); }
}

/* Selection styling */
::selection {
    background: var(--selection-bg);
    color: var(--text-primary);
}

::-moz-selection {
    background: var(--selection-bg);
    color: var(--text-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .terminal-content {
        padding: 8px 12px;
        font-size: 11px;
        max-height: calc(100vh - 70px);
    }
    
    .terminal-header {
        height: 24px;
        padding: 3px 8px;
    }
    
    .terminal-title {
        font-size: 10px;
    }
    
    .terminal-command-line {
        padding: 4px 12px;
        height: 32px;
    }
    
    .terminal-input-prompt {
        font-size: 11px;
    }
    
    .terminal-input-field {
        font-size: 11px;
    }
    
    .terminal-ascii {
        font-size: 8px;
    }
}

/* Hidden elements */
.hidden {
    display: none;
}

/* Terminal Image Display */
.terminal-image-container {
    text-align: center;
    margin: 8px 0;
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid #444;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.terminal-image {
    max-width: 200px;
    max-height: 200px;
    border: 1px solid #555;
    border-radius: 2px;
    display: block !important;
    margin: 0 auto;
    visibility: visible !important;
    opacity: 1 !important;
}

.terminal-image:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--glow-blue);
}

/* Image Overlay */
.image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.image-overlay-content {
    background: var(--bg-secondary);
    border: 1px solid #444;
    border-radius: 6px;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.image-overlay-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid #444;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 6px 6px 0 0;
}

.image-overlay-title {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
}

.image-overlay-close {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.image-overlay-close:hover {
    color: var(--accent-red);
    background: rgba(255, 0, 64, 0.1);
    text-shadow: 0 0 5px rgba(255, 0, 64, 0.5);
}

.image-overlay-body {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.overlay-image {
    max-width: 100%;
    max-height: 100%;
    border: 1px solid #555;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Terminal startup animation */
.terminal-startup {
    animation: terminal-boot 2s ease-out;
}

@keyframes terminal-boot {
    0% { opacity: 0; transform: scale(0.95); }
    50% { opacity: 0.5; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1); }
}

/* Glitch effect for errors */
.terminal-glitch {
    animation: glitch 0.3s ease-in-out;
}

@keyframes glitch {
    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); }
}

/* CRT scan line effect */
.terminal-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        transparent 50%,
        rgba(0, 0, 0, 0.1) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 1;
    animation: scan-lines 0.1s linear infinite;
}

@keyframes scan-lines {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* Terminal flicker effect */
.terminal-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 255, 65, 0.02);
    pointer-events: none;
    z-index: 2;
    animation: terminal-flicker 0.15s ease-in-out infinite;
}

@keyframes terminal-flicker {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}



/* Command execution feedback */
.terminal-command-executing {
    color: var(--accent-yellow);
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Error shake effect */
.terminal-error-shake {
    animation: error-shake 0.5s ease-in-out;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
} 