/* =================================================================== */
/* CONSOLIDATED TERMINAL STYLES - Complete Portfolio Stylesheet */
/* Author: Richard Cash */
/* Version: 2.0 - Optimized and Consolidated */
/* =================================================================== */

/* CSS Custom Properties - Theme Variables */
:root {
    /* Theme Variables - Managed by ThemeManager */
    --theme-primary: #00ff00;
    --theme-secondary: #00aa00;
    --theme-background: #000000;
    --theme-surface: #1a1a1a;
    --theme-error: #ff4444;
    --theme-warning: #ffaa00;
    --theme-info: #4444ff;
    --theme-success: #44ff44;
    --theme-text: #ffffff;
    --theme-text-secondary: #cccccc;
    
    /* Terminal Specific Variables */
    --terminal-font: 'JetBrains Mono', 'Courier New', 'Monaco', 'Menlo', monospace;
    --terminal-bg: var(--theme-background);
    --terminal-text: var(--theme-primary);
    --terminal-border: #333333;
    --terminal-selection: rgba(0, 255, 0, 0.3);
    
    /* Layout Variables */
    --header-height: 40px;
    --footer-height: 32px;
    --input-height: 56px;
    --border-radius: 8px;
    --border-radius-small: 4px;
    
    /* Animation Variables */
    --cursor-blink: 1s;
    --fade-duration: 0.3s;
    --slide-duration: 0.2s;
    --pulse-duration: 2s;
    
    /* Spacing Variables */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --spacing-2xl: 24px;
}

/* =================================================================== */
/* GLOBAL RESET AND BASE STYLES */
/* =================================================================== */

/* Modern CSS Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Root Element */
html {
    font-size: 14px;
    line-height: 1.4;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Body Styles */
body {
    font-family: var(--terminal-font);
    background: var(--terminal-bg);
    color: var(--terminal-text);
    overflow: hidden;
    height: 100vh;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
}

/* =================================================================== */
/* ACCESSIBILITY FEATURES */
/* =================================================================== */

/* Skip Links for Screen Readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--theme-info);
    color: white;
    padding: var(--spacing-sm);
    text-decoration: none;
    border-radius: var(--border-radius-small);
    z-index: 10000;
    font-weight: 500;
    transition: top var(--fade-duration) ease;
}

.skip-link:focus {
    top: 6px;
    outline: 2px solid var(--theme-primary);
    outline-offset: 2px;
}

/* Focus Management */
*:focus {
    outline: 2px solid var(--theme-primary);
    outline-offset: 1px;
}

.terminal-input:focus {
    outline: none; /* Terminal input has custom cursor */
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --theme-primary: #ffffff;
        --theme-background: #000000;
        --terminal-border: #ffffff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =================================================================== */
/* MAIN TERMINAL CONTAINER */
/* =================================================================== */

.terminal-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--terminal-bg);
    position: relative;
    overflow: hidden;
}

/* =================================================================== */
/* TERMINAL HEADER */
/* =================================================================== */

.terminal-header {
    background: var(--theme-surface);
    border-bottom: 1px solid var(--terminal-border);
    padding: var(--spacing-sm) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: var(--header-height);
    z-index: 100;
    user-select: none;
}

.terminal-title {
    font-weight: 500;
    color: var(--theme-text);
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.terminal-controls {
    display: flex;
    gap: var(--spacing-sm);
}

.control-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity var(--fade-duration) ease, transform 0.1s ease;
}

.control-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn.close { 
    background: #ff5f56; 
}

.control-btn.minimize { 
    background: #ffbd2e; 
}

.control-btn.maximize { 
    background: #27ca3f; 
}

/* =================================================================== */
/* TERMINAL CONTENT AREA */
/* =================================================================== */

.terminal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Terminal Output Area */
.terminal-output {
    flex: 1;
    padding: var(--spacing-lg);
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.5;
    scroll-behavior: smooth;
    font-variant-ligatures: none; /* Disable ligatures for better terminal feel */
    word-wrap: break-word;
    hyphens: none;
}

/* Custom Scrollbar */
.terminal-output::-webkit-scrollbar {
    width: 8px;
}

.terminal-output::-webkit-scrollbar-track {
    background: var(--theme-surface);
}

.terminal-output::-webkit-scrollbar-thumb {
    background: var(--terminal-border);
    border-radius: var(--border-radius-small);
    transition: background var(--fade-duration) ease;
}

