/* ================================================================
   TERMINAL CORE STYLES
   Shared between Floating Widget and Full Page Terminal
   ================================================================ */

:root {
    --terminal-main: #00ff88;
    --terminal-bg: rgba(0, 0, 0, 0.3);
    --terminal-accent: #00d4ff;
    --terminal-error: #ff5f57;
    --terminal-warn: #febc2e;
    --terminal-success: #00ff88;
}

/* Base Terminal Text Styles */
.terminal-widget,
.terminal-window,
.terminal-page {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    color: var(--terminal-main);
}

.terminal-widget .line,
.terminal-output .line {
    margin-bottom: 6px;
    line-height: 1.4;
    font-size: 13px;
}

/* Terminal Line Entry Animation — fast flicker/print effect */
.line--animate {
    animation: terminal-line-in 0.15s ease-out forwards;
}

@keyframes terminal-line-in {
    0% {
        opacity: 0;
        transform: translateY(2px);
        filter: brightness(2.5);
    }

    60% {
        opacity: 1;
        filter: brightness(1.4);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
        filter: brightness(1);
    }
}

/* Utility Classes for Text Colors */
.success,
.terminal-widget .success,
.terminal-output .success {
    color: var(--terminal-success);
}

.error,
.terminal-widget .error,
.terminal-output .error {
    color: var(--terminal-error);
}

.warning,
.terminal-widget .warning,
.terminal-output .warning {
    color: var(--terminal-warn);
}

.info,
.terminal-widget .info,
.terminal-output .info {
    color: var(--terminal-accent);
}

.muted,
.terminal-widget .muted,
.terminal-output .muted {
    color: rgba(255, 255, 255, 0.5);
}

.prompt,
.terminal-widget .prompt,
.terminal-output .prompt {
    color: var(--terminal-accent);
    font-weight: bold;
    margin-right: 8px;
}

.command,
.terminal-widget .command,
.terminal-output .command {
    color: #fff;
    font-weight: bold;
}

/* ASCII Art */
.ascii-art,
.terminal-widget .ascii-art {
    font-size: 8px;
    line-height: 8px;
    color: var(--terminal-main);
    white-space: pre;
    margin-bottom: 15px;
    overflow-x: hidden;
    overflow-y: hidden;
}

/* Result Blocks */
.result-block,
.terminal-widget .result-block {
    background: rgba(0, 255, 136, 0.05);
    padding: 10px;
    border-left: 3px solid var(--terminal-main);
    margin-top: 5px;
    border-radius: 0 4px 4px 0;
}

.result-block.danger,
.terminal-widget .result-block.danger {
    border-left-color: var(--terminal-error);
    background: rgba(255, 95, 87, 0.05);
}

.result-block.warning,
.terminal-widget .result-block.warning {
    border-left-color: var(--terminal-warn);
    background: rgba(254, 188, 46, 0.05);
}

/* ── PREMIUM TERMINAL PANELS ── */
.terminal-panel {
    border: 1px solid rgba(0, 255, 136, 0.35);
    border-radius: 3px;
    margin: 6px 0;
    overflow: hidden;
}

.terminal-panel.danger {
    border-color: rgba(255, 95, 87, 0.45);
}

.terminal-panel.caution {
    border-color: rgba(254, 188, 46, 0.45);
}

.terminal-panel.info-panel {
    border-color: rgba(0, 212, 255, 0.45);
}

.terminal-panel-header {
    padding: 5px 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
    color: var(--terminal-main);
}

.terminal-panel.danger .terminal-panel-header {
    background: rgba(255, 95, 87, 0.07);
    border-bottom-color: rgba(255, 95, 87, 0.2);
    color: var(--terminal-error);
}

.terminal-panel.caution .terminal-panel-header {
    background: rgba(254, 188, 46, 0.07);
    border-bottom-color: rgba(254, 188, 46, 0.2);
    color: var(--terminal-warn);
}

.terminal-panel.info-panel .terminal-panel-header {
    background: rgba(0, 212, 255, 0.07);
    border-bottom-color: rgba(0, 212, 255, 0.2);
    color: var(--terminal-accent);
}

.terminal-panel-body {
    padding: 10px;
}

.terminal-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 12px;
}

.terminal-stat-row:last-child {
    border-bottom: none;
}

.terminal-stat-label {
    color: rgba(255, 255, 255, 0.4);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.terminal-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
}

.terminal-badge.pass {
    background: rgba(0, 255, 136, 0.12);
    color: var(--terminal-success);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.terminal-badge.fail {
    background: rgba(255, 95, 87, 0.12);
    color: var(--terminal-error);
    border: 1px solid rgba(255, 95, 87, 0.3);
}

.terminal-badge.warn-badge {
    background: rgba(254, 188, 46, 0.12);
    color: var(--terminal-warn);
    border: 1px solid rgba(254, 188, 46, 0.3);
}

/* Help Tables */
.help-table td,
.terminal-widget .help-table td {
    padding: 2px 5px;
    vertical-align: top;
}

.help-table .cmd,
.terminal-widget .help-table .cmd {
    color: #00d4ff;
    font-weight: bold;
}

.help-table .desc,
.terminal-widget .help-table .desc {
    color: rgba(255, 255, 255, 0.7);
}

/* Loading Animation */
.loading-dots:after {
    content: '.';
    animation: terminal-dots 1.5s steps(5, end) infinite;
}

@keyframes terminal-dots {

    0%,
    20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60% {
        content: '...';
    }

    80%,
    100% {
        content: '';
    }
}

/* Scrollbar Customization */
.terminal-body-scroll::-webkit-scrollbar,
.terminal-output::-webkit-scrollbar {
    width: 6px;
}

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

.terminal-body-scroll::-webkit-scrollbar-thumb,
.terminal-output::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 3px;
}

/* Floating Widget Specifics */
#terminal-widget-container {
    background: transparent;
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    width: 850px;
    height: 600px;
    max-width: 95vw;
    max-height: 85vh;
}

#terminal-widget-container * {
    box-sizing: border-box;
}

.terminal-header-handle {
    user-select: none;
    flex-shrink: 0;
    background: transparent !important;
}

.terminal-body-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: transparent !important;
    /* Crucial for scrolling inside flex */
}

.terminal-body-scroll {
    flex: 1;
    overflow-y: auto;
}

/* --- GLOBAL INPUT OVERRIDES FOR TERMINAL --- */
.terminal-widget input,
.terminal-window input,
.terminal-page input {
    background: transparent !important;
    border: 1.5px solid #00f2fe !important;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.2) !important;
    border-radius: 8px !important;
    outline: none !important;
    padding: 6px 12px !important;
    margin: 0 !important;
    width: 100%;
    color: #00f2fe !important;
    caret-color: #00f2fe !important;
    font-family: inherit !important;
    font-size: 14px !important;
    text-transform: none !important;
    letter-spacing: 1px;
}

.terminal-widget input::placeholder,
.terminal-window input::placeholder,
.terminal-page input::placeholder {
    color: rgba(0, 242, 254, 0.4) !important;
    text-transform: uppercase !important;
    font-size: 12px;
}