/* ============================================================================
   INTERACTIVE FEATURES STYLES
   Terminal, Games, Skill Tree
   ============================================================================ */

/* TERMINAL STYLES */
.terminal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 800px;
    max-height: 600px;
    background: rgba(6, 10, 20, 0.98);
    border: 2px solid var(--accent);
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(26, 159, 202, 0.3);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    font-family: 'JetBrains Mono', monospace;
}

.terminal--active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.terminal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(26, 159, 202, 0.1);
    border-bottom: 1px solid var(--accent-dim);
}

.terminal__title {
    font-size: 0.875rem;
    color: var(--accent);
    font-weight: 600;
}

.terminal__close {
    width: 32px;
    height: 32px;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 4px;
    color: #ff4444;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.terminal__close:hover {
    background: rgba(255, 0, 0, 0.2);
    transform: rotate(90deg);
}

.terminal__output {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    font-size: 0.875rem;
    line-height: 1.6;
}

.terminal__line {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.terminal__line--welcome {
    color: var(--accent);
    margin-bottom: 1rem;
}

.terminal__line--command {
    color: var(--text-primary);
}

.terminal__line--error {
    color: #ff4444;
}

.terminal__highlight {
    color: var(--accent);
    font-weight: 600;
}

.terminal__success {
    color: var(--green);
}

.terminal__warning {
    color: #ffa500;
}

.terminal__info {
    color: #4a9eff;
}

.terminal__ascii {
    color: var(--accent);
    font-size: 0.7rem;
    line-height: 1.2;
}

.terminal__input-line {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3);
}

.terminal__prompt {
    color: var(--accent);
    margin-right: 0.5rem;
    font-weight: 600;
}

.terminal__input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    outline: none;
}

/* GAME MODAL STYLES */
.game-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-modal--active .game-modal__overlay {
    opacity: 1;
}

.game-modal__content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.game-modal--active .game-modal__content {
    transform: scale(1);
    opacity: 1;
}

.game-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 4px;
    color: #ff4444;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.game-modal__close:hover {
    background: rgba(255, 0, 0, 0.2);
    transform: rotate(90deg);
}

.game-modal__body {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(90vh - 4rem);
}

/* GAME COMMON STYLES */
.game-header {
    margin-bottom: 2rem;
}

.game-title {
    font-size: 1.75rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.game-score,
.game-instructions,
.game-task {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.game-stats {
    display: flex;
    gap: 2rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
}

.game-content {
    margin-bottom: 2rem;
}

.game-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(26, 159, 202, 0.2);
    border: 1px solid var(--accent);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 1rem;
}

.game-btn:hover {
    background: rgba(26, 159, 202, 0.3);
    transform: translateY(-2px);
}

.game-btn--secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
}

.game-restart {
    padding: 1rem 2rem;
    background: var(--accent);
    border: none;
    color: #000;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 2rem;
}

.game-restart:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 24px rgba(26, 159, 202, 0.4);
}

.game-feedback {
    margin-top: 1.5rem;
    min-height: 3rem;
}

.feedback {
    padding: 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.feedback--success {
    background: rgba(61, 214, 140, 0.1);
    border: 1px solid rgba(61, 214, 140, 0.3);
    color: var(--green);
}

.feedback--error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    color: #ff4444;
}

.feedback--info {
    background: rgba(26, 159, 202, 0.1);
    border: 1px solid var(--accent-dim);
    color: var(--accent);
}

.game-results {
    text-align: center;
    padding: 3rem 2rem;
}

.game-final-score {
    font-size: 3rem;
    color: var(--accent);
    font-weight: 700;
    margin: 2rem 0;
}