.terminal-output::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox Scrollbar */
.terminal-output {
    scrollbar-width: thin;
    scrollbar-color: var(--terminal-border) var(--theme-surface);
}

/* =================================================================== */
/* TERMINAL INPUT AREA */
/* =================================================================== */

.terminal-input-container {
    border-top: 1px solid var(--terminal-border);
    background: var(--theme-surface);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    min-height: var(--input-height);
}

.terminal-prompt {
    color: var(--theme-secondary);
    white-space: nowrap;
    font-weight: 500;
    font-size: 1rem;
    user-select: none;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--terminal-text);
    font-family: inherit;
    font-size: 1rem;
    caret-color: var(--theme-primary);
    line-height: 1.5;
}

.terminal-input::placeholder {
    color: var(--theme-text-secondary);
    opacity: 0.6;
}

.terminal-input::selection {
    background: var(--terminal-selection);
}

/* =================================================================== */
/* OUTPUT STYLING */
/* =================================================================== */

.output-line {
    margin-bottom: var(--spacing-xs);
    word-wrap: break-word;
    animation: fadeIn var(--fade-duration) ease-in;
    line-height: 1.6;
}

.output-line:last-child {
    margin-bottom: var(--spacing-sm);
}

/* Fade-in Animation for New Output */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(2px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* =================================================================== */
/* TEXT STYLING CLASSES */
/* =================================================================== */

/* Status Colors */
.success { 
    color: var(--theme-success); 
    font-weight: 500;
}

.error { 
    color: var(--theme-error); 
    font-weight: 500;
}

.warning { 
    color: var(--theme-warning); 
    font-weight: 500;
}

.info { 
    color: var(--theme-info); 
    font-weight: 500;
}

.comment { 
    color: var(--theme-text-secondary); 
    opacity: 0.8; 
    font-style: italic;
}

.highlight { 
    background: var(--theme-primary); 
    color: var(--terminal-bg); 
    padding: 2px 4px; 
    border-radius: 2px; 
    font-weight: 500;
}

/* Text Emphasis */
.bold { font-weight: 700; }
.italic { font-style: italic; }
.underline { text-decoration: underline; }

/* =================================================================== */
/* LINKS AND INTERACTIVE ELEMENTS */
/* =================================================================== */

a {
    color: var(--theme-info);
    text-decoration: underline;
    transition: color var(--fade-duration) ease;
}

a:hover {
    color: var(--theme-primary);
    text-decoration: none;
}

a:visited {
    color: #8888ff;
}

a:focus {
    outline: 2px solid var(--theme-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* =================================================================== */
/* CODE BLOCKS AND FORMATTING */
/* =================================================================== */

code {
    background: var(--theme-surface);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: inherit;
    font-size: 0.9em;
    border: 1px solid var(--terminal-border);
}

pre {
    background: var(--theme-surface);
    padding: var(--spacing-md);
    border-radius: 6px;
    overflow-x: auto;
    margin: var(--spacing-sm) 0;
    border-left: 3px solid var(--theme-primary);
    font-family: inherit;
    line-height: 1.4;
}

pre code {
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
}

/* Tables */
table {
    border-collapse: collapse;
    width: 100%;
    margin: var(--spacing-md) 0;
}

th, td {
    border: 1px solid var(--terminal-border);
    padding: var(--spacing-sm);
    text-align: left;
}

th {
    background: var(--theme-surface);
    font-weight: 600;
    color: var(--theme-secondary);
}

/* =================================================================== */
/* TERMINAL FOOTER */
/* =================================================================== */

.terminal-footer {
    background: var(--theme-surface);
    border-top: 1px solid var(--terminal-border);
    padding: 6px var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--theme-text-secondary);
    min-height: var(--footer-height);
    user-select: none;
}

.footer-left,
.footer-center,
.footer-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    animation: pulse var(--pulse-duration) infinite;
}

.status-indicator.online { 
    background: var(--theme-success); 
}

.status-indicator.warning { 
    background: var(--theme-warning); 
}

.status-indicator.error { 
    background: var(--theme-error); 
}

.status-indicator.offline {
    background: #666;
    animation: none;
}

@keyframes pulse {
    0%, 50% { opacity: 1; }
    25%, 75% { opacity: 0.5; }
}

.separator {
    margin: 0 var(--spacing-md);
    opacity: 0.5;
}

.hint-text {
    font-style: italic;
    opacity: 0.7;
}

/* =================================================================== */
/* GUI WINDOW STYLES */
/* =================================================================== */

.gui-window {
    font-family: var(--terminal-font);
    background: var(--theme-surface);
    border: 1px solid var(--terminal-border);
    border-radius: var(--border-radius);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    position: fixed;
    z-index: 1000;
    min-width: 300px;
    min-height: 200px;
}

.title-bar {
    background: linear-gradient(135deg, var(--theme-surface), #2a2a2a);
    border-bottom: 1px solid var(--terminal-border);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    min-height: 36px;
}

.title-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 500;
    color: var(--theme-text);
}

.window-icon {
    font-size: 1.1em;
}

.window-title {
    font-size: 0.9rem;
}

.window-controls {
    display: flex;
    gap: var(--spacing-xs);
}

.window-controls button {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--fade-duration) ease;
}

