/* ========================================
   Terminal Emulator — Reusable Component
   Drop terminal.js + terminal.css into any project
   ======================================== */

.terminal-wrapper {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  font-family: 'Kode Mono', 'Courier New', monospace;
}

/* Title bar */
.terminal-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #1A1A1A;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

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

.terminal-dot--red { background: #FF5F57; }
.terminal-dot--yellow { background: #FFBD2E; }
.terminal-dot--green { background: #28CA41; }

.terminal-title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: #888;
  letter-spacing: 0.05em;
}

.terminal-mode-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
}

.terminal-mode-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 13px;
  color: #555;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  line-height: 1;
}

.terminal-mode-btn:hover {
  border-color: rgba(232, 146, 124, 0.3);
  color: #E8927C;
}

.terminal-mode-btn--active {
  border-color: rgba(232, 146, 124, 0.4);
  color: #E8927C;
  background: rgba(232, 146, 124, 0.1);
}

/* Terminal body */
.terminal-body {
  background: #0D0D0D;
  padding: 20px;
  min-height: 300px;
  max-height: 400px;
  overflow-y: auto;
  position: relative;
}

/* Scanline overlay */
.terminal-body::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.04) 2px,
    rgba(0, 0, 0, 0.04) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* Output lines */
.terminal-output {
  margin: 0;
  padding: 0;
  list-style: none;
}

.terminal-line {
  font-size: 13px;
  line-height: 1.6;
  color: #E0E0E0;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-line--prompt {
  color: #E8927C;
}

.terminal-line--system {
  color: #888;
  font-style: italic;
}

.terminal-line--accent {
  color: #E8927C;
}

.terminal-line--success {
  color: #28CA41;
}

.terminal-line--error {
  color: #FF5F57;
}

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

.terminal-prompt {
  color: #E8927C;
  font-size: 13px;
  margin-right: 8px;
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(232, 146, 124, 0.3);
}

.terminal-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #E0E0E0;
  font-family: inherit;
  font-size: 13px;
  caret-color: #E8927C;
  line-height: 1.6;
}

.terminal-input::placeholder {
  color: #444;
}

/* Scrollbar */
.terminal-body::-webkit-scrollbar {
  width: 6px;
}

.terminal-body::-webkit-scrollbar-track {
  background: transparent;
}

.terminal-body::-webkit-scrollbar-thumb {
  background: rgba(232, 146, 124, 0.2);
  border-radius: 3px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(232, 146, 124, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
  .terminal-wrapper {
    border-radius: 8px;
  }

  .terminal-body {
    padding: 16px;
    min-height: 250px;
    max-height: 350px;
  }

  .terminal-line,
  .terminal-prompt,
  .terminal-input {
    font-size: 12px;
  }
}

/* ========================================
   Audio Player (terminal-audio-player)
   Rendered inline inside terminal output
   by the `play` command + TerminalAudioPlayer
   ======================================== */

.terminal-audio-player {
  background: rgba(232, 146, 124, 0.08);
  border: 1px solid rgba(232, 146, 124, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 6px 0;
  max-width: 400px;
  position: relative;
  z-index: 2; /* above scanline overlay */
}

.tap-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}

.tap-icon {
  font-size: 16px;
  line-height: 1;
}

.tap-filename {
  color: var(--accent, #E8927C);
  font-family: var(--mono, 'Kode Mono', monospace);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tap-time {
  color: var(--text-muted, #666);
  font-family: var(--mono, 'Kode Mono', monospace);
  font-size: 11px;
  white-space: nowrap;
}

.tap-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tap-btn {
  background: none;
  border: 1px solid rgba(232, 146, 124, 0.3);
  color: var(--accent, #E8927C);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.tap-btn:hover {
  background: rgba(232, 146, 124, 0.15);
  border-color: rgba(232, 146, 124, 0.5);
}

.tap-progress-container {
  flex: 1;
  cursor: pointer;
  padding: 6px 0;
}

.tap-progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.tap-progress-fill {
  height: 100%;
  background: var(--accent, #E8927C);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}
