/* DATACOM-3000 Retro Computing Theme */
:root {
    /* Terminal Colors */
    --terminal-green: #00ff00;
    --terminal-amber: #ffb000;
    --terminal-bg: #0a0a0a;
    --terminal-bg-light: #1a1a1a;
    --terminal-border: #333333;
    --terminal-glow: rgba(0, 255, 0, 0.5);
    --terminal-text: #00ff00;
    --terminal-dim: #00aa00;
    
    /* System Colors */
    --error-red: #ff0040;
    --warning-yellow: #ffff00;
    --info-cyan: #00ffff;
    
    /* Typography */
    --font-mono: 'Courier New', Courier, monospace;
    --font-size-base: 14px;
    --line-height: 1.4;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    
    /* Effects */
    --scanline-opacity: 0.05;
    --crt-curve: 0.02;
}

/* Global Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    background-color: #000;
    color: var(--terminal-text);
    overflow: hidden;
    text-transform: uppercase;
}

/* CRT Effect Container */
.terminal-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    background-color: var(--terminal-bg);
    border: 2px solid var(--terminal-border);
    overflow: hidden;
    box-shadow: 
        inset 0 0 20px rgba(0, 255, 0, 0.1),
        0 0 40px var(--terminal-glow);
}

/* Terminal Header */
.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--terminal-bg-light);
    border-bottom: 2px solid var(--terminal-border);
}

.terminal-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.terminal-icon {
    color: var(--terminal-amber);
    animation: blink 2s infinite;
}

.terminal-title h1 {
    font-size: 16px;
    font-weight: normal;
    letter-spacing: 2px;
}

.terminal-controls {
    display: flex;
    gap: var(--spacing-xs);
}

.terminal-btn {
    width: 20px;
    height: 20px;
    background-color: transparent;
    border: 1px solid var(--terminal-text);
    color: var(--terminal-text);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    transition: all 0.2s;
}

.terminal-btn:hover {
    background-color: var(--terminal-text);
    color: var(--terminal-bg);
    box-shadow: 0 0 10px var(--terminal-glow);
}

/* Command Bar */
.command-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--terminal-bg-light);
    border-bottom: 1px solid var(--terminal-border);
}

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

.prompt-symbol {
    color: var(--terminal-amber);
    margin-right: var(--spacing-sm);
}

.command-input {
    flex: 1;
    background-color: transparent;
    border: none;
    color: var(--terminal-text);
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

.command-input::placeholder {
    color: var(--terminal-dim);
}

.status-indicators {
    display: flex;
    gap: var(--spacing-md);
}

.indicator {
    padding: 2px 8px;
    border: 1px solid var(--terminal-text);
    font-size: 12px;
}

.indicator[data-status="active"] {
    background-color: var(--terminal-text);
    color: var(--terminal-bg);
    animation: pulse 2s infinite;
}

.indicator[data-status="idle"] {
    color: var(--terminal-dim);
    border-color: var(--terminal-dim);
}

/* Data Explorer Main Area */
.data-explorer {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
}

/* Controls Panel */
.controls-panel {
    display: flex;
    gap: var(--spacing-lg);
    padding: var(--spacing-md);
    background-color: var(--terminal-bg-light);
    border-bottom: 1px solid var(--terminal-border);
}

.filter-group,
.sort-group,
.action-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.control-label {
    color: var(--terminal-amber);
    font-size: 12px;
}

.filter-input,
.sort-select {
    background-color: var(--terminal-bg);
    border: 1px solid var(--terminal-border);
    color: var(--terminal-text);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

.filter-input:focus,
.sort-select:focus {
    border-color: var(--terminal-text);
    box-shadow: 0 0 5px var(--terminal-glow);
}

.sort-direction {
    background-color: transparent;
    border: 1px solid var(--terminal-border);
    color: var(--terminal-text);
    padding: var(--spacing-xs);
    cursor: pointer;
    font-family: inherit;
}

.action-btn {
    background-color: var(--terminal-bg);
    border: 1px solid var(--terminal-border);
    color: var(--terminal-text);
    padding: var(--spacing-xs) var(--spacing-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: var(--terminal-text);
    box-shadow: 0 0 10px var(--terminal-glow);
    transform: translateY(-1px);
}

.btn-icon {
    color: var(--terminal-amber);
}

/* Data Viewport */
.data-viewport {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Data Table */
.data-table-wrapper {
    flex: 1;
    overflow: auto;
    background-color: var(--terminal-bg);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.column-header {
    position: relative;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--terminal-bg-light);
    border: 1px solid var(--terminal-border);
    color: var(--terminal-amber);
    text-align: left;
    cursor: pointer;
    user-select: none;
}

.column-header:hover {
    background-color: #2a2a2a;
}

.header-text {
    display: inline-block;
}

.resize-handle {
    position: absolute;
    right: 0;
    top: 0;
    width: 4px;
    height: 100%;
    cursor: col-resize;
    background-color: transparent;
}

.resize-handle:hover {
    background-color: var(--terminal-text);
}

.data-table tbody tr {
    border-bottom: 1px solid var(--terminal-border);
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: var(--terminal-bg-light);
}

.data-table tbody tr.selected {
    background-color: rgba(0, 255, 0, 0.1);
    box-shadow: inset 0 0 20px var(--terminal-glow);
}

.data-table td {
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--terminal-text);
    font-size: 13px;
}

/* Data Preview */
.data-preview {
    width: 300px;
    background-color: var(--terminal-bg-light);
    border-left: 2px solid var(--terminal-border);
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--terminal-border);
}

.preview-header h3 {
    font-size: 14px;
    font-weight: normal;
    color: var(--terminal-amber);
}

.preview-close {
    background-color: transparent;
    border: 1px solid var(--terminal-text);
    color: var(--terminal-text);
    padding: 2px 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
}

.preview-content {
    flex: 1;
    padding: var(--spacing-md);
    overflow: auto;
}

.ascii-art {
    color: var(--terminal-dim);
    font-size: 12px;
    line-height: 1.2;
}

/* Status Bar */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--terminal-bg-light);
    border-top: 2px solid var(--terminal-border);
}

.memory-usage {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.memory-bar {
    width: 100px;
    height: 10px;
    background-color: var(--terminal-bg);
    border: 1px solid var(--terminal-border);
    position: relative;
    overflow: hidden;
}

.memory-used {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 62.5%;
    background-color: var(--terminal-text);
    animation: memory-pulse 3s infinite;
}

.label {
    color: var(--terminal-amber);
    font-size: 12px;
}

.memory-text,
#record-count,
#system-time {
    font-size: 12px;
}

/* CRT Scanlines Effect */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(
        transparent 50%,
        rgba(0, 255, 0, var(--scanline-opacity)) 50%
    );
    background-size: 100% 4px;
    animation: scanlines 8s linear infinite;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes memory-pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

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

::-webkit-scrollbar-thumb {
    background-color: var(--terminal-dim);
    border: 1px solid var(--terminal-border);
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--terminal-text);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .data-preview {
        position: absolute;
        right: 0;
        top: 0;
        height: 100%;
        transform: translateX(100%);
        transition: transform 0.3s;
    }
    
    .data-preview.active {
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .controls-panel {
        flex-wrap: wrap;
    }
    
    .action-group {
        width: 100%;
        justify-content: space-between;
    }
}

/* Accessibility Focus Styles */
*:focus {
    outline: 2px solid var(--terminal-amber);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .terminal-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .scanlines {
        display: none;
    }
    
    * {
        color: #000 !important;
        background-color: #fff !important;
    }
}