/* Zenpower Retro Terminal CSS
 * CP/M / MS-DOS inspired aesthetic
 * CRT effects, scanlines, and glow
 */

:root {
  /* Color themes */
  --term-green: #00ff00;
  --term-green-dim: #00aa00;
  --term-green-glow: rgba(0, 255, 0, 0.3);
  --term-amber: #ffb000;
  --term-amber-dim: #cc8800;
  --term-amber-glow: rgba(255, 176, 0, 0.3);
  --term-cyan: #00ffff;
  --term-cyan-dim: #00aaaa;
  --term-cyan-glow: rgba(0, 255, 255, 0.3);

  /* Active theme (default: green) */
  --term-fg: var(--term-green);
  --term-fg-dim: var(--term-green-dim);
  --term-glow: var(--term-green-glow);
  --term-bg: #0a0a0a;
  --term-bg-light: #1a1a1a;
}

/* Theme classes */
.theme-amber {
  --term-fg: var(--term-amber);
  --term-fg-dim: var(--term-amber-dim);
  --term-glow: var(--term-amber-glow);
}

.theme-cyan {
  --term-fg: var(--term-cyan);
  --term-fg-dim: var(--term-cyan-dim);
  --term-glow: var(--term-cyan-glow);
}

/* Base terminal container */
.retro-terminal {
  position: relative;
  background: var(--term-bg);
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.4;
  color: var(--term-fg);
  overflow: hidden;
  border: 2px solid var(--term-fg-dim);
}

/* CRT Monitor Frame */
.crt-frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

/* Scanlines overlay */
.crt-scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 1px,
    rgba(0, 0, 0, 0.3) 1px,
    rgba(0, 0, 0, 0.3) 2px
  );
  pointer-events: none;
  z-index: 101;
}

/* CRT curvature vignette */
.crt-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(0, 0, 0, 0.4) 100%
  );
  pointer-events: none;
  z-index: 102;
}

/* Subtle flicker animation */
@keyframes crt-flicker {
  0%, 100% { opacity: 0.98; }
  50% { opacity: 1; }
}

.crt-flicker {
  animation: crt-flicker 0.1s infinite;
}

/* Screen glow */
.crt-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  box-shadow: inset 0 0 100px var(--term-glow);
  pointer-events: none;
  z-index: 99;
}

/* Effect layers */
.effect-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.effect-plasma { z-index: 1; }
.effect-fire { z-index: 2; }
.effect-matrix { z-index: 3; opacity: 0.3; }

/* Main terminal content */
.terminal-content {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 20px;
  box-sizing: border-box;
  z-index: 10;
  display: flex;
  flex-direction: column;
}

/* Output area */
.terminal-output {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Custom scrollbar */
.terminal-output::-webkit-scrollbar {
  width: 8px;
}

.terminal-output::-webkit-scrollbar-track {
  background: var(--term-bg-light);
}

.terminal-output::-webkit-scrollbar-thumb {
  background: var(--term-fg-dim);
  border-radius: 4px;
}

.terminal-output::-webkit-scrollbar-thumb:hover {
  background: var(--term-fg);
}

/* Input line */
.terminal-input-line {
  display: flex;
  align-items: center;
  margin-top: 8px;
  flex-shrink: 0;
}

.terminal-prompt {
  color: var(--term-fg);
  margin-right: 8px;
  white-space: nowrap;
}

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

.terminal-input::placeholder {
  color: var(--term-fg-dim);
  opacity: 0.5;
}

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

.terminal-cursor {
  display: inline-block;
  width: 0.6em;
  height: 1.2em;
  background: var(--term-fg);
  animation: blink 1s infinite;
  vertical-align: text-bottom;
}

/* Text styling */
.term-bright { color: var(--term-fg); text-shadow: 0 0 5px var(--term-glow); }
.term-dim { color: var(--term-fg-dim); }
.term-error { color: #ff4444; }
.term-success { color: #44ff44; }
.term-warning { color: #ffaa00; }
.term-info { color: #4488ff; }
.term-highlight { background: var(--term-fg); color: var(--term-bg); }

/* Box drawing styling */
.term-box {
  color: var(--term-fg-dim);
}

/* Boot sequence styling */
.boot-task { color: var(--term-fg-dim); }
.boot-ok { color: #44ff44; }
.boot-fail { color: #ff4444; }
.boot-ready { color: var(--term-fg); text-shadow: 0 0 10px var(--term-glow); }
.boot-hint { color: var(--term-fg-dim); }

/* Output line types */
.output-line { margin: 0; padding: 0; min-height: 1.4em; }
.output-line.system { color: var(--term-fg-dim); }
.output-line.error { color: #ff4444; }
.output-line.command { color: var(--term-fg); opacity: 0.8; }

/* ASCII art container */
.ascii-art {
  font-family: 'JetBrains Mono', monospace;
  white-space: pre;
  line-height: 1.2;
}

/* Matrix rain character */
.matrix-char {
  position: absolute;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--term-fg);
  text-shadow: 0 0 5px var(--term-glow);
  pointer-events: none;
}

.matrix-char.head {
  color: #ffffff;
  text-shadow: 0 0 10px #ffffff;
}

/* Fire effect character */
.fire-char {
  position: absolute;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  pointer-events: none;
}

/* Plasma character */
.plasma-char {
  position: absolute;
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  pointer-events: none;
}

/* Loading indicator */
.loading-dots::after {
  content: '';
  animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
  0% { content: '.'; }
  33% { content: '..'; }
  66% { content: '...'; }
  100% { content: ''; }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .retro-terminal {
    font-size: 12px;
  }

  .terminal-content {
    padding: 10px;
  }
}

@media (max-width: 480px) {
  .retro-terminal {
    font-size: 10px;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .crt-flicker,
  .terminal-cursor,
  .matrix-char,
  .loading-dots::after {
    animation: none;
  }

  .terminal-cursor {
    opacity: 1;
  }

  .effect-matrix,
  .effect-plasma,
  .effect-fire {
    display: none;
  }
}

/* Print styles - hide effects */
@media print {
  .crt-frame,
  .crt-scanlines,
  .crt-vignette,
  .crt-glow,
  .effect-layer {
    display: none;
  }

  .retro-terminal {
    background: white;
    color: black;
  }
}
