/* Variables */
:root {
    --terminal-green: #32de84;
    --terminal-bg: #001100;
    --terminal-glow: rgba(51, 255, 51, 0.3);
    --terminal-scanline: rgba(0, 0, 0, 0.2);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Font Face */
@font-face {
    font-family: 'VT323';
    src: url('fonts/VT323-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Base Styles */
body {
    background-color: var(--terminal-bg);
    color: var(--terminal-green);
    font-family: 'VT323', 'Courier New', monospace;
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    font-size: 16px;
}

/* Layout */
.container {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    border-right: 1px solid var(--terminal-green);
    padding-right: 2rem;
    width: 100%;
}

/* Main Content */
.main-content {
    padding: 1rem;
    border: 1px solid var(--terminal-green);
    background: rgba(0, 17, 0, 0.3);
    width: 100%;
}

/* Terminal Elements */
.terminal-text {
    font-family: 'VT323', monospace;
    line-height: 1.6;
}

.output-line, #terminal-input, .prompt {
    font-family: 'VT323', 'Courier New', monospace;
    font-size: 1rem;
    color: var(--terminal-green);
    white-space: pre-wrap;
    line-height: 1.2;
    padding-left: 0.5rem;
}

#terminal-input {
    background: transparent;
    border: none;
    width: 100%;
    outline: none;
    caret-color: var(--terminal-green);
    caret-shape: block;
    position: relative;
    padding: 0;
    margin: 0;
    height: 1.2em;
    line-height: 1.2em;
}

#terminal-input::placeholder {
    color: rgba(50, 222, 132, 0.5);
    font-style: italic;
}

.command-line {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: rgba(0, 17, 0, 0.3);
    border: none;
    margin-top: 1rem;
}

.prompt {
    color: var(--terminal-green);
    margin-right: 0.25rem;
    display: flex;
    align-items: center;
}

/* Panels and Info Boxes */
.visitor-info, .nav-panel, .system-info, .login-panel {
    margin-bottom: 1rem;
    border: 1px solid var(--terminal-green);
    padding: 1rem;
    background: rgba(0, 17, 0, 0.3);
}

.visitor-stats {
    margin-bottom: 1rem;
}

