/* ============================================================
   ターミナルビュー
   ============================================================ */
.terminal-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.terminal-container {
  flex: 1;
  display: flex;
  min-height: 0;
}

.terminal-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.terminal-pane + .terminal-pane {
  border-left: 1px solid var(--border);
}

.terminal-pane-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #181825;
  color: #bac2de;
  font-size: 0.72rem;
  font-family: 'Consolas', 'Monaco', monospace;
  flex-shrink: 0;
  border-bottom: 1px solid #313244;
  border-top: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.terminal-pane.active .terminal-pane-header {
  background: #221e14;
  color: #f9e2af;
  border-top-color: #f9e2af;
  border-bottom-color: #3d3520;
}

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

.terminal-status.connected {
  background: #a6e3a1;
}

.terminal-status.disconnected {
  background: #f38ba8;
}

/* coffee 画面の CLI ツール状態（サイドバー・トップバー共通） */
.terminal-status.tool-free {
  background: #a6e3a1;           /* 緑: フリー */
}
.terminal-status.tool-busy {
  background: #89b4fa;           /* 青(点滅): 処理実行中 */
  animation: coffee-status-pulse 1s ease-in-out infinite;
}
.terminal-status.tool-waiting {
  background: #fab387;           /* オレンジ(点滅): 反応待ち＝要対応 */
  animation: coffee-status-blink 0.9s steps(2, start) infinite;
}
@keyframes coffee-status-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}
@keyframes coffee-status-blink {
  50% { opacity: 0.2; }
}

.term-scrollback-btn {
  margin-left: auto;
  padding: 1px 7px;
  background: #313244;
  border: 1px solid #45475a;
  border-radius: 3px;
  color: #bac2de;
  font-size: 0.68rem;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.4;
}

.term-scrollback-btn:hover {
  background: #45475a;
  border-color: #89b4fa;
  color: #cdd6f4;
}

.terminal-pane-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #1e1e2e;
}

.terminal-pane-body .xterm {
  height: 100%;
  padding: 4px;
  overflow: hidden;
}

/* xterm 入力用 textarea（IME・キーボード入力用）を視覚的に隠す */
.xterm-helper-textarea {
  opacity: 0 !important;
  background: transparent !important;
  border: none !important;
}

/* xterm カスタムスクロールバー */
.xterm-viewport::-webkit-scrollbar {
  width: 10px;
}

.xterm-viewport::-webkit-scrollbar-track {
  background: transparent;
}

.xterm-viewport::-webkit-scrollbar-thumb {
  background: #585b70;
  border-radius: 4px;
  min-height: 40px;
}

.xterm-viewport::-webkit-scrollbar-thumb:hover {
  background: #89b4fa;
}

/* Firefox */
.xterm-viewport {
  scrollbar-width: thin;
  scrollbar-color: #585b70 transparent;
}

/* ターミナル モバイル対応 */
@media (max-width: 768px) {
  /* xterm のスクロールバーも非表示（タッチスクロールで代替） */
  .xterm-viewport::-webkit-scrollbar {
    display: none;
  }
  .xterm-viewport {
    scrollbar-width: none;
  }

  .terminal-container {
    flex-direction: row;
  }

  .terminal-pane + .terminal-pane {
    border-left: 1px solid var(--border);
    border-top: none;
  }

  /* モバイルではペインヘッダーを非表示（モバイルタブバーに統合） */
  .terminal-pane-header {
    display: none;
  }

  /* 非アクティブなペインを非表示（JSで制御） */
  .terminal-pane.mobile-hidden {
    display: none;
  }

  .navbar-tabs {
    margin-left: 8px;
  }

  .navbar-tab {
    padding: 4px 8px;
    font-size: 0.72rem;
  }

  .navbar-tab .material-symbols-outlined {
    font-size: 14px;
    padding-right: 5px;
    margin-right: 0;
  }
}

/* ============================================================
   モバイル専用ターミナルタブバー
   ============================================================ */
.mobile-terminal-tabs {
  display: none;
}

@media (max-width: 768px) {
  .mobile-terminal-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    background: #181825;
    border-bottom: 1px solid #313244;
    flex-shrink: 0;
  }

  .mobile-pane-dots {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .mobile-pane-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #45475a;
    transition: background 0.2s, transform 0.2s;
  }

  .mobile-pane-dot.active {
    background: #cdd6f4;
    transform: scale(1.3);
  }
}