.game-message {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* SERVER ISSUE GAME */
.game-symptoms {
    margin-bottom: 2rem;
}

.symptom {
    padding: 0.75rem;
    background: rgba(255, 68, 68, 0.1);
    border-left: 3px solid #ff4444;
    margin-bottom: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
}

.game-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.game-option {
    padding: 1rem;
    background: rgba(26, 159, 202, 0.1);
    border: 2px solid var(--accent-dim);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.game-option:hover:not(:disabled) {
    background: rgba(26, 159, 202, 0.2);
    transform: translateY(-2px);
}

.game-option:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.game-option--correct {
    background: rgba(61, 214, 140, 0.2);
    border-color: var(--green);
}

.game-option--wrong {
    background: rgba(255, 68, 68, 0.2);
    border-color: #ff4444;
}

/* NETWORK PUZZLE GAME */
.network-canvas {
    position: relative;
    width: 100%;
    height: 400px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

#network-svg {
    position: absolute;
    inset: 0;
}

.network-nodes {
    position: absolute;
    inset: 0;
}

.network-node {
    position: absolute;
    width: 40px;
    height: 40px;
    background: var(--accent);
    border: 2px solid var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-weight: 700;
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.network-node:hover {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 0 20px var(--accent-glow);
}

.network-node--selected {
    background: var(--green);
    border-color: var(--green);
    animation: pulse 1s infinite;
}

/* BASH BUILDER GAME */
.bash-builder {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.bash-dropzone {
    min-height: 150px;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    border: 2px dashed var(--border);
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
    align-content: flex-start;
    color: var(--text-tertiary);
    font-family: 'JetBrains Mono', monospace;
}

.bash-dropzone--over {
    border-color: var(--accent);
    background: rgba(26, 159, 202, 0.1);
}

.bash-token {
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: #000;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.bash-token:hover {
    opacity: 0.8;
}

.bash-palette h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.bash-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bash-item {
    padding: 0.5rem 1rem;
    background: rgba(26, 159, 202, 0.2);
    border: 1px solid var(--accent-dim);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: grab;
    font-family: 'JetBrains Mono', monospace;
}

.bash-item:active {
    cursor: grabbing;
}

.bash-item--pipe {
    background: rgba(255, 215, 0, 0.2);
    border-color: var(--gold);
    color: var(--gold);
}

.bash-item--option {
    background: rgba(61, 214, 140, 0.2);
    border-color: var(--green);
    color: var(--green);
}

/* UPTIME CHALLENGE GAME */
.uptime-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.uptime-server {
    padding: 2rem 1rem;
    background: rgba(26, 159, 202, 0.1);
    border: 2px solid var(--accent-dim);
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.uptime-server__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.uptime-server__status {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.uptime-server--ok {
    border-color: var(--green);
}

.uptime-server--ok .uptime-server__status {
    color: var(--green);
}

.uptime-server--error {
    border-color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
    animation: shake 0.5s;
}

.uptime-server--error .uptime-server__status {
    color: #ff4444;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* SKILL TREE MODAL */
.skill-tree-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skill-tree-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.skill-tree-modal--active .skill-tree-modal__overlay {
    opacity: 1;
}

.skill-tree-modal__content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-tree-modal--active .skill-tree-modal__content {
    transform: scale(1);
    opacity: 1;
}

.skill-tree-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
}

.skill-tree-modal__title {
    font-size: 1.5rem;
    color: var(--accent);
}

.skill-tree-modal__close {
    width: 36px;
    height: 36px;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 4px;
    color: #ff4444;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.skill-tree-modal__close:hover {
    background: rgba(255, 0, 0, 0.2);
    transform: rotate(90deg);
}

.skill-tree-modal__body {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(90vh - 100px);
}

.skill-node {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(26, 159, 202, 0.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.skill-node--parent {
    cursor: pointer;
}

.skill-node--parent:hover {
    border-color: var(--accent-dim);
    background: rgba(26, 159, 202, 0.1);
}

.skill-node__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.skill-node__icon {
    font-size: 2rem;
}

.skill-node__name {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.skill-node__level {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    font-weight: 700;
}

.skill-node__bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.skill-node__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--green));
    transition: width 1s ease;
    box-shadow: 0 0 10px var(--accent-glow);
}

.skill-node__children {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

.skill-node--expanded .skill-node__children {
    max-height: 1000px;
    margin-top: 1.5rem;
}

.skill-node--child {
    position: relative;
    margin-left: 2rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
}

.skill-node--child .skill-node__icon {
    font-size: 1.5rem;
}

.skill-node--child .skill-node__name {
    font-size: 1rem;
}

.skill-node__connector {
    position: absolute;
    left: -2rem;
    top: 50%;
    width: 2rem;
    height: 2px;
    background: var(--accent-dim);
}

.skill-node__connector::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.skill-tree-trigger {
    width: 100%;
    padding: 1rem;
    margin-top: 1rem;
    background: rgba(26, 159, 202, 0.1);
    border: 1px solid var(--accent-dim);
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.skill-tree-trigger:hover {
    background: rgba(26, 159, 202, 0.2);
    transform: translateY(-2px);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .terminal,
    .game-modal__content,
    .skill-tree-modal__content {
        width: 95%;
        max-width: none;
    }

    .game-options {
        grid-template-columns: 1fr;
    }

    .bash-builder {
        grid-template-columns: 1fr;
    }

    .uptime-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* GAME HINT */
.game-hint {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(26, 159, 202, 0.05);
    border-left: 3px solid var(--accent);
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.game-hint kbd {
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent);
}
/* NOTIFICATION SYSTEM */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    z-index: 10000;
    max-width: 300px;
    word-wrap: break-word;
    backdrop-filter: blur(10px);
}

.notification--success {
    border: 1px solid #3dd68c;
    color: #3dd68c;
}

.notification--error {
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
}

.notification--warning {
    border: 1px solid #ffa726;
    color: #ffa726;
}

.notification--info {
    border: 1px solid #1a9fca;
    color: #1a9fca;
}

/* PULSE ANIMATION */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(61, 214, 140, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(61, 214, 140, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(61, 214, 140, 0);
    }
}

/* ENHANCED HOVER EFFECTS */
.service:hover {
    transform: translateY(-2px);
    transition: transform 0.3s ease;
}

.service {
    transition: transform 0.3s ease;
}

/* ACCESSIBILITY IMPROVEMENTS */
@media (prefers-reduced-motion: reduce) {
    .terminal,
    .game-modal__content,
    .skill-tree-modal__content,
    .notification {
        transition: none;
    }
    
    .skill-node--selected {
        animation: none;
    }
    
    .uptime-server--error {
        animation: none;
    }
}

/* HIGH CONTRAST MODE */
@media (prefers-contrast: high) {
    .terminal {
        border-width: 3px;
    }
    
    .game-modal__content,
    .skill-tree-modal__content {
        border-width: 3px;
    }
    
    .game-option,
    .bash-item,
    .uptime-server {
        border-width: 2px;
    }
}

/* FOCUS INDICATORS */
.terminal__input:focus,
.game-btn:focus,
.game-option:focus,
.bash-item:focus,
.uptime-server:focus,
.skill-tree-trigger:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* LOADING STATES */
.game-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.game-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-dim);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}