.minimize-btn {
    background: var(--theme-warning);
    color: #000;
}

.maximize-btn {
    background: var(--theme-success);
    color: #000;
}

.close-btn {
    background: var(--theme-error);
    color: white;
}

.window-controls button:hover {
    opacity: 0.8;
}

.window-content {
    background: var(--terminal-bg);
    color: var(--terminal-text);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    overflow: auto;
    flex: 1;
    padding: var(--spacing-md);
}

/* Resize Handle */
.resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    background: linear-gradient(-45deg, transparent 0%, transparent 30%, #666 30%, #666 40%, transparent 40%);
    cursor: se-resize;
    z-index: 1001;
}

/* =================================================================== */
/* SECURITY ALERT MODAL */
/* =================================================================== */

.security-alert {
    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: 10000;
    backdrop-filter: blur(4px);
}

.alert-content {
    background: var(--theme-surface);
    border: 2px solid var(--theme-error);
    border-radius: var(--border-radius);
    padding: var(--spacing-2xl);
    max-width: 400px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.alert-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.alert-icon {
    font-size: 1.5rem;
}

.alert-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--theme-error);
}

.alert-message {
    margin-bottom: var(--spacing-xl);
    line-height: 1.5;
    color: var(--theme-text);
}

.alert-button {
    background: var(--theme-error);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background var(--fade-duration) ease, transform 0.1s ease;
}

.alert-button:hover {
    background: #cc3333;
    transform: translateY(-1px);
}

.alert-button:active {
    transform: translateY(0);
}

/* =================================================================== */
/* LOADING SCREEN */
/* =================================================================== */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--terminal-bg);
    color: var(--theme-primary);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    font-family: var(--terminal-font);
}

.loading-content {
    text-align: center;
    max-width: 600px;
    padding: var(--spacing-xl);
}

.loading-title {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-xl);
    color: var(--theme-primary);
}

.loading-status {
    font-size: 1rem;
    margin-bottom: var(--spacing-2xl);
    color: var(--theme-text-secondary);
}

.loading-progress {
    width: 300px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto var(--spacing-xl);
}

.loading-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--theme-secondary), var(--theme-primary));
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* =================================================================== */
/* NOTIFICATION SYSTEM */
/* =================================================================== */

#notification-container {
    position: fixed;
    top: var(--spacing-xl);
    right: var(--spacing-xl);
    z-index: 10000;
    pointer-events: none;
}

.notification {
    background: var(--theme-info);
    color: white;
    padding: var(--spacing-md) var(--spacing-xl);
    margin-bottom: 10px;
    border-radius: var(--border-radius-small);
    font-family: var(--terminal-font);
    font-size: 0.9rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    cursor: pointer;
    transform: translateX(100%);
    transition: transform var(--fade-duration) ease;
    max-width: 300px;
    word-wrap: break-word;
}

