/* ── Terminal container ─────────────────────────────────────── */
#terminal {
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
    font-family: "Cascadia Code", "Fira Code", "Consolas", "Courier New", monospace;
    font-size: 13px;
    position: relative;
    overflow: hidden;
}

/* Subtle CRT scanline overlay */
#terminal::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    pointer-events: none;
    z-index: 1;
}

/* ── Output area ───────────────────────────────────────────── */
#terminal-output {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px 4px 10px;
    scroll-behavior: smooth;
}

#terminal-output::-webkit-scrollbar {
    width: 6px;
}

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

#terminal-output::-webkit-scrollbar-thumb {
    background: rgba(76, 175, 80, 0.25);
    border-radius: 3px;
}

#terminal-output::-webkit-scrollbar-thumb:hover {
    background: rgba(76, 175, 80, 0.45);
}

/* ── Output lines ──────────────────────────────────────────── */
.terminal-line {
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.5;
    color: #d4d4d4;
    padding: 0 4px;
    border-radius: 2px;
}

/* Subtle alternating row tint */
.terminal-line:nth-child(even) {
    background: rgba(255, 255, 255, 0.012);
}

/* Selection color */
.terminal-line::selection,
.terminal-line *::selection {
    background: rgba(76, 175, 80, 0.35);
    color: #fff;
}

.terminal-line.system {
    color: #4fc3f7;
}

.terminal-line.error {
    color: #f44336;
}

.terminal-line.info {
    color: #e0e0e0;
}

.terminal-line.warning {
    color: #ffb74d;
}

.terminal-line.success {
    color: #4caf50;
}

.terminal-line.input-echo {
    color: #555;
    border-left: 2px solid #333;
    padding-left: 6px;
    margin-top: 2px;
}

/* ── Input line ────────────────────────────────────────────── */
#terminal-input-line {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 4px 10px 2px 10px;
    border-top: 1px solid rgba(76, 175, 80, 0.1);
    position: relative;
}

#terminal-prompt {
    color: #4caf50;
    white-space: nowrap;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(76, 175, 80, 0.3);
}

#terminal-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #4caf50;
    font-family: inherit;
    font-size: inherit;
    caret-color: #4caf50;
    text-shadow: 0 0 4px rgba(76, 175, 80, 0.2);
    position: relative;
    z-index: 1;
}

/* Ghost autocomplete hint behind the real input */
#terminal-hint {
    position: absolute;
    left: 0;
    top: 0;
    color: #2a5e2d;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    pointer-events: none;
    white-space: pre;
    z-index: 0;
    height: 100%;
    display: flex;
    align-items: center;
}

/* ── Status bar ────────────────────────────────────────────── */
#terminal-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 10px;
    font-size: 11px;
    color: #444;
    background: #0e0e0e;
    border-top: 1px solid #1a1a1a;
    flex-shrink: 0;
    user-select: none;
}

#terminal-status span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

#terminal-status .status-label {
    color: #333;
}

#terminal-status .status-value {
    color: #555;
}

/* ── Copied toast ──────────────────────────────────────────── */
.terminal-copied-toast {
    position: absolute;
    right: 14px;
    top: 40px;
    background: rgba(76, 175, 80, 0.9);
    color: #000;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    z-index: 10;
    pointer-events: none;
    animation: term-toast-fade 1.2s ease-out forwards;
}

@keyframes term-toast-fade {
    0%   { opacity: 1; transform: translateY(0); }
    70%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-8px); }
}
