/* =============================================================
   terminal.css — Vexyl-OS Terminal / CRT Interface Styles
   ============================================================= */

/* ── Terminal Overlay ──────────────────────────────────────── */
#terminal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 500;
    flex-direction: column;
    font-family: 'Courier New', Courier, monospace;
    color: #00FF00;
    overflow: hidden;
}

#terminal-overlay.active {
    display: flex;
}

/* ── CRT Screen Effect ─────────────────────────────────────── */
#terminal-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    /* Scanlines via repeating linear-gradient */
    background: repeating-linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.07) 0px,
        rgba(0, 0, 0, 0.07) 1px,
        transparent        1px,
        transparent        3px
    );
    pointer-events: none;
    z-index: 10;
}

/* Phosphor glow vignette */
#terminal-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 60%,
        rgba(0, 0, 0, 0.6) 100%
    );
    pointer-events: none;
    z-index: 11;
}

/* ── Terminal Header Bar ───────────────────────────────────── */
#terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    background: #001100;
    border-bottom: 1px solid #00FF00;
    font-size: 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
}

#terminal-header .term-title {
    color: #00FF00;
    letter-spacing: 2px;
    text-transform: uppercase;
}

#terminal-header .term-status {
    color: #008800;
    font-size: 11px;
}

/* Close button — Win 3.1 style gray button in terminal header */
#terminal-close {
    background: #C0C0C0;
    border-top:    2px solid #FFFFFF;
    border-left:   2px solid #FFFFFF;
    border-bottom: 2px solid #404040;
    border-right:  2px solid #404040;
    color: #000000;
    font-weight: bold;
    font-size: 10px;
    padding: 1px 6px;
    cursor: pointer;
    line-height: 1;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
}

#terminal-close:hover {
    background: #D0D0D0;
}

#terminal-close:active {
    border-top:    2px solid #404040;
    border-left:   2px solid #404040;
    border-bottom: 2px solid #FFFFFF;
    border-right:  2px solid #FFFFFF;
}

/* ── Terminal Output ───────────────────────────────────────── */
#terminal-output {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    position: relative;
    z-index: 20;
    /* Green phosphor glow on text */
    text-shadow: 0 0 4px rgba(0, 255, 0, 0.6);
}

/* Individual output lines */
.term-line {
    display: block;
    animation: term-appear 0.05s ease-out;
}

.term-line.error {
    color: #FF4444;
    text-shadow: 0 0 4px rgba(255, 68, 68, 0.6);
}

.term-line.system {
    color: #FFFF00;
    text-shadow: 0 0 4px rgba(255, 255, 0, 0.5);
}

.term-line.retrobot {
    color: #00DDDD;
    text-shadow: 0 0 4px rgba(0, 221, 221, 0.6);
}

.term-line.lore {
    color: #AAFFAA;
    text-shadow: 0 0 6px rgba(170, 255, 170, 0.5);
}

.term-line.ghost-hint {
    color: #004400;
    opacity: 0.7;
    font-style: italic;
}

@keyframes term-appear {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Terminal Input Row ────────────────────────────────────── */
#terminal-input-row {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    background: #000800;
    border-top: 1px solid #004400;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
}

#terminal-prompt {
    color: #00FF00;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.8);
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #00FF00;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    caret-color: #00FF00;
    text-shadow: 0 0 4px rgba(0, 255, 0, 0.6);
}

/* Block cursor via caret-shape (where supported) or blinking underline fallback */
#terminal-input::placeholder {
    color: #003300;
}

/* ── CRT Flicker Animation ─────────────────────────────────── */
@keyframes crt-flicker {
    0%   { opacity: 1; }
    95%  { opacity: 1; }
    96%  { opacity: 0.85; }
    97%  { opacity: 1; }
    100% { opacity: 1; }
}

#terminal-overlay.active {
    animation: crt-flicker 8s infinite;
}

/* ── Ghost Typing Cursor ───────────────────────────────────── */
#ghost-cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: #00FF00;
    margin-left: 2px;
    vertical-align: middle;
    animation: blink-cursor 1s step-end infinite;
    opacity: 0.6;
}

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

/* ── Scrollbar for Terminal ────────────────────────────────── */
#terminal-output::-webkit-scrollbar {
    width: 4px;
}

#terminal-output::-webkit-scrollbar-track {
    background: #000;
}

#terminal-output::-webkit-scrollbar-thumb {
    background: #003300;
}

#terminal-output::-webkit-scrollbar-thumb:hover {
    background: #00FF00;
}

/* ── Terminal Boot Sequence Lines ──────────────────────────── */
.boot-line {
    color: #008800;
    font-size: 12px;
}

.boot-line.ok::after {
    content: '  [OK]';
    color: #00FF00;
}

.boot-line.fail::after {
    content: '  [FAIL]';
    color: #FF4444;
}

.boot-line.warn::after {
    content: '  [WARN]';
    color: #FFFF00;
}

/* ── Terminal close / minimize controls ───────────────────── */
#terminal-controls {
    display: none;
}

/* ── Mobile: larger input area for touch ──────────────────── */
@media (max-width: 768px) {
    #terminal-input-row {
        padding: 10px 12px;
    }
    #terminal-input {
        font-size: 16px; /* prevent iOS zoom on focus */
        min-height: 36px;
    }
    #terminal-prompt {
        font-size: 16px;
    }
}
