/* ========================================
   MRV777 Terminal - Main Styles
   Green Phosphor Theme
   ======================================== */

:root {
  /* Green phosphor colors */
  --green-bright: #00ff00;
  --green-medium: #00cc00;
  --green-dim: #009900;
  --green-dark: #004400;
  --green-glow: rgba(0, 255, 0, 0.4);
  /* RGB triplet for glow/box-shadow rgba() values so themes can recolor them */
  --glow-rgb: 0, 255, 0;

  /* Background colors */
  --bg-primary: #0a0a0a;
  --bg-secondary: #050505;
  --bg-terminal: #000000;

  /* Text colors */
  --text-primary: #00ff00;
  --text-secondary: #00cc00;
  --text-dim: #008800;
  --text-error: #ff4444;
  --text-warning: #ffaa00;
  --text-info: #00ccff;

  /* Fonts */
  --font-mono: 'Fira Code', 'Consolas', 'Monaco', monospace;
  --font-size-base: 16px;
  --font-size-small: 14px;
  --font-size-large: 18px;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
}

/* ----------------------------------------
   Phosphor themes (set via `theme` command).
   Override the color tokens; everything else
   references them, so the whole UI recolors.
   ---------------------------------------- */
html[data-theme="amber"] {
  --green-bright: #ffb000;
  --green-medium: #cc8800;
  --green-dim: #aa7000;
  --green-dark: #3a2800;
  --green-glow: rgba(255, 176, 0, 0.4);
  --glow-rgb: 255, 176, 0;
  --text-primary: #ffb000;
  --text-secondary: #cc8800;
  --text-dim: #aa7000;
}

html[data-theme="blue"] {
  --green-bright: #33ccff;
  --green-medium: #00aadd;
  --green-dim: #0088bb;
  --green-dark: #002633;
  --green-glow: rgba(51, 204, 255, 0.4);
  --glow-rgb: 51, 204, 255;
  --text-primary: #33ccff;
  --text-secondary: #00aadd;
  --text-dim: #0088bb;
  --text-info: #ffcc00;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-mono);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
}

/* Boot Screen */
.boot-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-terminal);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: var(--spacing-lg);
  z-index: 1000;
}

.boot-screen.hidden {
  display: none;
}

.boot-text {
  white-space: pre-wrap;
  line-height: 1.5;
  color: var(--text-primary);
  text-shadow: 0 0 5px var(--green-glow);
}

/* Terminal */
.terminal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-terminal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.terminal.hidden {
  display: none;
}

.terminal-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--spacing-lg);
  overflow: hidden;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

/* Output Area */
.output {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: var(--spacing-md);
  line-height: 1.6;
  word-wrap: break-word;
}

.output::-webkit-scrollbar {
  width: 8px;
}

.output::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.output::-webkit-scrollbar-thumb {
  background: var(--green-dark);
  border-radius: 4px;
}

.output::-webkit-scrollbar-thumb:hover {
  background: var(--green-dim);
}

/* Output text styling */
.output-line {
  margin-bottom: var(--spacing-xs);
}

.output-command {
  color: var(--text-secondary);
}

.output-command::before {
  content: 'visitor@mrv777:~$ ';
  color: var(--text-dim);
}

.output-result {
  color: var(--text-primary);
  padding-left: var(--spacing-sm);
}

.output-error {
  color: var(--text-error);
}

.output-warning {
  color: var(--text-warning);
}

.output-info {
  color: var(--text-info);
}

.output-ascii {
  color: var(--green-medium);
  line-height: 1.2;
}

/* Let wide preformatted blocks (ASCII banners, hex dumps) scroll on narrow
   screens instead of being clipped by the parent's overflow-x: hidden. */
.output pre {
  max-width: 100%;
  overflow-x: auto;
}

/* Output text utility classes (replaces repeated inline styles in JS) */
.t-dim { color: var(--text-dim); }
.t-info { color: var(--text-info); }
.t-bright { color: var(--green-bright); }
.t-error { color: var(--text-error); }
.t-info-bold { color: var(--text-info); font-weight: bold; }

.help-table { margin: 8px 0; }
.help-row { display: flex; margin: 4px 0; }
.help-cmd { color: var(--green-bright); min-width: 140px; }
.help-desc { color: var(--text-secondary); }

.project-year { color: var(--text-dim); font-size: 12px; margin-top: 8px; }
.history-desc { color: var(--text-dim); font-size: 13px; }
.hex-dump { font-size: 11px; line-height: 1.4; color: var(--text-secondary); }

/* btc network status dashboard — monospace board with aligned columns */
.btc-board { white-space: pre-wrap; line-height: 1.5; margin: 4px 0; }

/* neofetch layout — logo left, info right (stacks on narrow screens) */
.neofetch { display: flex; flex-wrap: wrap; gap: var(--spacing-lg); align-items: center; }
.nf-logo { margin: 0; flex-shrink: 0; font-size: 12px; line-height: 1.15; }
.nf-info { flex: 1 1 280px; min-width: 0; line-height: 1.55; }
.nf-title { margin-bottom: 2px; }
.nf-rule { color: var(--green-dark); margin-bottom: 4px; }
.nf-row { display: flex; gap: var(--spacing-sm); }
.nf-key { color: var(--text-secondary); min-width: 80px; flex-shrink: 0; font-weight: bold; }
.nf-val { color: var(--text-primary); min-width: 0; word-break: break-word; }

