/* ═══════════════════════════════════════════════════
   PHANTOM ZENITH ORIGIN — TERMINAL OVERLAY
   assets/css/terminal.css
   ─────────────────────────────────────────────────
   Depends on: tokens.css

   Styles for the hidden maintenance console overlay.
   Triggered by backtick keystroke, renders as a
   centered modal over the page content.
   ═══════════════════════════════════════════════════ */

/* ─── Backdrop ─── */
.terminal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 13, 20, 0.88);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
}

/* ─── Terminal Window ─── */
.terminal-window {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(800px, 90vw);
  height: min(520px, 80vh);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  z-index: 1001;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 0 60px rgba(34, 211, 238, 0.06),
    0 0 1px rgba(34, 211, 238, 0.3),
    inset 0 0 80px rgba(0, 0, 0, 0.3);
}

/* CRT scanline overlay */
.terminal-window::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  z-index: 10;
  border-radius: 12px;
}

/* CRT vignette */
.terminal-window::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 0, 0, 0.3) 100%
  );
  pointer-events: none;
  z-index: 11;
  border-radius: 12px;
}

/* ─── Title Bar ─── */
.terminal-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border-dim);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cyan-dim);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.terminal-titlebar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--teal);
  margin-left: auto;
  margin-right: 12px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  animation: statusPulse 2s ease-in-out infinite;
}

/* ─── Close Button ─── */
.terminal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-lo);
  cursor: pointer;
  padding: 0;
  line-height: 0;
  transition: color 0.15s;
  flex-shrink: 0;
}

.terminal-close:hover {
  color: var(--red-dim);
}

/* ─── Output Area ─── */
.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--text-mid);
  position: relative;
  z-index: 1;
}

/* Scrollbar */
.terminal-output::-webkit-scrollbar {
  width: 4px;
}
.terminal-output::-webkit-scrollbar-track {
  background: transparent;
}
.terminal-output::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ─── Output Lines ─── */
.term-line          { min-height: 1.7em; white-space: pre-wrap; word-break: break-word; }
.term-line.system   { color: var(--cyan-dim); }
.term-line.input    { color: var(--text-hi); }
.term-line.response { color: var(--text-mid); }
.term-line.error    { color: var(--red-dim); }
.term-line.success  { color: var(--teal); }
.term-line.warning  { color: var(--orange); }
.term-line.accent   { color: var(--fuchsia); }
.term-line.idle     { opacity: 0.5; }

/* ─── Input Row ─── */
.terminal-input-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border-dim);
  background: var(--bg-deep);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.terminal-prompt {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--cyan);
  margin-right: 8px;
  user-select: none;
}

.terminal-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-hi);
  caret-color: var(--cyan);
  letter-spacing: 0.04em;
}

.terminal-input::placeholder {
  color: var(--text-lo);
  opacity: 0.5;
}

.terminal-input:disabled {
  opacity: 0.3;
}

/* ═══════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════ */

@keyframes terminalIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes terminalOut {
  from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to   { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
}

@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes backdropOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 520px) {
  .terminal-window {
    width: 96vw;
    height: 85vh;
    border-radius: 8px;
  }
  .terminal-output { font-size: 0.7rem; padding: 12px; }
  .terminal-input  { font-size: 0.7rem; }
}
