/* =========================================
   Silentbyte Webhost — Terminal Page
   Dark glass + neon terminal aesthetic
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ─── CSS Variables ─────────────────────── */
:root {
  --primary:        #6366f1;
  --primary-light:  #818cf8;
  --primary-glow:   rgba(99, 102, 241, 0.15);

  --bg:             #ffffff;
  --bg-secondary:   #f8f9fc;
  --bg-card:        #ffffff;
  --bg-hover:       #f3f4f6;

  --text:           #0f172a;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;

  --border:         #e2e8f0;
  --border-hover:   #cbd5e1;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.07);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 999px;

  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  /* Terminal palette — always dark */
  --term-bg:        #0d1117;
  --term-surface:   #161b22;
  --term-border:    #21262d;
  --term-header:    #1c2128;
  --term-text:      #c9d1d9;
  --term-green:     #7ee787;
  --term-green-dim: #3fb950;
  --term-yellow:    #e3b341;
  --term-red:       #ff7b72;
  --term-blue:      #79c0ff;
  --term-muted:     #484f58;
  --term-prompt:    #58a6ff;
  --term-cursor:    #6366f1;
}

[data-theme="dark"] {
  --bg:             #0b0f1a;
  --bg-secondary:   #111827;
  --bg-card:        #151c2c;
  --bg-hover:       #1e2a3d;

  --text:           #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --border:         #1e2a3d;
  --border-hover:   #2d3d54;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Sora', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}

/* ─── Navbar ─────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

[data-theme="dark"] .navbar {
  background: rgba(11, 15, 26, 0.88);
}

.navbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-back {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  transition: all var(--transition);
}

.nav-back:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.nav-back svg {
  width: 16px;
  height: 16px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.nav-logo svg { width: 24px; height: 24px; }
.nav-logo .logo-dot { color: var(--primary); }

.nav-spacer { flex: 1; }

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-icon:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

/* ─── Page Layout ─────────────────────────── */
.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.page-header {
  margin-bottom: 36px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-text h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 6px;
}

.page-header-text p {
  color: var(--text-secondary);
  font-size: 0.93rem;
}

/* ─── Terminal Toggle Button (floating) ─── */
#terminalBtn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 200;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
  transition: all var(--transition);
}

#terminalBtn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 10px 32px rgba(99, 102, 241, 0.5);
}

#terminalBtn.active {
  background: #ef4444;
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.4);
}

/* ─── Terminal Panel ──────────────────────── */
#terminalPanel {
  position: fixed;
  bottom: 100px;
  right: 32px;
  z-index: 199;
  width: 560px;
  max-width: calc(100vw - 40px);
  height: 420px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.6),
    0 4px 16px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;

  /* Initially hidden */
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(0.97);
  transition:
    opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#terminalPanel.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* Terminal header bar */
.terminal-header {
  background: var(--term-header);
  border-bottom: 1px solid var(--term-border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

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

.terminal-dot.close  { background: #ff5f57; }
.terminal-dot.min    { background: #febc2e; }
.terminal-dot.max    { background: #28c840; }

.terminal-title {
  flex: 1;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--term-muted);
  letter-spacing: 0.03em;
}

#terminalClose {
  background: none;
  border: none;
  color: var(--term-muted);
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), background var(--transition);
  font-size: 0.85rem;
}

#terminalClose:hover {
  color: var(--term-text);
  background: var(--term-border);
}

/* Terminal content output area */
#terminalContent {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--term-text);
  scroll-behavior: smooth;
}

#terminalContent::-webkit-scrollbar {
  width: 4px;
}

#terminalContent::-webkit-scrollbar-track {
  background: transparent;
}

#terminalContent::-webkit-scrollbar-thumb {
  background: var(--term-border);
  border-radius: 4px;
}

/* Terminal line types (injected by terminaldb.js) */
.terminal-line {
  display: block;
  word-break: break-word;
  padding: 1px 0;
}

.terminal-line .prompt {
  color: var(--term-prompt);
  font-weight: 600;
}

.terminal-line .success,
.terminal-line .error,
.terminal-line .warning {
  font-weight: 600;
}

.terminal-line .success { color: var(--term-green); }
.terminal-line .error   { color: var(--term-red);   }
.terminal-line .warning { color: var(--term-yellow); }

.terminal-line.output { color: var(--term-text); }

/* Terminal input row */
.terminal-input-row {
  border-top: 1px solid var(--term-border);
  background: var(--term-surface);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.input-prompt {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--term-prompt);
  font-weight: 600;
  flex-shrink: 0;
  user-select: none;
}

#terminalInput {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--term-text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  caret-color: var(--term-cursor);
  padding: 0;
}

#terminalInput::placeholder {
  color: var(--term-muted);
}

/* ─── Info Cards (help panel) ────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.info-card h3 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cmd-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cmd-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.83rem;
}

.cmd-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  padding: 2px 8px;
  background: var(--term-bg);
  color: var(--term-green);
  border-radius: 4px;
  border: 1px solid var(--term-border);
  flex-shrink: 0;
}

[data-theme="dark"] .cmd-tag {
  background: rgba(13, 17, 23, 0.8);
}

.cmd-desc {
  color: var(--text-secondary);
}

/* ─── Responsive ─────────────────────────── */
@media (max-width: 640px) {
  #terminalPanel {
    right: 16px;
    bottom: 90px;
    width: calc(100vw - 32px);
    height: 360px;
  }

  #terminalBtn {
    right: 20px;
    bottom: 24px;
    width: 48px;
    height: 48px;
  }

  .page-wrap { padding: 32px 16px 60px; }
}