/* Input Line */
.input-line {
  display: flex;
  align-items: center;
  padding: var(--spacing-sm) 0;
  flex-shrink: 0;
}

.prompt {
  color: var(--text-dim);
  margin-right: var(--spacing-sm);
  white-space: nowrap;
}

.input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
}

.command-input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  outline: none;
  caret-color: var(--text-primary);
  text-shadow: 0 0 5px var(--green-glow);
}

/* Hide the custom cursor - use native caret instead */
.cursor {
  display: none;
}

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

/* Suggestions */
.suggestions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) 0;
  flex-wrap: wrap;
  flex-shrink: 0;
  border-top: 1px solid var(--green-dark);
  margin-top: var(--spacing-sm);
}

.suggestion-label {
  color: var(--text-dim);
  font-size: var(--font-size-small);
}

.cmd-btn {
  background: transparent;
  border: 1px solid var(--green-dim);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
  padding: var(--spacing-xs) var(--spacing-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 2px;
}

.cmd-btn:hover {
  background: var(--green-dark);
  border-color: var(--green-medium);
  color: var(--text-primary);
  text-shadow: 0 0 5px var(--green-glow);
  box-shadow: 0 0 10px var(--green-glow);
}

.cmd-btn:active {
  transform: scale(0.95);
}

/* Sound Toggle */
.sound-toggle {
  position: fixed;
  bottom: var(--spacing-md);
  right: var(--spacing-md);
  background: transparent;
  border: 1px solid var(--green-dark);
  color: var(--text-dim);
  width: 40px;
  height: 40px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 100;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sound-toggle:hover {
  border-color: var(--green-medium);
  color: var(--text-primary);
}

.sound-toggle.active {
  border-color: var(--green-bright);
  color: var(--text-primary);
  text-shadow: 0 0 5px var(--green-glow);
}

.sound-icon {
  font-size: 18px;
}

/* Project Cards */
.project-card {
  border: 1px solid var(--green-dark);
  padding: var(--spacing-md);
  margin: var(--spacing-sm) 0;
  background: rgba(0, 50, 0, 0.2);
  transition: all 0.2s ease;
}

.project-card:hover {
  border-color: var(--green-medium);
  background: rgba(0, 80, 0, 0.2);
  box-shadow: 0 0 15px rgba(var(--glow-rgb), 0.1);
}

.project-title {
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: var(--spacing-xs);
  text-shadow: 0 0 5px var(--green-glow);
}

.project-title a {
  color: inherit;
  text-decoration: none;
}

.project-title a:hover {
  text-decoration: underline;
}

.project-desc {
  color: var(--text-secondary);
  font-size: var(--font-size-small);
  margin-bottom: var(--spacing-xs);
}

.project-tags {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

.project-tag {
  color: var(--text-dim);
  font-size: 12px;
  border: 1px solid var(--green-dark);
  padding: 2px 6px;
  border-radius: 2px;
  text-decoration: none;
}

.project-tag.clickable-tag {
  cursor: pointer;
  transition: all 0.15s ease;
}

.project-tag.clickable-tag:hover {
  color: var(--text-primary);
  border-color: var(--green-medium);
  background: rgba(0, 100, 0, 0.3);
  text-shadow: 0 0 5px var(--green-glow);
}

/* Fork indicator */
.fork-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 11px;
  margin-left: 8px;
  opacity: 0.8;
}

.fork-badge svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.fork-indicator {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  color: var(--text-dim);
  opacity: 0.7;
}

.fork-indicator svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

/* Project links (repo, website, app stores) */
.project-links {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
}

.project-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  opacity: 0.7;
  transition: all 0.15s ease;
  text-decoration: none !important;
}

.project-link:hover {
  color: var(--text-primary);
  opacity: 1;
  text-shadow: 0 0 5px var(--green-glow);
}

.project-link svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Links */
a {
  color: var(--text-info);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-shadow: 0 0 5px rgba(0, 204, 255, 0.5);
}

/* Clickable project names */
.history-item,
.project-name-link {
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--green-bright) !important;
}

.history-item:hover,
.project-name-link:hover {
  text-shadow: 0 0 8px var(--green-glow);
  text-decoration: underline !important;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Selection */
::selection {
  background: var(--green-dim);
  color: var(--bg-terminal);
}

/* Responsive */
@media (max-width: 768px) {
  :root {
    --font-size-base: 14px;
    --font-size-small: 12px;
  }

  .terminal-container {
    padding: var(--spacing-md);
  }

  .prompt {
    font-size: var(--font-size-small);
  }

  .suggestions {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .prompt {
    display: none;
  }

  .input-line::before {
    content: '> ';
    color: var(--text-dim);
  }
}
