/* KLIK Terminal Hacker Animation - Extended */
#klik-animation-container {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 200px;
    height: 400px;
    z-index: 9999;
    pointer-events: none;
    font-family: 'Courier New', 'Monaco', monospace;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid #4a9eff;
    border-radius: 5px;
    padding: 10px 15px;
    box-shadow: 0 0 20px rgba(74, 158, 255, 0.2);
    overflow: hidden;
}

.terminal-header {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
    font-size: 10px;
    color: #7bb3ff;
    opacity: 0.7;
}

.terminal-dots {
    display: flex;
    gap: 4px;
    margin-right: 8px;
}

.terminal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.terminal-dot.red { background: #ff8a80; }
.terminal-dot.yellow { background: #ffd54f; }
.terminal-dot.green { background: #81c784; }

.terminal-title {
    font-size: 10px;
    color: #7bb3ff;
    opacity: 0.8;
}

/* Close button */
.terminal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 16px;
    color: #ff7a7a;
    cursor: pointer;
    z-index: 10000;
    pointer-events: auto;
    opacity: 0.8;
    transition: opacity 0.3s ease, transform 0.2s ease;
    user-select: none;
}

.terminal-close:hover {
    opacity: 1;
    transform: scale(1.1);
    color: #ff5555;
}

.klik-text {
    font-size: 24px !important;
    font-weight: bold !important;
    font-family: 'Courier New', 'Monaco', monospace !important;
    color: #7bb3ff !important;
    text-shadow: 0 0 10px #7bb3ff !important;
    letter-spacing: 3px !important;
    position: relative;
    display: inline-block;
    animation: terminalBlink 2s ease-in-out infinite !important;
}

.klik-letter {
    display: inline-block;
    position: relative;
    animation: hackerGlitch 3s ease-in-out infinite;
}

.klik-letter:nth-child(1) { animation-delay: 0s; }
.klik-letter:nth-child(2) { animation-delay: 0.3s; }
.klik-letter:nth-child(3) { animation-delay: 0.6s; }
.klik-letter:nth-child(4) { animation-delay: 0.9s; }

/* Terminal cursor */
.terminal-cursor {
    display: inline-block;
    width: 2px;
    height: 20px;
    background: #7bb3ff;
    margin-left: 3px;
    animation: cursorBlink 1s ease-in-out infinite;
}

/* Lightweight matrix-style background */
.matrix-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: -1;
    opacity: 0.1;
}

.matrix-char {
    position: absolute;
    color: #5ba85b;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    animation: matrixFall 4s linear infinite;
}

/* Terminal status line */
.terminal-status {
    font-size: 9px;
    color: #5ba85b;
    opacity: 0.6;
    margin-top: 3px;
    display: flex;
    justify-content: space-between;
}

.status-item {
    animation: statusFlicker 2s ease-in-out infinite;
}

/* Lightweight animations */
@keyframes terminalBlink {
    0%, 50%, 100% { 
        opacity: 1;
        text-shadow: 0 0 10px #5ba85b;
    }
    25%, 75% { 
        opacity: 0.7;
        text-shadow: 0 0 5px #5ba85b;
    }
}

@keyframes hackerGlitch {
    0%, 90%, 100% { 
        transform: translateX(0);
        opacity: 1;
    }
    5% { 
        transform: translateX(-1px);
        opacity: 0.9;
    }
    10% { 
        transform: translateX(1px);
        opacity: 0.8;
    }
    15% { 
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes matrixFall {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(300%);
        opacity: 0;
    }
}

@keyframes statusFlicker {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Scan line effect */
.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #7bb3ff, transparent);
    animation: scanMove 3s linear infinite;
    opacity: 0.3;
}

@keyframes scanMove {
    0% { transform: translateY(0); }
    100% { transform: translateY(60px); }
}

/* Boot sequence effect */
.boot-text {
    font-size: 8px;
    color: #7bb3ff;
    opacity: 0;
    animation: bootSequence 0.5s ease-in-out forwards;
}

.boot-text:nth-child(1) { animation-delay: 0.1s; }
.boot-text:nth-child(2) { animation-delay: 0.2s; }
.boot-text:nth-child(3) { animation-delay: 0.3s; }

@keyframes bootSequence {
    0% { opacity: 0; transform: translateX(-10px); }
    100% { opacity: 0.7; transform: translateX(0); }
}

@keyframes typeLine {
    0% { 
        opacity: 0; 
        transform: translateX(-10px);
        width: 0;
    }
    100% { 
        opacity: 1; 
        transform: translateX(0);
        width: 100%;
    }
}

@keyframes errorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Terminal content area */
.terminal-content {
    height: 300px;
    overflow-y: auto;
    margin: 10px 0;
    scrollbar-width: thin;
    scrollbar-color: #7bb3ff transparent;
}

.terminal-content::-webkit-scrollbar {
    width: 4px;
}

.terminal-content::-webkit-scrollbar-track {
    background: transparent;
}

.terminal-content::-webkit-scrollbar-thumb {
    background: #7bb3ff;
    border-radius: 2px;
}

/* Code lines */
.code-line {
    font-size: 10px;
    color: #8cc4ff;
    margin: 1px 0;
    opacity: 0;
    animation: typeLine 0.5s ease-in-out forwards;
    white-space: nowrap;
    overflow: hidden;
}

.code-line.comment {
    color: #9aa5b1;
}

.code-line.function {
    color: #f5d887;
}

.code-line.variable {
    color: #f5a6a6;
}

.code-line.string {
    color: #87d9d9;
}

.code-line.keyword {
    color: #d9a6d9;
}

.code-line.error {
    color: #ff7a7a;
    animation: errorBlink 1s ease-in-out infinite;
}

.code-line.success {
    color: #87d987;
}

/* Prompt line */
.prompt-line {
    font-size: 10px;
    color: #8cc4ff;
    display: flex;
    align-items: center;
}

.prompt {
    color: #f5d887;
    margin-right: 5px;
}

.input-cursor {
    display: inline-block;
    width: 8px;
    height: 12px;
    background: #7bb3ff;
    animation: cursorBlink 1s ease-in-out infinite;
    margin-left: 2px;
}

/* Active typing indicator */
.typing-indicator {
    position: absolute;
    bottom: 30px;
    left: 15px;
    font-size: 9px;
    color: #f5d887;
    opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #klik-animation-container {
        top: 15px;
        left: 15px;
        width: 280px;
        height: 350px;
        padding: 8px 12px;
    }
    .klik-text {
        font-size: 20px !important;
        letter-spacing: 2px !important;
    }
    .terminal-content {
        height: 250px;
    }
}

@media (max-width: 480px) {
    #klik-animation-container {
        top: 10px;
        left: 10px;
        width: 250px;
        height: 300px;
        padding: 6px 10px;
    }
    .klik-text {
        font-size: 16px !important;
        letter-spacing: 1px !important;
    }
    .terminal-status {
        font-size: 7px;
    }
    .terminal-content {
        height: 200px;
    }
}

/* Low performance mode - minimal animations only */
@media (prefers-reduced-motion: reduce) {
    .klik-letter,
    .matrix-char,
    .scan-line {
        animation: none;
    }
    .klik-text {
        animation: terminalBlink 3s ease-in-out infinite;
    }
}