:root {
    /* Dark theme - Cybersecurity aesthetics */
    --bg-dark: #0a0a0a;
    --bg-secondary-dark: #1a1a2e;
    --text-dark: #00ff88;
    --text-secondary-dark: #a0a0a0;
    --prompt-dark: #00d9ff;
    --border-dark: #00ff88;
    --accent-dark: #ff0040;
    --link-dark: #00d9ff;
    --link-hover-dark: #ffffff;
    --success-dark: #00ff88;
    --error-dark: #ff0040;
    --warning-dark: #ffaa00;
    
    /* Light theme - Professional cybersecurity */
    --bg-light: #f5f7fa;
    --bg-secondary-light: #ffffff;
    --text-light: #2c3e50;
    --text-secondary-light: #7f8c8d;
    --prompt-light: #3498db;
    --border-light: #34495e;
    --accent-light: #e74c3c;
    --link-light: #3498db;
    --link-hover-light: #2980b9;
    --success-light: #27ae60;
    --error-light: #e74c3c;
    --warning-light: #f39c12;
    
    /* Default to dark theme */
    --background: var(--bg-dark);
    --bg-secondary: var(--bg-secondary-dark);
    --text: var(--text-dark);
    --text-secondary: var(--text-secondary-dark);
    --prompt: var(--prompt-dark);
    --border: var(--border-dark);
    --accent: var(--accent-dark);
    --link: var(--link-dark);
    --link-hover: var(--link-hover-dark);
    --success: var(--success-dark);
    --error: var(--error-dark);
    --warning: var(--warning-dark);
}

html {
    box-sizing: border-box;
}
*, *:before, *:after {
    box-sizing: inherit;
}

body {
    background-color: var(--background);
    color: var(--text);
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    margin: 0;
    padding: 10px;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Light theme class */
body.light-theme {
    --background: var(--bg-light);
    --bg-secondary: var(--bg-secondary-light);
    --text: var(--text-light);
    --text-secondary: var(--text-secondary-light);
    --prompt: var(--prompt-light);
    --border: var(--border-light);
    --accent: var(--accent-light);
    --link: var(--link-light);
    --link-hover: var(--link-hover-light);
    --success: var(--success-light);
    --error: var(--error-light);
    --warning: var(--warning-light);
}

#terminal {
    border: 2px solid var(--border);
    padding: 15px;
    padding-top: clamp(60px, 8vw, 80px); /* Responsive top padding for fixed buttons */
    height: calc(100vh - 50px);
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 20px var(--border), inset 0 0 50px rgba(0, 255, 136, 0.1);
    animation: flicker 0.5s infinite, crt-glow 2s ease-in-out infinite alternate;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--background) 0%, var(--bg-secondary) 100%);
    /* Terminal window styling */
    margin-top: 30px;
}

/* Terminal window header */
#terminal::after {
    content: "● ● ●";
    position: absolute;
    top: -30px;
    left: 0;
    right: 0;
    height: 30px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    padding-left: 15px;
    font-size: 12px;
    color: var(--text-secondary);
    z-index: 5;
}

@keyframes crt-glow {
    0% { box-shadow: 0 0 20px var(--border), inset 0 0 50px rgba(0, 255, 136, 0.1); }
    100% { box-shadow: 0 0 30px var(--border), inset 0 0 60px rgba(0, 255, 136, 0.2); }
}

/* Enhanced responsive design */
@media (max-width: 768px) {
    body {
        padding: 5px;
        font-size: 14px;
    }
    
    #terminal {
        padding: 10px;
        height: calc(100vh - 30px);
        border-radius: 4px;
    }
    
    .prompt {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 12px;
    }
    
    #terminal {
        padding: 8px;
        border-width: 1px;
    }
    
    .prompt {
        margin-right: 5px;
    }
}

/* Enhanced CRT Scanlines Effect */
#terminal::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: 
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
        linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06)),
        linear-gradient(0deg, transparent 50%, rgba(0, 255, 136, 0.03) 50%);
    z-index: 2;
    background-size: 100% 4px, 3px 100%, 100% 2px;
    pointer-events: none;
    animation: scanlines 0.1s linear infinite;
}

@keyframes scanlines {
    0% { background-position: 0 0, 0 0, 0 0; }
    100% { background-position: 0 4px, 0 0, 0 2px; }
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.9; }
}

