/* Terminal Visual Enhancements - E-RSI System */
/* Maintains authentic terminal aesthetic with modern polish */

/* Enhanced color palette for terminal */
:root {
    --term-green-bright: #00ff00;
    --term-green-normal: #00dd00;
    --term-green-dim: #00aa00;
    --term-green-dark: #008800;
    --term-amber: #ffb000;
    --term-red: #ff0040;
    --term-cyan: #00ffff;
    --term-bg: #0a0a0a;
    --term-bg-lighter: #141414;
}

/* CRT Monitor Effect - Scan lines */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 2px;
    z-index: 1000;
    pointer-events: none;
    animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
    0% { background-position: 0 0; }
    100% { background-position: 0 10px; }
}

/* Terminal turn-on effect */
body {
    animation: turn-on 0.5s ease-out;
}

@keyframes turn-on {
    0% {
        transform: scale(1, 0.1) translate(0, 0);
        filter: brightness(30);
        opacity: 0;
    }
    35% {
        transform: scale(1, 0.8) translate(0, -10%);
        filter: brightness(10);
    }
    70% {
        transform: scale(1, 1.1) translate(0, 2%);
        filter: brightness(5);
    }
    100% {
        transform: scale(1, 1) translate(0, 0);
        filter: brightness(1);
        opacity: 1;
    }
}

/* Subtle flicker effect */
.terminal {
    animation: flicker 10s infinite;
    position: relative;
    overflow: hidden;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 0.98; }
    94% { opacity: 1; }
    96% { opacity: 0.99; }
    98% { opacity: 1; }
}

/* CRT curve effect */
.terminal::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 70%,
        rgba(0, 0, 0, 0.2) 100%
    );
    pointer-events: none;
}

/* Clean headlines without glow */
h1, h2, h3 {
    color: var(--term-green-bright);
    letter-spacing: 2px;
    /* Removed text-shadow for cleaner look */
}

/* Static cursor - no blinking */
.cursor, .terminal-cursor {
    display: inline-block;
    width: 10px;
    height: 20px;
    background: var(--term-green-bright);
    /* Removed animation for static cursor */
    box-shadow: 0 0 5px var(--term-green-bright);
    vertical-align: text-bottom;
}

/* Terminal prompt styling */
.terminal-prompt::before {
    content: '> ';
    color: var(--term-green-bright);
    text-shadow: 0 0 3px var(--term-green-bright);
}

/* Typing animation */
.typing-text {
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid var(--term-green-bright);
    animation: typing 3s steps(40, end);
    /* Removed cursor-blink for static border */
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

/* ASCII-style borders */
.ascii-box {
    border: 1px solid var(--term-green-dark);
    position: relative;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 20px,
        rgba(0, 255, 0, 0.02) 20px,
        rgba(0, 255, 0, 0.02) 21px
    );
}

/* Status LEDs - Static, no blinking */
.status-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin: 0 5px;
}

.status-led.active {
    background: var(--term-green-bright);
    box-shadow: 0 0 5px var(--term-green-bright);
    /* Removed animation for static LED */
}

.status-led.warning {
    background: var(--term-amber);
    box-shadow: 0 0 5px var(--term-amber);
    /* Removed animation for static LED */
}

.status-led.error {
    background: var(--term-red);
    box-shadow: 0 0 5px var(--term-red);
    /* Removed animation for static LED */
}

/* Terminal loading spinner */
.terminal-spinner {
    display: inline-block;
    font-family: monospace;
    animation: spin-chars 0.5s steps(4) infinite;
}

.terminal-spinner::before {
    content: '|';
}

@keyframes spin-chars {
    0% { content: '|'; }
    25% { content: '/'; }
    50% { content: '-'; }
    75% { content: '\\'; }
    100% { content: '|'; }
}

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

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
    80%, 100% { content: ''; }
}

/* Data table enhancements */
.data-table {
    border-collapse: separate;
    border-spacing: 0;
}