.visitor-log {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

.visitor-entry {
    font-size: 0.9rem;
    padding: 0.2rem 0;
    border-bottom: 1px dashed rgba(50, 222, 132, 0.3);
}

/* Navigation */
.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-menu li {
    margin-bottom: 0.5rem;
}

.nav-menu li:last-child {
    margin-bottom: 0;
}

.nav-menu a {
    color: var(--terminal-green);
    text-decoration: none;
    display: block;
    padding: 0.5rem;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.nav-menu a:hover {
    border-color: var(--terminal-green);
    background: rgba(50, 222, 132, 0.1);
    text-shadow: 0 0 5px var(--terminal-glow);
}

/* ASCII Art */
.ascii-art {
    font-family: monospace;
    white-space: pre;
    color: var(--terminal-green);
    text-shadow: 0 0 5px var(--terminal-glow);
    margin-bottom: 1rem;
    font-size: 0.7rem;
    line-height: 1.2;
    text-align: center;
    overflow-wrap: break-word;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: pre-wrap;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: rgba(0, 17, 0, 0.9);
    border: 1px solid var(--terminal-green);
    padding: 1rem;
    max-width: 500px;
    width: 90%;
    color: var(--terminal-green);
}

/* Snake Game Styles */
.snake-modal {
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.snake-game {
    margin: 1rem 0;
}

.game-container {
    border: 1px solid var(--terminal-green);
    padding: 2rem;
    background: var(--terminal-bg);
    max-width: 1000px;
    width: 95%;
    margin: 2rem;
}

.game-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--terminal-green);
    font-size: 2rem;
    position: relative;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    gap: 2px;
    background: rgba(50, 222, 132, 0.2);
    padding: 2px;
    aspect-ratio: 1;
    min-height: 700px;
}

.cell {
    aspect-ratio: 1;
    background: var(--terminal-bg);
    min-width: 25px;
    min-height: 25px;
}

.cell.snake {
    background: var(--terminal-green);
}

.cell.snake-head {
    background: #90EE90;
}

.cell.food {
    background: #FF4444;
}

.game-controls {
    margin-top: 2rem;
    text-align: center;
    color: var(--terminal-green);
    font-size: 1.5rem;
}

/* Access Denied Styles */
.access-denied {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #ff0000;
    padding: 2rem;
    z-index: 1000;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
    animation: warningFlash 1s infinite;
}

/* CRT Effect */
.crt::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        to bottom,
        rgba(18, 16, 16, 0) 50%,
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    z-index: 2;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

.crt::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 2;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

/* Animations */
@keyframes flicker {
    0% { opacity: 0.27861; }
    5% { opacity: 0.34769; }
    10% { opacity: 0.23604; }
    15% { opacity: 0.90626; }
    20% { opacity: 0.18128; }
    25% { opacity: 0.83891; }
    30% { opacity: 0.65583; }
    35% { opacity: 0.67807; }
    40% { opacity: 0.26559; }
    45% { opacity: 0.84693; }
    50% { opacity: 0.96019; }
    55% { opacity: 0.08594; }
    60% { opacity: 0.20313; }
    65% { opacity: 0.71988; }
    70% { opacity: 0.53455; }
    75% { opacity: 0.37288; }
    80% { opacity: 0.71428; }
    85% { opacity: 0.70419; }
    90% { opacity: 0.7003; }
    95% { opacity: 0.36108; }
    100% { opacity: 0.24387; }
}

@keyframes blink {
    from, to { opacity: 0; }
    50% { opacity: 1; }
}

@keyframes warningFlash {
    0%, 100% { 
        border-color: #ff0000;
        box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
    }
    50% { 
        border-color: #ff4444;
        box-shadow: 0 0 40px rgba(255, 0, 0, 0.8);
    }
}

/* Media Queries */
@media (min-width: 768px) {
    .container {
        flex-direction: row;
    }

    .sidebar {
        width: 25%;
    }

    .main-content {
        width: 75%;
    }

    .ascii-art {
        font-size: 1rem;
    }
}

@media (max-width: 767px) {
    .ascii-art {
        display: none;
    }

    .nav-menu a {
        padding: 0.3rem;
    }

    .directory-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .directory-description {
        margin-left: 0;
        margin-top: 0.2rem;
    }

    .command-line {
        flex-direction: column;
        align-items: flex-start;
    }

    #terminal-input {
        width: 100%;
    }

    .sidebar {
        display: none;
    }

    .desktop-only {
        display: none;
    }
}

/* Login Panel Styles */
.login-panel {
    margin-bottom: 2rem;
    padding: 1rem;
    border: 1px solid var(--terminal-green);
    background: rgba(0, 17, 0, 0.3);
}

.login-panel h2 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--terminal-green);
}

.login-panel .form-group {
    margin-bottom: 1rem;
}

.login-panel input {
    width: 100%;
    padding: 0.5rem;
    background: rgba(0, 17, 0, 0.5);
    border: 1px solid var(--terminal-green);
    color: var(--terminal-green);
    font-family: 'VT323', monospace;
    outline: none;
}

.login-panel button[type="submit"] {
    width: 100%;
    padding: 0.5rem;
    background: rgba(0, 17, 0, 0.5);
    border: 1px solid var(--terminal-green);
    color: var(--terminal-green);
    font-family: 'VT323', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-panel button[type="submit"]:hover {
    background: var(--terminal-green);
    color: var(--terminal-bg);
}

/* Update Snake Game Close Button */
.snake-modal .close-button {
    position: absolute;
    right: -1.5rem;
    top: -1.5rem;
    width: 3rem;
    height: 3rem;
    background: var(--terminal-bg);
    border: 1px solid var(--terminal-green);
    color: var(--terminal-green);
    font-family: 'VT323', monospace;
    font-size: 2rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: all 0.3s ease;
}

.snake-modal .close-button:hover {
    background: var(--terminal-green);
    color: var(--terminal-bg);
    transform: scale(1.1);
}

.snake-modal .close-button:active {
    transform: scale(0.95);
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--terminal-bg);
    border: 1px solid var(--terminal-green);
}

