/* Terminal Styles */
.terminal-container {
    width: 90%;
    max-width: 800px;
    background-color: var(--color-terminal-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: scale(0.95);
    animation: terminalAppear 1s ease forwards;
}

@keyframes terminalAppear {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.terminal-header {
    background-color: var(--color-terminal-header);
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.terminal-title {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-text-dim);
}

.terminal-buttons {
    display: flex;
}

.terminal-button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 8px;
    background-color: #ff5f56;
}

.terminal-button:nth-child(2) {
    background-color: #ffbd2e;
}

.terminal-button:nth-child(3) {
    background-color: #27c93f;
}

.terminal-body {
    padding: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--color-text);
    max-height: 80vh;
    overflow-y: auto;
}

.terminal-line {
    margin-bottom: 0.5rem;
    display: flex;
    opacity: 0;
    animation: terminalLine 0.5s ease forwards;
}

@keyframes terminalLine {
    to {
        opacity: 1;
    }
}

.terminal-prompt {
    color: var(--color-primary);
    margin-right: 0.5rem;
}

.terminal-command {
    color: var(--color-text);
}

.terminal-output {
    color: var(--color-text-dim);
}

/* Specific terminal styles for each section */
.terminal-section,
.tech-terminal,
.cert-terminal,
.approach-terminal,
.contact-terminal {
    margin: 2rem 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background-color: var(--color-terminal-bg);
}

.tech-terminal .terminal-body,
.cert-terminal .terminal-body,
.approach-terminal .terminal-body,
.contact-terminal .terminal-body {
    padding: 2rem;
}

/* Typing effect */
.typed-cursor {
    display: inline-block;
    width: 0.5em;
    height: 1.2em;
    background-color: var(--color-primary);
    margin-left: 2px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Terminal intro animations delay */
#command1 { animation-delay: 0.5s; }
#output1 { animation-delay: 1s; }
#output2 { animation-delay: 2s; }
#command2 { animation-delay: 3s; }
#output3 { animation-delay: 3.5s; }
#output4 { animation-delay: 4s; }
#output5 { animation-delay: 4.5s; }
#output6 { animation-delay: 5s; }
#command3 { animation-delay: 5.5s; }
#output7 { animation-delay: 6s; }

/* Glitch effect */
.glitch {
    position: relative;
    color: var(--color-text);
}

.glitch-text {
    font-family: var(--font-mono); /* Asegúrate de que esto esté definido correctamente */
    position: relative;
    animation: glitch 1s linear infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--color-bg);
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 var(--color-primary);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 var(--color-secondary);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim-2 2s infinite linear alternate-reverse;
}

/* Nuevos estilos de iconos basados en texto para reemplazar las animaciones WebGL */
.expertise-icon.terminal-effect {
    width: 50px;
    height: 50px;
    border-radius: 5px;
    background-color: rgba(0, 255, 0, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.expertise-icon.terminal-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 2px;
    background-color: var(--color-primary);
    animation: scanline 3s linear infinite;
}

/* Estilo para visualización de código de terminal */
.terminal-code-display {
    background-color: var(--color-terminal-bg);
    border-radius: 5px;
    border: 1px solid rgba(0, 255, 0, 0.3);
    padding: 1rem;
    margin: 2rem 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    overflow-x: auto;
    max-height: 400px;
}

.code-lines {
    counter-reset: line;
}

.code-line {
    white-space: pre;
    color: var(--color-text);
    padding: 0.1rem 0;
}

.line-number {
    color: var(--color-text-dim);
    padding-right: 1rem;
    user-select: none;
}

.code-keyword {
    color: #569CD6; /* Azul para palabras clave */
}

.code-function {
    color: #DCDCAA; /* Amarillo para funciones */
}

.code-string {
    color: #CE9178; /* Naranja para strings */
}

.code-comment {
    color: #6A9955; /* Verde para comentarios */
}

.code-var {
    color: #9CDCFE; /* Azul claro para variables */
}

/* Añadir cursor parpadeante al final */
.terminal-code-display::after {
    content: '';
    display: inline-block;
    background-color: var(--color-primary);
    width: 0.6em;
    height: 1.2em;
    animation: blink 1s step-end infinite;
}

@keyframes scanline {
    0% { left: -100%; }
    100% { left: 100%; }
}

.icon-char {
    font-family: var(--font-mono);
    font-size: 16px;
    color: var(--color-primary);
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.7);
}

/* Efecto de cursor parpadeante para los elementos de terminal */
.terminal-cursor::after {
    content: '|';
    font-weight: bold;
    color: var(--color-primary);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Añade un borde de terminal para la sección de expertise */
.terminal-section {
    border: 1px solid rgba(0, 255, 0, 0.3);
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.1);
    overflow: hidden;
}

/* Añadir efecto de fondo de matriz para reemplazar las animaciones 3D */
.matrix-background {
    background-color: var(--color-terminal-bg);
    position: relative;
    overflow: hidden;
}

.matrix-background::before {
    content: '01010111 00110001 10100101 11011010 10101010 10001110 11010110';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    font-family: var(--font-mono);
    font-size: 8px;
    line-height: 8px;
    color: rgba(0, 255, 0, 0.05);
    white-space: nowrap;
    pointer-events: none;
}

@keyframes glitch-anim-1 {
    0% { clip: rect(16px, 9999px, 40px, 0); }
    20% { clip: rect(80px, 9999px, 91px, 0); }
    40% { clip: rect(43px, 9999px, 75px, 0); }
    60% { clip: rect(56px, 9999px, 23px, 0); }
    80% { clip: rect(82px, 9999px, 99px, 0); }
    100% { clip: rect(19px, 9999px, 52px, 0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(63px, 9999px, 45px, 0); }
    20% { clip: rect(17px, 9999px, 36px, 0); }
    40% { clip: rect(85px, 9999px, 56px, 0); }
    60% { clip: rect(73px, 9999px, 92px, 0); }
    80% { clip: rect(10px, 9999px, 49px, 0); }
    100% { clip: rect(53px, 9999px, 79px, 0); }
}