.data-table td, .data-table th {
    border: 1px dotted var(--term-green-dark);
    padding: 8px 12px;
    position: relative;
}

.data-table tr:hover {
    background: rgba(0, 255, 0, 0.05);
}

.data-table tr:hover td {
    color: var(--term-green-bright);
    text-shadow: 0 0 2px var(--term-green-bright);
}

/* Progress bars terminal style */
.terminal-progress {
    font-family: monospace;
    color: var(--term-green-bright);
    position: relative;
}

.terminal-progress-bar {
    display: inline-block;
    width: 200px;
    height: 20px;
    border: 1px solid var(--term-green-dark);
    background: var(--term-bg);
    position: relative;
    overflow: hidden;
}

.terminal-progress-fill {
    height: 100%;
    background: repeating-linear-gradient(
        90deg,
        var(--term-green-bright) 0px,
        var(--term-green-bright) 5px,
        var(--term-green-normal) 5px,
        var(--term-green-normal) 10px
    );
    animation: progress-slide 1s linear infinite;
    box-shadow: 0 0 10px var(--term-green-bright);
}

@keyframes progress-slide {
    0% { background-position: 0 0; }
    100% { background-position: 10px 0; }
}

/* Button enhancements */
button, .btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

button::before, .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 255, 0, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

button:active::before, .btn:active::before {
    width: 300px;
    height: 300px;
}

/* Input field enhancements */
input[type="text"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
select:focus {
    outline: none;
    border-color: var(--term-green-bright);
    box-shadow: 
        0 0 5px var(--term-green-bright),
        inset 0 0 3px rgba(0, 255, 0, 0.1);
    background: rgba(0, 255, 0, 0.02);
}

/* Matrix rain effect (subtle background) */
.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    opacity: 0.03;
    pointer-events: none;
}

/* Boot sequence animation */
.boot-sequence {
    animation: boot 2s ease-out;
}

@keyframes boot {
    0% {
        transform: scaleY(0.01);
        filter: brightness(3);
    }
    10% {
        transform: scaleY(0.1);
    }
    20% {
        transform: scaleY(1);
        filter: brightness(2);
    }
    30% {
        filter: brightness(0.5);
    }
    40% {
        filter: brightness(1.5);
    }
    50% {
        filter: brightness(0.8);
    }
    60% {
        filter: brightness(1.2);
    }
    70%, 100% {
        transform: scaleY(1);
        filter: brightness(1);
    }
}

/* Glitch effect for errors */
.glitch {
    animation: glitch 0.3s infinite;
}

@keyframes glitch {
    0%, 100% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }
    20% {
        transform: translate(-1px, 1px);
        filter: hue-rotate(90deg);
    }
    40% {
        transform: translate(-1px, -1px);
        filter: hue-rotate(180deg);
    }
    60% {
        transform: translate(1px, 1px);
        filter: hue-rotate(270deg);
    }
    80% {
        transform: translate(1px, -1px);
        filter: hue-rotate(360deg);
    }
}

/* Terminal window styling */
.terminal-window {
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}

.terminal-window-header {
    background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
    padding: 8px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--term-green-dark);
}

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

.terminal-button.close { 
    background: #ff5f57; 
    box-shadow: 0 0 3px #ff5f57;
}
.terminal-button.minimize { 
    background: #ffbd2e; 
    box-shadow: 0 0 3px #ffbd2e;
}
.terminal-button.maximize { 
    background: #28ca42; 
    box-shadow: 0 0 3px #28ca42;
}

/* ASCII art decoration */
.ascii-divider {
    color: var(--term-green-dim);
    text-align: center;
    margin: 20px 0;
    font-family: monospace;
    letter-spacing: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    @keyframes scanlines {
        0% { background-position: 0 0; }
        100% { background-position: 0 5px; }
    }
    
    body::before {
        background-size: 100% 1px;
    }
}

/* Accessibility - reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    body::before {
        display: none;
    }
}