::-webkit-scrollbar-thumb {
    background: var(--terminal-green);
    border: 2px solid var(--terminal-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: #40ff9f;
    box-shadow: 0 0 5px var(--terminal-glow);
}

::-webkit-scrollbar-corner {
    background: var(--terminal-bg);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--terminal-green) var(--terminal-bg);
}

/* Specific scrollbar for visitor log */
.visitor-log::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.visitor-log::-webkit-scrollbar-thumb {
    background: var(--terminal-green);
    border: 1px solid var(--terminal-bg);
}

/* Easter Egg Effects */

/* Konami Code Animation (will be triggered by JS) */
@keyframes matrix-rain {
    0% { text-shadow: 0 0 10px var(--terminal-green); }
    50% { 
        color: #00ff00;
        text-shadow: 0 0 20px #00ff00;
    }
    100% { text-shadow: 0 0 10px var(--terminal-green); }
}

.matrix-mode * {
    animation: matrix-rain 2s infinite;
}

/* Enhanced Glitch Effect for ASCII art */
@keyframes glitch {
    0% {
        text-shadow: 0.05em 0 0 var(--terminal-green),
                    -0.025em -0.05em 0 #0ff,
                    0.025em 0.05em 0 #f0f;
        transform: translate(0.0125em, -0.0125em);
    }
    15% {
        text-shadow: -0.05em -0.025em 0 var(--terminal-green),
                    0.025em 0.025em 0 #0ff,
                    -0.05em -0.05em 0 #f0f;
        transform: translate(-0.025em, 0.025em);
    }
    30% {
        text-shadow: 0.05em 0.025em 0 var(--terminal-green),
                    0.05em 0 0 #0ff,
                    0 -0.05em 0 #f0f;
        transform: translate(0.025em, 0);
    }
    45% {
        text-shadow: -0.025em 0 0 var(--terminal-green),
                    -0.025em -0.025em 0 #0ff,
                    -0.025em -0.05em 0 #f0f;
        transform: translate(-0.0125em, 0.0125em);
    }
    60% {
        text-shadow: 0.025em 0.05em 0 var(--terminal-green),
                    0 0.025em 0 #0ff,
                    0.025em 0 0 #f0f;
        transform: translate(0.025em, -0.025em);
    }
    75% {
        text-shadow: 0.05em 0.025em 0 var(--terminal-green),
                    -0.05em -0.025em 0 #0ff,
                    0.025em -0.05em 0 #f0f;
        transform: translate(-0.025em, -0.0125em);
    }
    90% {
        text-shadow: -0.025em -0.05em 0 var(--terminal-green),
                    0.025em 0.025em 0 #0ff,
                    -0.05em -0.025em 0 #f0f;
        transform: translate(0.0125em, 0.025em);
    }
    100% {
        text-shadow: 0.025em 0 0 var(--terminal-green),
                    -0.025em -0.025em 0 #0ff,
                    -0.025em -0.05em 0 #f0f;
        transform: translate(0, 0);
    }
}

.ascii-art:hover {
    position: relative;
}

.ascii-art:hover::before,
.ascii-art:hover::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--terminal-bg);
}

.ascii-art:hover::before {
    left: 2px;
    text-shadow: -2px 0 #ff0000;
    animation: glitch-2 750ms infinite;
}

.ascii-art:hover::after {
    left: -2px;
    text-shadow: 2px 0 #00ff00;
    animation: glitch-3 750ms infinite;
}

