/**
 * Manic Pixels Web OS — terminal.css
 * Terminal multi-aba: tabbar, panes, xterm overrides.
 * Sprint 6
 */

/* ══════════════════════════════════════════════════════════════════════════
   RAIZ
   ══════════════════════════════════════════════════════════════════════════ */

.mp-terminal-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0e0e1a;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════════════════════
   TABBAR
   ══════════════════════════════════════════════════════════════════════════ */

.mp-terminal-tabbar {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  height: 34px;
  background: rgba(0, 0, 0, 0.40);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.mp-terminal-tabs {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  scrollbar-width: none;
}

.mp-terminal-tabs::-webkit-scrollbar { display: none; }

/* ── Tab individual ─────────────────────────────────────────────────────── */

.mp-terminal-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  min-width: 90px;
  max-width: 180px;
  height: 100%;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  user-select: none;
  color: rgba(255, 255, 255, 0.40);
  font-size: 12px;
  font-family: var(--mp-font-ui, sans-serif);
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
  position: relative;
}

.mp-terminal-tab::before {
  content: '⌨';
  font-size: 12px;
  opacity: 0.5;
  flex-shrink: 0;
}

.mp-terminal-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.70);
}

.mp-terminal-tab.active {
  background: rgba(123, 97, 255, 0.12);
  color: rgba(255, 255, 255, 0.90);
  border-bottom: 2px solid #7b61ff;
}

.mp-terminal-tab-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mp-terminal-tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
  opacity: 0;
}

.mp-terminal-tab:hover .mp-terminal-tab-close,
.mp-terminal-tab.active .mp-terminal-tab-close {
  opacity: 1;
}

.mp-terminal-tab-close:hover {
  background: rgba(255, 95, 87, 0.30);
  color: #ff5f57;
}

/* ── Botão nova aba ─────────────────────────────────────────────────────── */

.mp-terminal-new-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 100%;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  font-size: 18px;
  font-weight: 300;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
}

.mp-terminal-new-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.80);
}

/* ══════════════════════════════════════════════════════════════════════════
   PANES
   ══════════════════════════════════════════════════════════════════════════ */

.mp-terminal-panes {
  flex: 1;
  min-height: 0;
  position: relative;
}

.mp-terminal-pane {
  position: absolute;
  inset: 0;
  padding: 6px 8px;
  box-sizing: border-box;
  display: flex;
}

.mp-terminal-pane .xterm {
  flex: 1;
  min-width: 0;
}

.mp-terminal-pane .xterm-viewport {
  overflow-y: auto !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(123, 97, 255, 0.25) transparent;
}

.mp-terminal-pane .xterm-viewport::-webkit-scrollbar {
  width: 5px;
}

.mp-terminal-pane .xterm-viewport::-webkit-scrollbar-thumb {
  background: rgba(123, 97, 255, 0.25);
  border-radius: 3px;
}

.mp-terminal-pane .xterm-viewport::-webkit-scrollbar-thumb:hover {
  background: rgba(123, 97, 255, 0.45);
}

/* ══════════════════════════════════════════════════════════════════════════
   XTERM OVERRIDES
   ══════════════════════════════════════════════════════════════════════════ */

/* Remove fundo padrão do xterm — usa o nosso */
.mp-terminal-pane .xterm-screen {
  background: transparent !important;
}

/* Cursor cor accent */
.mp-terminal-pane .xterm-cursor-block {
  background-color: #7b61ff !important;
}

/* Seleção */
.mp-terminal-pane .xterm-selection div {
  background: rgba(123, 97, 255, 0.30) !important;
}
