/* ═══════════════════════════════════════════════════════════════
   terminal.css — Interactive CLI Terminal Component
   Dileep Kallakuri · dkportfolio
   ═══════════════════════════════════════════════════════════════ */

/* ── TERMINAL CONTAINER ───────────────────────────────────────── */
.dk-terminal {
  position: relative;
  background:
    radial-gradient(ellipse at top center, rgba(220, 195, 154, 0.04) 0%, rgba(220, 195, 154, 0) 32%),
    linear-gradient(180deg, rgba(22, 28, 38, 0.98) 0%, rgba(11, 15, 23, 0.992) 16%, rgba(7, 10, 16, 1) 100%);
  border: 1px solid rgba(235, 240, 248, 0.09);
  border-radius: 26px;
  overflow: hidden;
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Consolas', 'Menlo', monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  color: #edf2f8;
  min-height: 480px;
  max-height: 640px;
  display: flex;
  flex-direction: column;
  cursor: text;
  box-shadow:
    0 42px 108px rgba(0, 0, 0, 0.44),
    0 16px 38px rgba(4, 8, 14, 0.26),
    inset 0 1px 0 rgba(255,255,255,0.05);
  transform: perspective(1400px) rotateX(1.1deg);
  transform-origin: center top;
}

/* Soft inner sheen for separation without noisy effects */
.dk-terminal::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.038) 0%, rgba(255,255,255,0) 15%),
    radial-gradient(ellipse at top center, rgba(210, 186, 143, 0.05) 0%, rgba(210, 186, 143, 0) 32%);
  border-radius: inherit;
}

.dk-terminal::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.016);
  z-index: 3;
}

/* ── TITLE BAR ────────────────────────────────────────────────── */
.dk-terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.08rem;
  background: linear-gradient(180deg, rgba(28, 34, 46, 0.98), rgba(16, 20, 29, 0.98));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

.dk-terminal-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.dk-terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  opacity: 0.85;
}
.dk-terminal-dot:nth-child(1) { background: #ff5f57; }
.dk-terminal-dot:nth-child(2) { background: #febc2e; }
.dk-terminal-dot:nth-child(3) { background: #28c840; }

.dk-terminal-title {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.42);
  letter-spacing: 0.08em;
  font-family: 'JetBrains Mono', monospace;
  pointer-events: none;
}

/* ── SCROLL AREA ──────────────────────────────────────────────── */
.dk-terminal-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.42rem 1.48rem 0.78rem;
  scroll-behavior: smooth;
  position: relative;
  z-index: 2;
}

.dk-terminal-body::-webkit-scrollbar { width: 3px; }
.dk-terminal-body::-webkit-scrollbar-track { background: transparent; }
.dk-terminal-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ── OUTPUT LINES ─────────────────────────────────────────────── */
.dk-term-line {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.2em;
}

.dk-term-line.prompt-echo {
  color: rgba(244, 247, 251, 0.94);
}

.dk-term-line.output {
  color: #e9eef5;
}

.dk-term-line.output-dim {
  color: rgba(236, 240, 246, 0.78);
}

.dk-term-line.output-accent {
  color: #b4eadf;
}

.dk-term-line.output-success {
  color: #3ec97e;
}

.dk-term-line.output-warn {
  color: #F5A623;
}

.dk-term-line.output-error {
  color: #F5A623;
}

.dk-term-line.output-blank {
  min-height: 0.8em;
}

/* ── PROMPT + INPUT ROW ───────────────────────────────────────── */
.dk-terminal-input-row {
  display: flex;
  align-items: center;
  padding: 0.36rem 1.28rem 0.92rem;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.dk-term-prompt {
  color: #b4eadf;
  white-space: nowrap;
  user-select: none;
  margin-right: 0.5rem;
  font-size: 0.82rem;
  font-family: 'JetBrains Mono', monospace;
}

.dk-term-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.dk-term-input {
  background: transparent;
  border: none;
  outline: none;
  color: rgba(255, 255, 255, 0.995);
  font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  width: 100%;
  caret-color: #a9e2d7;
}

/* ── TYPEWRITER INTRO ─────────────────────────────────────────── */
.dk-term-typewriter {
  color: rgba(238, 241, 246, 0.78);
}

.dk-term-typewriter.done {
  color: #b4eadf;
}

/* ── FORMATTED OUTPUT BLOCKS ──────────────────────────────────── */
.dk-term-section-header {
  color: #dcc39a;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

@media (max-width: 680px) {
  .dk-terminal {
    min-height: 430px;
    max-height: 560px;
    border-radius: 22px;
    transform: none;
  }

  .dk-terminal-body {
    padding: 1.1rem 1.08rem 0.62rem;
  }

  .dk-terminal-input-row {
    padding: 0.32rem 1rem 0.8rem;
  }
}

.dk-term-table {
  border-collapse: collapse;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: #dde5f0;
  margin: 0.3rem 0;
}

.dk-term-table th {
  color: rgba(255,255,255,0.45);
  font-weight: 400;
  text-align: left;
  padding-right: 1.5rem;
  padding-bottom: 0.1rem;
}

.dk-term-table td {
  padding-right: 1.5rem;
  padding-bottom: 0.05rem;
}

.dk-term-table td.val-healthy { color: #3ec97e; }
.dk-term-table td.val-warn    { color: #F5A623; }
.dk-term-table td.val-accent  { color: #b4eadf; }

/* ── ASCII DIAGRAMS ───────────────────────────────────────────── */
.dk-term-ascii {
  color: rgba(241,244,248,0.78);
  font-size: 0.79rem;
  line-height: 1.5;
}

.dk-term-ascii .ascii-accent { color: #b4eadf; }
.dk-term-ascii .ascii-label  { color: #3ec97e; }

/* ── CHAOS ANIMATION ──────────────────────────────────────────── */
@keyframes dkTermChaosShake {
  0%   { transform: translate(0, 0) rotate(0deg); }
  10%  { transform: translate(-3px, 1px) rotate(-0.5deg); }
  20%  { transform: translate(3px, -2px) rotate(0.5deg); }
  30%  { transform: translate(-2px, 3px) rotate(0deg); }
  40%  { transform: translate(2px, -1px) rotate(0.3deg); }
  50%  { transform: translate(-3px, 2px) rotate(-0.3deg); }
  60%  { transform: translate(1px, -3px) rotate(0deg); }
  70%  { transform: translate(-1px, 2px) rotate(0.5deg); }
  80%  { transform: translate(3px, 1px) rotate(-0.5deg); }
  90%  { transform: translate(-2px, -1px) rotate(0deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

.dk-terminal.chaos-mode {
  animation: dkTermChaosShake 0.4s ease-in-out;
}

.dk-term-glitch {
  color: #F5A623;
  animation: dkTermGlitchFlicker 0.1s infinite;
}

@keyframes dkTermGlitchFlicker {
  0%   { opacity: 1; }
  49%  { opacity: 1; }
  50%  { opacity: 0; }
  99%  { opacity: 0; }
  100% { opacity: 1; }
}

/* ── RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .dk-terminal {
    font-size: 0.74rem;
    min-height: 360px;
    max-height: 500px;
    border-radius: 16px;
    transform: none;
  }
  .dk-terminal-body {
    padding: 1rem 1rem 0.45rem;
  }
  .dk-terminal-input-row {
    padding: 0.3rem 1rem 0.8rem;
  }
}
