/**
 * Terminal Emulator - CRT Monitor Style
 * Retro terminal with scanlines, glitch effects, and phosphor glow
 */

/* Terminal Overlay */
.terminal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

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

/* CRT Monitor Container */
.terminal-window {
    width: 85%;
    max-width: 1100px;
    height: 75vh;
    max-height: 700px;
    background: #0a0a0a;
    border-radius: 20px;
    box-shadow:
        0 0 60px rgba(0, 245, 255, 0.3),
        0 0 120px rgba(0, 245, 255, 0.1),
        inset 0 0 40px rgba(0, 0, 0, 0.8);
    border: 3px solid #1a1a1a;
    position: relative;
    overflow: hidden;
    animation: crt-power-on 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

/* CRT Power On Animation */
@keyframes crt-power-on {
    0% {
        transform: scaleY(0.001) scaleX(0);
        opacity: 0;
    }
    40% {
        transform: scaleY(0.001) scaleX(1);
        opacity: 0.7;
    }
    100% {
        transform: scaleY(1) scaleX(1);
        opacity: 1;
    }
}

/* CRT Power Off Animation */
.terminal-window.closing {
    animation: crt-power-off 0.5s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards;
}

@keyframes crt-power-off {
    0% {
        transform: scaleY(1) scaleX(1);
        opacity: 1;
    }
    60% {
        transform: scaleY(0.001) scaleX(1);
        opacity: 0.7;
    }
    100% {
        transform: scaleY(0.001) scaleX(0);
        opacity: 0;
    }
}

/* Terminal Header */
.terminal-header {
    background: linear-gradient(180deg, #1a1a1a 0%, #0f0f0f 100%);
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid var(--neon-cyan);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--neon-cyan);
}

.terminal-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.terminal-close {
    background: transparent;
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    line-height: 1;
}

.terminal-close:hover {
    background: var(--neon-cyan);
    color: #0a0a0a;
    box-shadow: 0 0 20px var(--neon-cyan);
}

/* Terminal Content */
.terminal-content {
    height: calc(100% - 52px);
    padding: 1.5rem;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--neon-green);
    position: relative;
}

/* CRT Screen Effect - Static Scanlines (no animation) */
.terminal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.15) 0px,
            rgba(0, 0, 0, 0.15) 1px,
            transparent 1px,
            transparent 2px
        );
    pointer-events: none;
    z-index: 2;
    /* animation: scanlines 8s linear infinite; */
}

@keyframes scanlines {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(10px);
    }
}

/* Screen Flicker - DISABLED */
.terminal-content::after {
    display: none;
}

/* Curved Screen Effect */
.terminal-window {
    perspective: 1000px;
}

.terminal-content {
    transform-style: preserve-3d;
    transform: translateZ(0);
}

/* Custom Scrollbar */
.terminal-content::-webkit-scrollbar {
    width: 10px;
}

.terminal-content::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.terminal-content::-webkit-scrollbar-thumb {
    background: var(--neon-cyan);
    border-radius: 5px;
}

.terminal-content::-webkit-scrollbar-thumb:hover {
    background: var(--neon-green);
}

/* Terminal Line */
.terminal-line {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 3;
}

.terminal-line.output {
    color: var(--text-primary);
    margin-left: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

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

.terminal-line.success {
    color: var(--neon-green);
}

.terminal-line.info {
    color: var(--neon-cyan);
}

/* Terminal Prompt */
.terminal-prompt {
    color: var(--neon-cyan);
    margin-right: 0.5rem;
    flex-shrink: 0;
    text-shadow: 0 0 5px var(--neon-cyan);
}

/* Terminal Input */
.terminal-input-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
}

.terminal-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--neon-green);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    flex: 1;
    caret-color: var(--neon-green);
    text-shadow: 0 0 5px var(--neon-green);
}

/* Blinking Cursor */
.terminal-cursor {
    display: inline-block;
    width: 10px;
    height: 1.2rem;
    background: var(--neon-green);
    margin-left: 2px;
    animation: cursor-blink 1s step-end infinite;
    box-shadow: 0 0 5px var(--neon-green);
}

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

/* Command Output Styles */
.terminal-output {
    margin-left: 0;
    padding-left: 0;
}

.terminal-output.ascii-art {
    color: var(--neon-cyan);
    line-height: 1.2;
}

.terminal-output.table {
    display: block;
    margin: 0.5rem 0;
}

.terminal-output a {
    color: var(--neon-cyan);
    text-decoration: underline;
}

.terminal-output a:hover {
    color: var(--neon-magenta);
}

/* Loading Animation */
.terminal-loading {
    display: inline-block;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

/* Glitch Effect for Text */
.terminal-glitch {
    position: relative;
    animation: glitch-text 5s infinite;
}

@keyframes glitch-text {
    0%, 90%, 100% {
        transform: translate(0);
    }
    91% {
        transform: translate(-2px, 0);
    }
    92% {
        transform: translate(2px, 0);
    }
    93% {
        transform: translate(-2px, 0);
    }
}

/* Matrix Rain Effect */
.matrix-rain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.3;
    font-family: var(--font-mono);
    color: var(--neon-green);
}

/* Responsive Design */
@media (max-width: 968px) {
    .terminal-window {
        width: 95%;
        height: 80vh;
    }

    .terminal-content {
        font-size: 0.85rem;
        padding: 1rem;
    }

    .terminal-header {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 640px) {
    .terminal-window {
        width: 100%;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }

    .terminal-content {
        font-size: 0.8rem;
        padding: 0.8rem;
    }
}

/* Phosphor Glow Effect */
.terminal-content {
    text-shadow:
        0 0 5px currentColor,
        0 0 10px rgba(57, 255, 20, 0.3);
}

/* Screen Bezel Effect */
.terminal-window::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(145deg, #2a2a2a 0%, #0a0a0a 100%);
    border-radius: 25px;
    z-index: -1;
    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 0.8),
        0 0 80px rgba(0, 245, 255, 0.1);
}

/* Welcome Message Styling */
.terminal-welcome {
    color: var(--neon-cyan);
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--neon-cyan);
    border-radius: 4px;
    background: rgba(0, 245, 255, 0.05);
}

/* Help Command Table */
.terminal-help-section {
    margin: 1rem 0;
}

.terminal-help-section h3 {
    color: var(--neon-cyan);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.terminal-help-item {
    display: flex;
    margin: 0.3rem 0;
}

.terminal-help-cmd {
    color: var(--neon-green);
    width: 150px;
    flex-shrink: 0;
}

.terminal-help-desc {
    color: var(--text-secondary);
}
