/* ===========================================
   XRAIL DEMO - HACKER TERMINAL AESTHETIC
   =========================================== */

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

/* Root variables - Matching index.html theme */
:root {
    /* Primary - Electric Blue */
    --primary: #0066FF;
    --primary-dark: #0052CC;
    --primary-light: #3D8BFF;

    /* Accent - Cyan */
    --accent: #00D9FF;
    --accent-dark: #00B8D4;

    /* Backgrounds */
    --bg-primary: #0A0E1A;
    --bg-secondary: #141B2E;
    --bg-terminal: #000000;
    --bg-card: #141B2E;
    --bg-hover: #1A2332;

    /* Text colors */
    --text-primary: #FFFFFF;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-accent: #00D9FF;
    --text-warning: #FFBE0B;
    --text-error: #EF4444;
    --text-success: #10B981;

    /* Terminal specific */
    --terminal-primary: #0066FF;
    --terminal-accent: #00D9FF;
    --border-color: #0066FF;

    /* Glow effects */
    --glow-primary: rgba(0, 102, 255, 0.5);
    --glow-accent: rgba(0, 217, 255, 0.5);
    --glow-secondary: rgba(0, 217, 255, 0.3);

    /* Gradients */
    --gradient: linear-gradient(135deg, #0066FF 0%, #00D9FF 100%);
    --gradient-subtle: linear-gradient(135deg, rgba(0, 102, 255, 0.1) 0%, rgba(0, 217, 255, 0.1) 100%);
}

/* Body setup */
.demo-body {
    margin: 0;
    padding: 0;
    font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Matrix rain canvas background */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.08;
    pointer-events: none;
}

/* Scanline effect */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0) 50%,
        rgba(0, 102, 255, 0.02) 50%
    );
    background-size: 100% 4px;
    z-index: 1;
    pointer-events: none;
    animation: scanline 8s linear infinite;
}

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

/* Noise effect */
.noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="300"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" /></filter><rect width="100%" height="100%" filter="url(%23noise)" opacity="0.05"/></svg>');
    z-index: 1;
    pointer-events: none;
    opacity: 0.03;
}

/* Back button */
.back-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.8);
    color: var(--primary);
    padding: 10px 20px;
    border: 2px solid var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 0 10px var(--glow-primary);
}

.back-btn:hover {
    background: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 20px var(--glow-primary);
    transform: translateX(-5px);
}

/* Main demo container */
.demo-container {
    position: relative;
    z-index: 2;
    max-width: 1600px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Demo header */
.demo-header {
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--primary);
    border-radius: 4px;
    box-shadow: 0 0 20px var(--glow-primary);
}

.header-line {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
    letter-spacing: 2px;
    color: var(--primary);
    text-shadow: 0 0 10px var(--glow-primary);
}

.header-line.sub {
    font-size: 14px;
    font-weight: normal;
    letter-spacing: 1px;
    margin-top: 10px;
}

.blink {
    animation: blink 1s step-end infinite;
}

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

/* Text color classes */
.text-accent { color: var(--accent); }
.text-primary { color: var(--primary); }
.text-success { color: var(--text-success); }
.text-warning { color: var(--text-warning); }
.text-muted { color: var(--text-muted); }
.text-error { color: var(--text-error); }

/* Info panel */
.info-panel {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.8);
    border-left: 4px solid var(--accent);
    border-radius: 4px;
}

.info-section {
    display: flex;
    margin-bottom: 8px;
    font-size: 13px;
}

.info-label {
    color: var(--accent);
    font-weight: bold;
    min-width: 150px;
    text-shadow: 0 0 5px var(--glow-accent);
}

.info-value {
    color: var(--text-primary);
    flex: 1;
}

.info-value.mono {
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

/* Control panel */
.control-panel {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

/* Demo buttons */
.demo-btn {
    padding: 15px 30px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border: 2px solid;
    background: rgba(0, 0, 0, 0.8);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    letter-spacing: 1px;
}

.demo-btn-primary {
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--glow-primary);
}

.demo-btn-primary:hover:not(:disabled) {
    background: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 25px var(--glow-primary);
    transform: translateY(-2px);
}

.demo-btn-secondary {
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--glow-accent);
}

.demo-btn-secondary:hover:not(:disabled) {
    background: var(--accent);
    color: var(--bg-primary);
    box-shadow: 0 0 25px var(--glow-accent);
    transform: translateY(-2px);
}

.demo-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-bracket {
    color: var(--accent);
    margin: 0 5px;
}

.btn-icon {
    margin-right: 10px;
}

/* Fullscreen terminal */
.fullscreen-terminal {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-terminal);
    border: 2px solid var(--primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow:
        0 0 30px var(--glow-primary),
        inset 0 0 100px rgba(0, 102, 255, 0.03);
    margin-bottom: 20px;
    min-height: 500px;
}

