/* Reset & Font Setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #07050f;
    color: #00ffaa;
    font-family: 'Fira Code', monospace;
    font-size: 16px;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Cyberpunk Neon Glow BG */
.glow-effect {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(138, 43, 226, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

/* CRT Screen Effect Scanlines & Flicker */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
    z-index: 999;
}

.crt-overlay::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 999;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% { opacity: 0.27861; }
    5% { opacity: 0.34769; }
    10% { opacity: 0.23604; }
    15% { opacity: 0.10626; }
    20% { opacity: 0.18128; }
    25% { opacity: 0.35277; }
    30% { opacity: 0.29437; }
    35% { opacity: 0.1187; }
    40% { opacity: 0.16035; }
    45% { opacity: 0.31688; }
    50% { opacity: 0.22983; }
    55% { opacity: 0.2847; }
    60% { opacity: 0.17937; }
    65% { opacity: 0.19835; }
    70% { opacity: 0.3124; }
    75% { opacity: 0.14859; }
    80% { opacity: 0.12858; }
    85% { opacity: 0.38038; }
    90% { opacity: 0.34618; }
    95% { opacity: 0.15053; }
    100% { opacity: 0.303; }
}

/* Terminal Container (Glassmorphism) */
.terminal-container {
    width: 90%;
    max-width: 900px;
    height: 75vh;
    background: rgba(12, 9, 21, 0.75);
    border: 1px solid rgba(0, 255, 170, 0.25);
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 255, 170, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow: hidden;
}

/* Terminal Header */
.terminal-header {
    height: 40px;
    background: rgba(20, 15, 36, 0.9);
    border-bottom: 1px solid rgba(0, 255, 170, 0.15);
    display: flex;
    align-items: center;
    padding: 0 15px;
    position: relative;
}

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

.btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.btn.close { background-color: #ff5f56; }
.btn.minimize { background-color: #ffbd2e; }
.btn.expand { background-color: #27c93f; }

.terminal-title {
    position: absolute;
    width: 100%;
    text-align: center;
    color: rgba(0, 255, 170, 0.6);
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
    left: 0;
}

/* Terminal Body */
.terminal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.terminal-body::-webkit-scrollbar {
    width: 8px;
}

.terminal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.terminal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 170, 0.2);
    border-radius: 4px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 170, 0.4);
}

/* Text Lines */
.output-line {
    margin-bottom: 8px;
    line-height: 1.5;
    word-break: break-all;
}

.system-msg {
    color: #8b2bef;
    font-weight: 300;
}

.user-cmd {
    color: #00f0ff;
}

.response-msg {
    color: #e2e1e6;
    margin-bottom: 15px;
}

.prompt {
    color: #00f0ff;
    margin-right: 10px;
    font-weight: bold;
    user-select: none;
}

/* Interactive Input Line */
.input-line {
    display: flex;
    align-items: center;
    margin-top: auto;
}

.input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.visible-input {
    color: #00ffaa;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Hidden input to capture keystrokes */
#hiddenInput {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: default;
    border: none;
    outline: none;
    background: transparent;
}

/* Blinking Terminal Cursor */
.cursor {
    display: inline-block;
    width: 10px;
    height: 20px;
    background-color: #00ffaa;
    box-shadow: 0 0 8px #00ffaa;
    margin-left: 2px;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    from, to { background-color: transparent; box-shadow: none; }
    50% { background-color: #00ffaa; box-shadow: 0 0 8px #00ffaa; }
}

@keyframes pulse-border {
    from {
        border-color: rgba(0, 255, 170, 0.3);
        box-shadow: 0 0 8px rgba(0, 255, 170, 0.1);
    }
    to {
        border-color: rgba(0, 255, 170, 0.95);
        box-shadow: 0 0 18px rgba(0, 255, 170, 0.35);
    }
}
