/* xterm.js shipped css is inlined into client.js by esbuild's css-loader. */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background: #0a0a0b;
  color: #e4e4e7;
  font-family:
    "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

body {
  display: flex;
  flex-direction: column;
  /* Mobile-safe height: collapse to the visible part of the viewport so the
     terminal doesn't keep its desktop size when the keyboard pops up. The
     JS pins --app-h to visualViewport.height; we fall back to 100dvh on
     browsers without visualViewport. */
  height: var(--app-h, 100dvh);
  overflow: hidden;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #27272a;
  background: #111113;
  font-size: 13px;
  flex-shrink: 0;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.brand-logo {
  display: block;
  /* Nudge the logo down slightly so its visual mass sits on the text
     baseline. The SVG has empty space at the top of its viewBox, which
     makes flex centering look a hair high otherwise. */
  margin-top: 1px;
}

.slug {
  font-size: 12px;
  color: #a1a1aa;
  font-family: inherit;
  flex: 1;
  text-align: center;
  /* On narrow screens the slug can crowd the status; allow it to truncate. */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding: 0 8px;
}

.status-wrap {
  position: relative;
  flex-shrink: 0;
}
.status-trigger {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.status-caret {
  color: #a1a1aa;
  transition: transform 0.15s;
}
.status-trigger[aria-expanded="true"] .status-caret {
  transform: rotate(180deg);
}
.status {
  font-size: 12px;
  color: #a1a1aa;
}
.status[data-kind="ok"] {
  color: #4ade80;
}
.status[data-kind="error"] {
  color: #f87171;
}
.status-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 140px;
  background: #1c1c1f;
  border: 1px solid #2e2e33;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  z-index: 10;
  padding: 4px 0;
}
.status-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  background: none;
  border: 0;
  color: #e4e4e7;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.status-menu-item:hover {
  background: #27272a;
}

main {
  flex: 1;
  display: flex;
  padding: 8px;
  overflow: hidden;
  min-height: 0;
}

#terminal {
  flex: 1;
  height: 100%;
  min-height: 0;
}

/* xterm needs absolute-positioned screen + cursor; this is the standard wrap. */
.xterm {
  height: 100%;
}

/* Mobile arrow / control toolbar. Hidden on desktop; revealed by JS once it
   confirms a coarse pointer (touch device). Sits at the bottom of the
   visible viewport, just above the keyboard when one is up. */
.mobile-keys {
  display: none;
  flex-shrink: 0;
  gap: 6px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: #111113;
  border-top: 1px solid #27272a;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-keys[data-visible="true"] {
  display: flex;
}
.mkey {
  flex: 1 0 auto;
  min-width: 44px;
  height: 40px;
  background: #1c1c1f;
  color: #e4e4e7;
  border: 1px solid #2e2e33;
  border-radius: 6px;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.mkey:active {
  background: #2a2a2f;
  border-color: #3f3f47;
}

body.unauthed {
  display: grid;
  place-items: center;
  font-size: 14px;
  text-align: center;
  padding: 32px;
}
body.unauthed h1 {
  font-size: 20px;
  margin-bottom: 12px;
}
body.unauthed a {
  color: #22d3ee;
}

/* ------------------------------------------------------------------------- */
/* Files upload page (rendered inside an iframe from the dashboard).         */
/* ------------------------------------------------------------------------- */

body.files-body {
  display: grid;
  place-items: stretch;
  padding: 0;
  overflow: hidden;
  background: #0a0a0b;
}

.files-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 20px;
  gap: 16px;
  color: #e4e4e7;
  font-family:
    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.dropzone {
  flex-shrink: 0;
  border: 2px dashed #2a2a2f;
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition:
    background 120ms ease,
    border-color 120ms ease;
  outline: none;
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: #6b3fa0;
  background: rgba(107, 63, 160, 0.06);
}
.dropzone.is-hot {
  border-color: #22d3ee;
  background: rgba(34, 211, 238, 0.08);
}
.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.dropzone-icon {
  color: #6b3fa0;
}
.dropzone-label {
  font-size: 15px;
}
.dropzone-link {
  color: #6b3fa0;
  text-decoration: underline;
}
.dropzone-hint {
  font-size: 12px;
  color: #71717a;
}
.dropzone-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #a1a1aa;
  background: #18181b;
  padding: 1px 4px;
  border-radius: 4px;
}

.filelist {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filerow {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid #1f1f23;
  border-radius: 8px;
  background: #131316;
  font-size: 13px;
}
.filerow-icon {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6b3fa0;
}
.filerow-uploading .filerow-icon {
  background: #facc15;
  animation: filerow-pulse 1.1s ease-in-out infinite;
}
.filerow-done .filerow-icon {
  background: #22c55e;
}
.filerow-error .filerow-icon {
  background: #ef4444;
}
@keyframes filerow-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}
.filerow-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filerow-size {
  color: #71717a;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.filerow-msg {
  color: #ef4444;
  font-size: 12px;
}
.filerow-done .filerow-msg {
  color: #22c55e;
}