/* Terminal header */
.terminal-header {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(to bottom, #1a1a1a, #0a0a0a);
    border-bottom: 1px solid var(--primary);
    box-shadow: 0 2px 10px var(--glow-primary);
}

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

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.terminal-dot-red {
    background: #ff5f56;
    box-shadow: 0 0 5px #ff5f56;
}

.terminal-dot-yellow {
    background: #ffbd2e;
    box-shadow: 0 0 5px #ffbd2e;
}

.terminal-dot-green {
    background: #27c93f;
    box-shadow: 0 0 5px #27c93f;
}

.terminal-title {
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    color: var(--primary);
    text-shadow: 0 0 10px var(--glow-primary);
}

.terminal-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: var(--text-success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--text-success);
    animation: pulse 2s infinite;
}

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

.status-text {
    color: var(--text-success);
    font-weight: bold;
}

/* Typing animation */
.typing-text {
    display: inline-block;
    overflow: hidden;
    border-right: 2px solid var(--primary);
    white-space: nowrap;
    animation: typing 3s steps(30) infinite, blink-cursor 0.75s step-end infinite;
}

@keyframes typing {
    0%, 100% { width: 0; }
    50% { width: 100%; }
}

@keyframes blink-cursor {
    50% { border-color: transparent; }
}

/* Terminal body */
.terminal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    background: var(--bg-terminal);
    color: var(--text-primary);
}

.terminal-body::-webkit-scrollbar {
    width: 10px;
}

.terminal-body::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
    box-shadow: 0 0 10px var(--glow-primary);
}

/* Terminal lines */
.terminal-line {
    margin-bottom: 4px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.terminal-line.terminal-boot {
    color: var(--primary);
    text-shadow: 0 0 5px var(--glow-primary);
}

.terminal-line.terminal-info {
    color: var(--text-primary);
}

.terminal-line.terminal-success {
    color: var(--text-success);
    text-shadow: 0 0 5px rgba(16, 185, 129, 0.5);
}

.terminal-line.terminal-error {
    color: var(--text-error);
    text-shadow: 0 0 5px rgba(255, 0, 81, 0.5);
}

.terminal-line.terminal-warning {
    color: var(--text-warning);
    text-shadow: 0 0 5px rgba(255, 190, 11, 0.5);
}

.terminal-line.terminal-primary {
    color: var(--primary);
    text-shadow: 0 0 5px var(--glow-primary);
}

.terminal-line.terminal-accent {
    color: var(--accent);
    text-shadow: 0 0 5px var(--glow-accent);
}

.terminal-line.terminal-json {
    color: #64b5f6;
    margin-left: 20px;
    font-size: 13px;
}

.terminal-line.terminal-highlight {
    background: rgba(0, 102, 255, 0.1);
    padding: 8px;
    border-left: 3px solid var(--primary);
    margin: 8px 0;
}

.terminal-prompt {
    color: var(--accent);
    font-weight: bold;
    margin-right: 8px;
    text-shadow: 0 0 5px var(--glow-accent);
}

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

.terminal-cursor-blink {
    display: inline-block;
    animation: blink 1s step-end infinite;
    color: var(--primary);
    text-shadow: 0 0 10px var(--glow-primary);
}

/* Terminal links */
.terminal-body a {
    color: var(--accent);
    text-decoration: underline;
    transition: all 0.3s;
}

.terminal-body a:hover {
    color: var(--primary);
    text-shadow: 0 0 10px var(--glow-primary);
}

/* Demo footer */
.demo-footer {
    text-align: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--text-muted);
    border-radius: 4px;
}

.footer-line {
    margin: 5px 0;
    font-size: 12px;
}

.footer-link {
    color: var(--accent);
    text-decoration: none;
    transition: all 0.3s;
}

.footer-link:hover {
    color: var(--primary);
    text-shadow: 0 0 10px var(--glow-primary);
}

/* Glitch effect for errors */
@keyframes glitch {
    0% {
        transform: translate(0);
    }
    20% {
        transform: translate(-2px, 2px);
    }
    40% {
        transform: translate(-2px, -2px);
    }
    60% {
        transform: translate(2px, 2px);
    }
    80% {
        transform: translate(2px, -2px);
    }
    100% {
        transform: translate(0);
    }
}

.terminal-line.terminal-error {
    animation: glitch 0.3s;
}

/* Responsive design */
@media (max-width: 768px) {
    .demo-container {
        padding: 20px 10px;
    }

    .back-btn {
        display: none;
    }

    .header-line {
        font-size: 14px;
    }

    .header-line.sub {
        font-size: 12px;
    }

    .info-section {
        flex-direction: column;
        gap: 5px;
    }

    .info-label {
        min-width: auto;
    }

    .control-panel {
        flex-direction: column;
    }

    .demo-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 13px;
    }

    .fullscreen-terminal {
        min-height: 400px;
    }

    .terminal-body {
        font-size: 12px;
        padding: 15px;
    }
}

/* Loading animation */
@keyframes loading {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

.loading::after {
    content: '.';
    animation: loading 1.5s infinite;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.terminal-line {
    animation: fadeIn 0.3s ease-out;
}
