/* ========== ADVANCED CSS VARIABLES & THEMING ========== */
:root {
    --primary: #0066ff;
    --primary-light: #3399ff;
    --primary-dark: #003366;
    --secondary: #00ff99;
    --secondary-dark: #00cc77;
    --accent: #00ffff;
    --accent-pink: #ff0099;
    --danger: #ff3333;
    --warning: #ffaa00;
    --success: #00ff66;
    
    --bg-darkest: #0a0e27;
    --bg-darker: #050810;
    --bg-dark: #0f1419;
    --bg-light: #1a1f3a;
    --bg-lighter: #2a2f4a;
    
    --border: #003366;
    --border-accent: #0099ff;
    --text-primary: #00ff00;
    --text-secondary: #00cc00;
    --text-muted: #666699;
    
    --shadow-sm: 0 2px 8px rgba(0, 255, 0, 0.1);
    --shadow-md: 0 8px 24px rgba(0, 255, 0, 0.15);
    --shadow-lg: 0 16px 48px rgba(0, 255, 0, 0.2);
    --glow: 0 0 20px rgba(0, 255, 255, 0.3);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* ========== RESET & BASE STYLES ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-darkest) 0%, var(--bg-darker) 100%);
    color: var(--text-primary);
    font-family: 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    display: flex;
    flex-direction: column;
}

/* ========== SCROLLBAR STYLING ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-accent);
    border-radius: 4px;
    transition: var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
    box-shadow: var(--glow);
}

/* ========== HEADER STYLES ========== */
.header-main {
    background: linear-gradient(180deg, var(--bg-light) 0%, var(--bg-dark) 100%);
    border-bottom: 2px solid var(--border-accent);
    box-shadow: 0 4px 16px rgba(0, 153, 255, 0.2);
    padding: 12px 16px;
    flex-shrink: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 20px;
    flex-wrap: wrap;
}

.header-branding {
    display: flex;
    align-items: center;
    gap: 10px;
}

h1 {
    font-size: 16px;
    font-weight: 700;
    color: var(--secondary);
    text-shadow: 0 0 10px var(--secondary);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.header-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 8px;
    border: 1px solid var(--border-accent);
    border-radius: 4px;
    background: rgba(0, 153, 255, 0.05);
}

.header-info {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(0, 255, 0, 0.05);
    border: 1px solid var(--text-primary);
    border-radius: 6px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.status-led {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #555;
    border: 2px solid var(--border);
    transition: var(--transition-fast);
    box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.8);
}

.status-led.running {
    background: var(--success);
    box-shadow: 0 0 10px var(--success), inset 0 0 5px rgba(0, 255, 0, 0.5);
    animation: pulse-glow 1.5s infinite;
}

.status-led.paused {
    background: var(--warning);
    box-shadow: 0 0 8px var(--warning);
}

.status-led.error {
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
    animation: pulse-error 1s infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 10px var(--success), inset 0 0 5px rgba(0, 255, 0, 0.5); }
    50% { box-shadow: 0 0 20px var(--success), inset 0 0 10px rgba(0, 255, 0, 0.8); }
}

@keyframes pulse-error {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.cpu-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(0, 255, 0, 0.05);
    border: 1px solid var(--border-accent);
    border-radius: 6px;
    font-size: 11px;
}

.cpu-info .label {
    color: var(--text-muted);
}

#cpu-freq-display {
    color: var(--accent);
    font-weight: 700;
    text-shadow: 0 0 5px var(--accent);
}

/* ========== TOOLBAR STYLES ========== */
.toolbar-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #000;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px;
    overflow: hidden;
}

.nav-arrow {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    transition: var(--transition-fast);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-arrow:hover {
    background: rgba(0, 255, 0, 0.1);
    border-color: var(--text-secondary);
    color: var(--accent);
}

.toolbar-carousel {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
    padding: 4px 0;
}

.toolbar-carousel::-webkit-scrollbar {
    display: none;
}

.tool-group {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: 12px;
    border-right: 1px solid var(--border);
    flex-wrap: wrap;
    min-width: max-content;
}

.tool-group:last-child {
    border-right: none;
}

/* ========== BUTTON STYLES ========== */
.btn-icon {
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-dark) 100%);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    font-weight: 600;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.btn-icon:hover {
    background: linear-gradient(135deg, var(--bg-lighter) 0%, var(--bg-light) 100%);
    border-color: var(--border-accent);
    color: var(--accent);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-icon:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 8px rgba(0, 255, 0, 0.1);
}

.btn-icon.primary {
    background: linear-gradient(135deg, var(--accent-pink) 0%, var(--primary) 100%);
    border-color: var(--accent-pink);
    color: #fff;
    text-shadow: 0 0 5px var(--accent-pink);
}

.btn-icon.primary:hover {
    box-shadow: 0 0 15px var(--accent-pink);
    border-color: var(--accent);
}

.custom-file-upload {
    position: relative;
}

.custom-file-upload input {
    display: none;
}

.custom-file-upload {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-dark) 100%);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    font-weight: 600;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.custom-file-upload:hover {
    background: linear-gradient(135deg, var(--bg-lighter) 0%, var(--bg-light) 100%);
    border-color: var(--border-accent);
    color: var(--accent);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-icon .icon {
    width: 14px;
    height: 14px;
}

/* ========== SWITCH TOGGLE STYLES ========== */
.switch-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition-fast);
    font-size: 10px;
    font-weight: 600;
}

.switch-label:hover {
    background: rgba(0, 255, 0, 0.05);
}