.files-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.files-status {
  font-size: 13px;
  color: #a1a1aa;
}
.files-status[data-kind="ok"] {
  color: #22c55e;
}
.files-status[data-kind="warn"] {
  color: #facc15;
}
.files-status[data-kind="error"] {
  color: #ef4444;
}
.files-done {
  border: 1px solid #2a2a2f;
  background: #18181b;
  color: #e4e4e7;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.files-done:hover:not(:disabled) {
  border-color: #6b3fa0;
  color: #c4b5fd;
}
.files-done:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


/* xterm */
/**
 * Copyright (c) 2014 The xterm.js authors. All rights reserved.
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * https://github.com/chjj/term.js
 * @license MIT
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 *   The original design remains. The terminal itself
 *   has been extended to include xterm CSI codes, among
 *   other features.
 */

/**
 *  Default styles for xterm.js
 */

.xterm {
    cursor: text;
    position: relative;
    user-select: none;
    -ms-user-select: none;
    -webkit-user-select: none;
}

.xterm.focus,
.xterm:focus {
    outline: none;
}

.xterm .xterm-helpers {
    position: absolute;
    top: 0;
    /**
     * The z-index of the helpers must be higher than the canvases in order for
     * IMEs to appear on top.
     */
    z-index: 5;
}

.xterm .xterm-helper-textarea {
    padding: 0;
    border: 0;
    margin: 0;
    /* Move textarea out of the screen to the far left, so that the cursor is not visible */
    position: absolute;
    opacity: 0;
    left: -9999em;
    top: 0;
    width: 0;
    height: 0;
    z-index: -5;
    /** Prevent wrapping so the IME appears against the textarea at the correct position */
    white-space: nowrap;
    overflow: hidden;
    resize: none;
}

.xterm .composition-view {
    /* TODO: Composition position got messed up somewhere */
    background: #000;
    color: #FFF;
    display: none;
    position: absolute;
    white-space: nowrap;
    z-index: 1;
}

.xterm .composition-view.active {
    display: block;
}

.xterm .xterm-viewport {
    /* On OS X this is required in order for the scroll bar to appear fully opaque */
    background-color: #000;
    overflow-y: scroll;
    cursor: default;
    position: absolute;
    right: 0;
    left: 0;
    top: 0;
    bottom: 0;
}

.xterm .xterm-screen {
    position: relative;
}

.xterm .xterm-screen canvas {
    position: absolute;
    left: 0;
    top: 0;
}

.xterm .xterm-scroll-area {
    visibility: hidden;
}

.xterm-char-measure-element {
    display: inline-block;
    visibility: hidden;
    position: absolute;
    top: 0;
    left: -9999em;
    line-height: normal;
}

.xterm.enable-mouse-events {
    /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
    cursor: default;
}

.xterm.xterm-cursor-pointer,
.xterm .xterm-cursor-pointer {
    cursor: pointer;
}

.xterm.column-select.focus {
    /* Column selection mode */
    cursor: crosshair;
}

.xterm .xterm-accessibility:not(.debug),
.xterm .xterm-message {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 10;
    color: transparent;
    pointer-events: none;
}

.xterm .xterm-accessibility-tree:not(.debug) *::selection {
  color: transparent;
}

.xterm .xterm-accessibility-tree {
  user-select: text;
  white-space: pre;
}

.xterm .live-region {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.xterm-dim {
    /* Dim should not apply to background, so the opacity of the foreground color is applied
     * explicitly in the generated class and reset to 1 here */
    opacity: 1 !important;
}

.xterm-underline-1 { text-decoration: underline; }
.xterm-underline-2 { text-decoration: double underline; }
.xterm-underline-3 { text-decoration: wavy underline; }
.xterm-underline-4 { text-decoration: dotted underline; }
.xterm-underline-5 { text-decoration: dashed underline; }

.xterm-overline {
    text-decoration: overline;
}

.xterm-overline.xterm-underline-1 { text-decoration: overline underline; }
.xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }
.xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }
.xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }
.xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }

.xterm-strikethrough {
    text-decoration: line-through;
}

.xterm-screen .xterm-decoration-container .xterm-decoration {
	z-index: 6;
	position: absolute;
}

.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {
	z-index: 7;
}

.xterm-decoration-overview-ruler {
    z-index: 8;
    position: absolute;
    top: 0;
    right: 0;
    pointer-events: none;
}

.xterm-decoration-top {
    z-index: 2;
    position: relative;
}