#output {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.prompt-line {
    display: flex;
    align-items: center;
}

.prompt {
    color: var(--prompt);
    margin-right: 10px;
    white-space: nowrap;
}

#input {
    background: transparent;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: inherit;
    flex-grow: 1;
    outline: none;
    caret-color: var(--text);
    position: relative;
}

/* Blinking cursor effect */
#input::after {
    content: "█";
    color: var(--text);
    animation: blink 1s infinite;
    margin-left: 2px;
}

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

/* Typing animation for command output */
.typing {
    overflow: hidden;
    border-right: 2px solid var(--text);
    white-space: nowrap;
    animation: typing 2s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--text); }
}

.command-output {
    margin-bottom: 10px;
}

.command-output .prompt {
    color: var(--prompt);
}

a {
    color: var(--link);
    text-decoration: underline;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: none;
    text-shadow: 0 0 5px var(--link-hover);
}

.error {
    color: var(--error);
}

.success {
    color: var(--success);
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.3s ease;
    z-index: 1000;
}

.theme-toggle:hover {
    background: var(--border);
    color: var(--background);
    box-shadow: 0 0 10px var(--border);
}

.corner-btn {
    position: absolute;
    top: 16px;
    z-index: 10;
}

#themeToggle.corner-btn {
    left: 16px;
    padding: 4px 8px;
    font-size: 18px;
    width: 36px;
    height: 36px;
    min-width: 0;
    min-height: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#resumeDownload.corner-btn {
    right: 16px;
}

/* Command categories for better organization */
.command-category {
    color: var(--accent);
    font-weight: bold;
    margin-top: 10px;
}

.command-description {
    color: var(--text-secondary);
    font-style: italic;
}

/* Status indicators */
.status-online {
    color: var(--success);
}

.status-offline {
    color: var(--error);
}

.status-warning {
    color: var(--warning);
}

/* 
   CSS CTF Challenge: For the dedicated few who examine stylesheets...
   You've found the expert-level flag: flag{pwn3d_th3_t3rm1n4l}
   
   ██████╗ ██╗    ██╗███╗   ██╗███████╗██████╗     ██████╗██╗   ██╗    ██████╗███████╗███████╗
   ██╔══██╗██║    ██║████╗  ██║██╔════╝██╔══██╗    ██╔══██╗╚██╗ ██╔╝    ██╔════╝██╔════╝██╔════╝
   ██████╔╝██║ █╗ ██║██╔██╗ ██║█████╗  ██║  ██║    ██████╔╝ ╚████╔╝     ██║     ███████╗███████╗
   ██╔═══╝ ██║███╗██║██║╚██╗██║██╔══╝  ██║  ██║    ██╔══██╗  ╚██╔╝      ██║     ╚════██║╚════██║
   ██║     ╚███╔███╔╝██║ ╚████║███████╗██████╔╝    ██████╔╝   ██║       ╚██████╗███████║███████║
   ╚═╝      ╚══╝╚══╝ ╚═╝  ╚═══╝╚══════╝╚═════╝     ╚═════╝    ╚═╝        ╚═════╝╚══════╝╚══════╝
   
   Congratulations! You've demonstrated advanced reconnaissance skills.
*/

/* Skill bars for skills visualization */
.skill-bar {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    height: 20px;
    margin: 5px 0;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.skill-fill {
    background: linear-gradient(90deg, var(--success), var(--link));
    height: 100%;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    padding-left: 5px;
    font-size: 12px;
    color: var(--background);
    position: relative;
    overflow: hidden;
}

.skill-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: skillShine 2s infinite;
}

@keyframes skillShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* CTF Table styling */
.ctf-table {
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12px;
    width: 100%;
    max-width: 600px;
}

.ctf-table th,
.ctf-table td {
    border: 1px solid var(--border);
    padding: 4px 8px;
    text-align: left;
}

.ctf-table th {
    background: var(--bg-secondary);
    color: var(--success);
    font-weight: bold;
}

.ctf-table tr:nth-child(even) {
    background: rgba(0, 255, 136, 0.05);
}

/* Mobile responsiveness for tables */
@media (max-width: 768px) {
    .ctf-table {
        font-size: 10px;
    }
    
    .ctf-table th,
    .ctf-table td {
        padding: 2px 4px;
    }
}
