/* Modern Noir - Retro Recreated */
:root {
    --bg-color: #050505;
    --fg-color: #ffffff;
    --dim-color: #888888;
    --border-color: #ffffff;
    --scanline-color: rgba(255, 255, 255, 0.05);
    --glow-spread: 0 0 10px rgba(255, 255, 255, 0.5);
    /* Added Consolas/Monaco for offline support */
    --font-stack: 'Share Tech Mono', 'Consolas', 'Monaco', 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace;
}

body {
    margin: 0;
    padding: 0;
    background-color: #000;
    color: var(--fg-color);
    font-family: var(--font-stack);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Main Container - The "Device" */
.crt-container {
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    border: 2px solid var(--border-color);
    position: relative;
    background-color: var(--bg-color);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header / Status Bar */
.status-bar {
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: bold;
    background: #000;
    z-index: 10;
}

.logo {
    font-size: 1.5rem;
    text-shadow: var(--glow-spread);
}

.status-indicators {
    font-size: 0.9rem;
    color: var(--dim-color);
}

/* Screen Wrapper */
.screen-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 1rem;
    overflow: hidden;
}

/* Chat Area */
.terminal-output {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    font-size: 1.1rem;
    line-height: 1.6;
    scroll-behavior: smooth;
    /* Custom Scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--fg-color) var(--bg-color);
}

.terminal-output::-webkit-scrollbar {
    width: 8px;
}

.terminal-output::-webkit-scrollbar-thumb {
    background: var(--fg-color);
    border-radius: 0;
}

/* Messages */
.msg-line {
    margin-bottom: 0.8rem;
    animation: fadeIn 0.3s ease-out;
    border-left: 2px solid transparent;
    padding-left: 10px;
    transition: all 0.2s;
}

.msg-line:hover {
    border-left-color: var(--fg-color);
    background: rgba(255, 255, 255, 0.03);
}

.msg-timestamp {
    color: var(--dim-color);
    font-size: 0.9em;
    margin-right: 10px;
}

.msg-sender {
    font-weight: bold;
    margin-right: 5px;
    color: var(--fg-color);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}

.system-msg {
    color: var(--dim-color);
    font-style: italic;
    border: 1px dashed var(--dim-color);
    padding: 5px 10px;
    display: inline-block;
}

/* Input Area */
.input-line {
    border-top: 2px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    background: #000;
    position: relative;
    z-index: 10;
}

.prompt {
    font-size: 1.5rem;
    margin-right: 15px;
    animation: pulse 2s infinite;
}

#message-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--fg-color);
    font-family: var(--font-stack);
    font-size: 1.2rem;
    outline: none;
    caret-color: var(--fg-color);
}

/* CRT Effects Implementation */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
            var(--scanline-color) 50%,
            transparent 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 5;
    opacity: 0.3;
}

.glow-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 100px rgba(255, 255, 255, 0.1);
    pointer-events: none;
    z-index: 6;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}


/* Responsive */
@media (max-width: 768px) {
    body {
        /* Fix for mobile keyboard pushing content up */
        height: 100dvh;
        min-height: -webkit-fill-available;
    }

    .crt-container {
        width: 100%;
        height: 100dvh;
        height: -webkit-fill-available;
        border: none;
        max-width: none;
        /* Ensure flex column works properly on mobile */
        display: flex;
        flex-direction: column;
    }

    .screen-wrapper {
        /* Ensure this takes up remaining space properly */
        flex: 1 1 auto;
        min-height: 0;
        /* Crucial for nested flex scrolling */
    }

    .status-bar {

        .status-bar {
            padding: 0.8rem;
            font-size: 0.8rem;
        }

        .logo {
            font-size: 1.2rem;
        }

        .status-indicators {
            display: none;
            /* Hide on very small screens to save space */
        }

        .terminal-output {
            font-size: 1rem;
            padding: 0.5rem;
        }

        .input-line {
            padding: 1rem;
        }

        .prompt {
            font-size: 1.2rem;
            margin-right: 10px;
        }

        #message-input {
            font-size: 1rem;
        }

        .suggestions {
            width: 90%;
            left: 5%;
            bottom: 70px;
        }
    }

    @media (max-width: 480px) {
        .status-bar {
            justify-content: center;
        }

        .status-indicators {
            display: none;
        }
    }