.notification.success { background: var(--theme-success); }
.notification.warning { background: var(--theme-warning); color: #000; }
.notification.error { background: var(--theme-error); }

.notification.show {
    transform: translateX(0);
}

/* =================================================================== */
/* RESPONSIVE DESIGN */
/* =================================================================== */

/* Tablet and Small Desktop */
@media (max-width: 1024px) {
    .terminal-output {
        font-size: 0.95rem;
    }
    
    .gui-window {
        max-width: 90vw;
        max-height: 90vh;
    }
}

/* Mobile and Small Tablet */
@media (max-width: 768px) {
    :root {
        --spacing-lg: 12px;
        --spacing-md: 8px;
    }
    
    .terminal-header {
        padding: 6px var(--spacing-md);
    }
    
    .terminal-title {
        font-size: 0.8rem;
    }
    
    .terminal-output {
        padding: var(--spacing-md);
        font-size: 0.9rem;
    }
    
    .terminal-input-container {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .terminal-input {
        font-size: 0.9rem;
    }
    
    .terminal-footer {
        padding: 4px var(--spacing-md);
        font-size: 0.75rem;
    }
    
    .terminal-footer .hint-text {
        display: none;
    }
    
    .gui-window {
        max-width: 95vw;
        max-height: 95vh;
        min-width: 280px;
    }
    
    .window-content {
        padding: var(--spacing-sm);
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .terminal-footer .footer-center {
        display: none;
    }
    
    .terminal-controls {
        gap: 4px;
    }
    
    .control-btn {
        width: 10px;
        height: 10px;
    }
    
    .terminal-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .alert-content {
        margin: var(--spacing-lg);
        padding: var(--spacing-lg);
    }
}

/* =================================================================== */
/* PRINT STYLES */
/* =================================================================== */

@media print {
    .terminal-container {
        height: auto;
        background: white;
        color: black;
    }
    
    .terminal-header,
    .terminal-footer,
    .terminal-input-container,
    .gui-window,
    .security-alert,
    .loading-screen {
        display: none !important;
    }
    
    .terminal-output {
        padding: var(--spacing-xl);
        overflow: visible;
        background: white;
        color: black;
    }
    
    .success { color: #008000; }
    .error { color: #800000; }
    .warning { color: #808000; }
    .info { color: #000080; }
    .highlight { 
        background: #f0f0f0; 
        color: black; 
        border: 1px solid #ccc;
    }
    
    a {
        color: #000080;
        text-decoration: underline;
    }
}

/* =================================================================== */
/* THEME VARIATIONS */
/* =================================================================== */

/* Dark Mode (Default) */
[data-theme="dark"] {
    --theme-primary: #00ff00;
    --theme-secondary: #00aa00;
    --theme-background: #000000;
    --theme-surface: #1a1a1a;
}

/* Cyberpunk Theme */
[data-theme="cyberpunk"] {
    --theme-primary: #ff0080;
    --theme-secondary: #8000ff;
    --theme-background: #0a0a0a;
    --theme-surface: #1a0a1a;
    --theme-info: #0088ff;
    --theme-success: #00ff88;
}

/* Matrix Theme */
[data-theme="matrix"] {
    --theme-primary: #00ff41;
    --theme-secondary: #008f11;
    --theme-background: #000000;
    --theme-surface: #001100;
    --theme-text: #00ff41;
    --theme-text-secondary: #008f11;
}

/* Light Theme (Optional) */
[data-theme="light"] {
    --theme-primary: #006600;
    --theme-secondary: #004400;
    --theme-background: #ffffff;
    --theme-surface: #f5f5f5;
    --theme-text: #000000;
    --theme-text-secondary: #666666;
    --terminal-border: #cccccc;
}

/* =================================================================== */
/* PERFORMANCE OPTIMIZATIONS */
/* =================================================================== */

/* GPU Acceleration for Animations */
.output-line,
.gui-window,
.notification {
    will-change: transform, opacity;
}

/* Contain Layout Shifts */
.terminal-output {
    contain: layout style paint;
}

.gui-window {
    contain: layout style;
}

/* Optimize Rendering */
.terminal-container {
    contain: strict;
}

/* =================================================================== */
/* UTILITY CLASSES */
/* =================================================================== */

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Spacing Utilities */
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }

/* Display Utilities */
.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.flex { display: flex; }

/* Flexbox Utilities */
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }

/* Border Utilities */
.border { border: 1px solid var(--terminal-border); }
.border-top { border-top: 1px solid var(--terminal-border); }
.border-bottom { border-bottom: 1px solid var(--terminal-border); }

/* Background Utilities */
.bg-surface { background: var(--theme-surface); }
.bg-primary { background: var(--theme-primary); }

/* =================================================================== */
/* END OF STYLESHEET */
/* =================================================================== */