@keyframes glitch-2 {
    0% { clip-path: inset(75% 0 25% 0); }
    10% { clip-path: inset(15% 0 85% 0); }
    20% { clip-path: inset(45% 0 15% 0); }
    30% { clip-path: inset(95% 0 5% 0); }
    40% { clip-path: inset(25% 0 75% 0); }
    50% { clip-path: inset(85% 0 15% 0); }
    60% { clip-path: inset(5% 0 95% 0); }
    70% { clip-path: inset(65% 0 35% 0); }
    80% { clip-path: inset(35% 0 65% 0); }
    90% { clip-path: inset(55% 0 45% 0); }
    100% { clip-path: inset(75% 0 25% 0); }
}

@keyframes glitch-3 {
    0% { clip-path: inset(25% 0 75% 0); }
    10% { clip-path: inset(85% 0 15% 0); }
    20% { clip-path: inset(55% 0 45% 0); }
    30% { clip-path: inset(5% 0 95% 0); }
    40% { clip-path: inset(75% 0 25% 0); }
    50% { clip-path: inset(15% 0 85% 0); }
    60% { clip-path: inset(95% 0 5% 0); }
    70% { clip-path: inset(35% 0 65% 0); }
    80% { clip-path: inset(65% 0 35% 0); }
    90% { clip-path: inset(45% 0 55% 0); }
    100% { clip-path: inset(25% 0 75% 0); }
}

/* Rainbow effect on specific key combinations */
@keyframes rainbow-text {
    0% { color: #ff0000; }
    20% { color: #ff9900; }
    40% { color: #33ff00; }
    60% { color: #0099ff; }
    80% { color: #6633ff; }
    100% { color: #ff0000; }
}

.rainbow-mode {
    animation: rainbow-text 2s linear infinite;
}

/* Add this to your existing glitch CSS */
.ascii-art.glitch {
    animation: glitch 1000ms cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
    position: relative;
}

.ascii-art.glitch::before,
.ascii-art.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--terminal-bg);
}

.ascii-art.glitch::before {
    left: 2px;
    text-shadow: -2px 0 #ff0000;
    animation: glitch-2 1000ms infinite;
}

.ascii-art.glitch::after {
    left: -2px;
    text-shadow: 2px 0 #00ff00;
    animation: glitch-3 1000ms infinite;
}

.retry-button.terminal-button {
    background: var(--terminal-bg);
    color: var(--terminal-green);
    border: 1px solid var(--terminal-green);
    padding: 0.5rem 1rem;
    font-family: 'VT323', monospace;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.retry-button.terminal-button:hover:not(:disabled) {
    background: var(--terminal-green);
    color: var(--terminal-bg);
    box-shadow: 0 0 10px var(--terminal-glow);
}

.retry-button.terminal-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Terminal Link Styles */
.terminal-link {
    color: #00ffff; /* Brighter cyan color */
    text-decoration: none;
    border-bottom: 1px dashed #00ffff;
    padding-bottom: 1px;
    transition: all 0.3s ease;
}

.terminal-link:hover {
    color: #ffffff; /* White on hover */
    border-bottom-style: solid;
    text-shadow: 0 0 5px #00ffff;
}

/* For URLs in the dir command specifically */
.output-line a {
    color: #00ffff;
    text-decoration: none;
    border-bottom: 1px dashed #00ffff;
    padding-bottom: 1px;
    transition: all 0.3s ease;
}

.output-line a:hover {
    color: #ffffff;
    border-bottom-style: solid;
    text-shadow: 0 0 5px #00ffff;
}

/* SEO Content (visible to search engines, hidden from users) */
.seo-content {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    /* Don't use display: none as search engines might ignore it */
}

/* Ensure screen readers can access the content if needed */
.seo-content:focus {
    width: auto;
    height: auto;
    clip: auto;
    white-space: normal;
}
