/* PaaS shell app — page chrome matches the platform dashboard/docs theme
   (light, system-ui, brand #0b5fff) with a dark terminal surface. */

:root {
  --paas-brand: #0b5fff;
  --paas-text: #1f2430;
  --paas-border: #e2e5ea;
  --paas-muted: #66707f;
  --term-bg: #14161e;
  --term-accent: #6e9bff;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: system-ui, sans-serif;
  color: var(--paas-text);
  background: #fff;
  height: 100vh;
  overflow: hidden;
}

/* ---- header (matches docs app header.site) ---- */

header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--paas-border);
  flex: none;
}

header.site .brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--paas-text);
  white-space: nowrap;
}

header.site .brand-app { color: var(--paas-brand); }

header.site .target {
  font-size: 0.85rem;
  color: var(--paas-muted);
  background: #f5f6f8;
  border: 1px solid var(--paas-border);
  border-radius: 999px;
  padding: 0.1rem 0.65rem;
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

header.site .target:empty { display: none; }

header.site .header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ---- connection status pill ---- */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--paas-border);
  color: var(--paas-muted);
  background: #f5f6f8;
  text-transform: lowercase;
}

.status-pill .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.status-pill.is-connecting {
  color: #8a5a00;
  border-color: #f0d9a8;
  background: #fdf6e7;
}
.status-pill.is-connecting .status-dot {
  background: #e6a700;
  animation: pulse 1.1s ease-in-out infinite;
}

.status-pill.is-connected {
  color: #116a36;
  border-color: #b7e2c6;
  background: #edfaf1;
}
.status-pill.is-connected .status-dot { background: #1d9e4e; }

.status-pill.is-disconnected {
  color: #8c1f28;
  border-color: #efc3c7;
  background: #fdefef;
}
.status-pill.is-disconnected .status-dot { background: #c43540; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.status-detail {
  font-size: 0.8rem;
  color: var(--paas-muted);
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-detail:empty { display: none; }

/* ---- reconnect button ---- */

.reconnect {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--paas-brand);
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
}

.reconnect:hover { background: #0a52de; }
.reconnect:active { background: #0947c2; }
.reconnect:focus-visible {
  outline: 2px solid var(--paas-brand);
  outline-offset: 2px;
}

/* ---- terminal surface ---- */

.terminal-wrap {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--term-bg);
  padding: 8px 0 8px 8px;
}

.terminal-viewport {
  width: 100%;
  height: 100%;
}

/* xterm fills its host; FitAddon computes the grid from this box. */
.terminal-viewport .xterm {
  height: 100%;
  padding: 2px 4px;
}

.terminal-viewport .xterm-viewport {
  /* subtle dark scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #3a3f52 transparent;
}

/* ---- footer hint bar ---- */

.hint-bar {
  flex: none;
  border-top: 1px solid var(--paas-border);
  padding: 0.35rem 1rem;
  font-size: 0.75rem;
  color: var(--paas-muted);
  background: #fafbfc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hint-bar kbd {
  background: #f0f0f0;
  border: 1px solid #d8dbe0;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 0.3em;
  font-family: inherit;
  font-size: 0.95em;
}

.noscript {
  margin: 2rem auto;
  max-width: 42rem;
  padding: 0 1rem;
  line-height: 1.5;
}

/* narrow screens: drop the hint bar, tighten header */
@media (max-width: 640px) {
  .hint-bar { display: none; }
  header.site { gap: 0.4rem 0.6rem; padding: 0.5rem 0.6rem; }
  .status-detail { display: none; }
}