.switch-label input {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 12px;
    background: var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid var(--border);
    position: relative;
}

.switch-label input::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    top: 1px;
    left: 1px;
    transition: var(--transition-fast);
}

.switch-label input:checked {
    background: var(--text-primary);
    border-color: var(--text-primary);
}

.switch-label input:checked::before {
    left: 13px;
    background: var(--bg-dark);
}

/* ========== MAIN CONTAINER ========== */
.main-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle, var(--bg-dark) 0%, var(--bg-darkest) 100%);
    overflow: hidden;
    padding: 16px;
    position: relative;
}

.main-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.5) 100%);
    pointer-events: none;
    z-index: 1;
}

.vdu-wrapper {
    position: relative;
    z-index: 2;
}

.vdu-screen {
    display: block;
    border: 8px solid #222;
    box-shadow: 
        0 0 40px rgba(0, 0, 0, 0.8),
        inset 0 0 20px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(0, 255, 0, 0.1);
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    max-height: 95%;
    max-width: 100%;
    border-radius: 2px;
}

.vdu-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.15),
            rgba(0, 0, 0, 0.15) 1px,
            transparent 1px,
            transparent 2px
        );
    pointer-events: none;
    border-radius: 2px;
}

.vdu-glow {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 255, 0, 0.05) 100%);
    pointer-events: none;
    animation: screen-glow 3s ease-in-out infinite;
}

@keyframes screen-glow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* ========== TERMINAL STYLES ========== */
.terminal-section {
    height: 35vh;
    min-height: 200px;
    background: var(--bg-darker);
    border-top: 2px solid var(--border-accent);
    display: flex;
    flex-direction: column;
    position: relative;
    flex-shrink: 0;
    box-shadow: inset 0 4px 16px rgba(0, 153, 255, 0.1);
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(90deg, rgba(0, 51, 102, 0.3) 0%, rgba(0, 102, 255, 0.1) 100%);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.terminal-title {
    font-size: 11px;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 8px var(--accent);
}

.terminal-controls {
    display: flex;
    gap: 6px;
}

.term-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 3px;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.term-btn:hover {
    background: rgba(0, 255, 0, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.console-output {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

.console-output::-webkit-scrollbar-thumb {
    background: var(--border-accent);
}

.console-output::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.console-line {
    margin-bottom: 2px;
    padding: 2px 4px;
    border-radius: 2px;
    word-wrap: break-word;
    white-space: pre-wrap;
    transition: var(--transition-fast);
}

.console-line:hover {
    background: rgba(0, 255, 0, 0.05);
    border-left: 2px solid var(--accent);
    padding-left: 8px;
}

.console-line.success {
    color: var(--success);
    text-shadow: 0 0 5px var(--success);
}

.console-line.error {
    color: var(--danger);
    text-shadow: 0 0 5px var(--danger);
    background: rgba(255, 51, 51, 0.05);
}

.console-line.warning {
    color: var(--warning);
    text-shadow: 0 0 5px var(--warning);
}

.console-line.info {
    color: var(--accent);
}

.console-line.cpu {
    color: var(--accent-pink);
    font-weight: 600;
}

.console-line.memory {
    color: var(--accent);
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
}

.autocomplete-box {
    position: absolute;
    bottom: 45px;
    left: 16px;
    right: 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-accent);
    border-radius: 4px 4px 0 0;
    max-height: 150px;
    overflow-y: auto;
    display: none;
    z-index: 10;
    box-shadow: 0 -2px 12px rgba(0, 153, 255, 0.2);
}

.autocomplete-item {
    padding: 6px 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}

.autocomplete-item:hover {
    background: rgba(0, 255, 255, 0.1);
    color: var(--accent);
    padding-left: 16px;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

/* ========== INPUT WRAPPER ========== */
.input-wrapper {
    display: flex;
    align-items: center;
    background: #000;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    gap: 10px;
}

.prompt {
    color: var(--warning);
    font-weight: 700;
    font-family: 'Fira Code', monospace;
    white-space: nowrap;
    text-shadow: 0 0 5px var(--warning);
    letter-spacing: 1px;
}

.console-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary) !important;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    outline: none;
    display: block;
    caret-color: var(--accent);
}

.console-input::placeholder {
    color: var(--text-muted);
}

.console-input::selection {
    background: var(--accent);
    color: var(--bg-darker);
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 1200px) {
    .cpu-info {
        display: none;
    }
    
    .toolbar-carousel {
        gap: 4px;
    }
    
    .btn-icon span {
        display: none;
    }
}

@media (max-width: 768px) {
    header {
        padding: 8px 12px;
    }
    
    .header-top {
        margin-bottom: 8px;
    }
    
    h1 {
        font-size: 14px;
    }
    
    .header-subtitle {
        display: none;
    }
    
    .terminal-section {
        height: 40vh;
    }
    
    .vdu-screen {
        border: 4px solid #222;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 12px;
    }
    
    .header-info {
        gap: 8px;
    }
    
    .status-badge,
    .cpu-info {
        font-size: 9px;
        padding: 4px 8px;
    }
    
    .terminal-section {
        height: 45vh;
    }
    
    .console-output {
        font-size: 11px;
    }
    
    .prompt {
        font-size: 12px;
    }
}

/* ========== DARK MODE ENHANCEMENTS ========== */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    header,
    .terminal-section {
        display: none;
    }
    
    .main-container {
        background: white;
    }
    
    .vdu-screen {
        border: 1px solid #000;
    }
}
