@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap');

:root {
  --primary:      #6366f1;
  --primary-2:    #818cf8;
  --accent:       #a78bfa;
  --accent-pink:  #c084fc;
  --muted:        #555;
  --text:         #f2f2f2;
  --text-dim:     #888;
  --bg:           #080808;
  --bg-2:         #0f0f0f;
  --bg-3:         #141414;
  --border:       rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.14);
  --border-bright: rgba(99,102,241,0.5);
  --shadow:       rgba(99,102,241,0.2);
  --terminal-bg:  rgba(8,8,8,0.97);
  --radius:       14px;
  --font-mono:    'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  font-family: var(--font-mono);
  color: var(--text);
  position: relative;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Subtle ambient background ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(99,102,241,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 80% 80%,  rgba(168,85,247,0.06)  0%, transparent 60%),
    radial-gradient(ellipse 30% 30% at 10% 90%,  rgba(99,102,241,0.05)  0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  animation: ambient 20s ease-in-out infinite;
}

@keyframes ambient {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

/* ── Outer wrapper — full viewport padding ── */
#terminal-wrapper {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

/* ── Header bar ── */
#terminal-header {
  height: 6px;
  background: #111;
  border: 1px solid var(--border);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius) var(--radius) 0 0;
  flex-shrink: 0;
  position: relative;
}


/* Indigo accent line under titlebar */
#terminal-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 60px;
  right: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.6), transparent);
}

/* ── Main terminal body ── */
#terminal {
  flex: 1;
  min-height: 0;
  background: var(--terminal-bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px 24px 24px;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(99,102,241,0.08),
    0 24px 64px rgba(0,0,0,0.6),
    0 0 80px rgba(99,102,241,0.05);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

#terminal:focus-within {
  border-color: rgba(99,102,241,0.2);
  box-shadow:
    0 0 0 1px rgba(99,102,241,0.15),
    0 24px 64px rgba(0,0,0,0.7),
    0 0 60px rgba(99,102,241,0.08);
}

/* ── Xterm.js overrides ── */
.xterm {
  font-family: var(--font-mono) !important;
  height: 100%;
}

.xterm .xterm-viewport {
  background: transparent !important;
}

.xterm .xterm-screen {
  background: transparent !important;
}

/* Cursor */
.xterm .xterm-cursor-block {
  background-color: var(--primary-2) !important;
}

@keyframes cursor-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

/* Selection */
.xterm .xterm-selection div {
  background-color: rgba(99,102,241,0.25) !important;
}

/* Scrollbar */
.xterm .xterm-viewport::-webkit-scrollbar {
  width: 4px;
}
.xterm .xterm-viewport::-webkit-scrollbar-track {
  background: transparent;
}
.xterm .xterm-viewport::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  transition: background 0.2s;
}
.xterm .xterm-viewport::-webkit-scrollbar-thumb:hover {
  background: rgba(99,102,241,0.4);
}

/* ── Text selection ── */
::selection       { background: rgba(99,102,241,0.3); color: var(--text); }
::-moz-selection  { background: rgba(99,102,241,0.3); color: var(--text); }

/* ── Row fade-in ── */
.xterm .xterm-rows > div {
  animation: row-in 0.2s ease-out both;
}
@keyframes row-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* ── RESPONSIVE ── */

/* Large screens: tighten max-width */
@media (min-width: 1400px) {
  #terminal-wrapper {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
  }
}

/* Tablet */
@media (max-width: 900px) {
  #terminal-wrapper { padding: 12px; }
  #terminal { padding: 16px 18px 18px; }
  .xterm { font-size: 13px !important; }
}

/* Mobile */
@media (max-width: 600px) {
  #terminal-wrapper { padding: 0; height: 100dvh; border-radius: 0; }
  #terminal-header  { border-radius: 0; }
  #terminal {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    padding: 12px 12px 16px;
  }
  .xterm { font-size: 12px !important; line-height: 1.45 !important; }
  .dot { width: 9px; height: 9px; }
}

/* Very small screens */
@media (max-width: 360px) {
  #terminal { padding: 8px 10px 12px; }
  .xterm { font-size: 11px !important; }
}
