/* terminal.css — AI_CooP 콘솔 (AI_CAT PowerShell-feel 스타일)
 * 클래식 Windows PowerShell 콘솔 느낌: 파란 콘솔 · Consolas · ANSI 색상 */
:root {
  --ps-page: #000;
  --ps-bg: #012456;
  --ps-bg-2: #001a3d;
  --ps-chrome: #1f1f1f;
  --ps-chrome-2: #2d2d2d;
  --ps-text: #eeeeee;
  --ps-dim: #8aa4c4;
  --ps-yellow: #f9f1a5;
  --ps-green: #16c60c;
  --ps-red: #e74856;
  --ps-cyan: #61d6d6;
  --ps-blue: #3b78ff;
  --ps-mag: #b4009e;
  --ps-line: rgba(97, 214, 214, 0.22);
  --ps-inset: #00102a;
  --ps-btn: #0b3d7a;
  --ps-btn-hover: #1256a8;
  --ps-border: #1d4f86;
  --ps-font: Consolas, "Cascadia Mono", "Courier New", "맑은 고딕", "Malgun Gothic", monospace;
  --ps-ui: "Segoe UI", "Malgun Gothic", "맑은 고딕", sans-serif;
}

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

html, body { height: 100%; }

body {
  background: var(--ps-page);
  color: var(--ps-text);
  font-family: var(--ps-font);
  font-size: 15px;
  line-height: 1.55;
  overflow: hidden;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ps-cyan); }

.ps-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100vh;
  background: var(--ps-bg);
}

/* ——— 창 크롬 바 ——— */
.ps-chrome {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 6px 0 10px;
  background: var(--ps-chrome);
  user-select: none;
  font-family: var(--ps-ui);
  font-size: 12.5px;
  color: #ddd;
  border-bottom: 1px solid #000;
}
.ps-caption { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ps-caption-icon {
  width: 16px; height: 16px;
  border-radius: 3px;
  background: linear-gradient(160deg, #2672ec, #012456);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}
.ps-caption strong { font-weight: 600; color: #fff; }
.ps-caption span { color: #9aa0a6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ps-winbtns { display: flex; align-items: center; gap: 2px; height: 100%; }
.ps-status { font-size: 10px; color: var(--ps-yellow); margin-right: 6px; }
.ps-status.on { color: var(--ps-green); }
.ps-status.busy { color: var(--ps-cyan); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.ps-doc {
  display: inline-flex; align-items: center;
  padding: 0 10px; height: 100%;
  color: #ddd; text-decoration: none; font-size: 12.5px;
}
.ps-doc:hover { background: var(--ps-chrome-2); }
.ps-winbtns button {
  width: 40px; height: 26px;
  background: transparent; border: none;
  color: #ddd; font-size: 14px;
  border-radius: 3px;
}
.ps-winbtns button:hover { background: var(--ps-chrome-2); }
.ps-winbtns .ps-x:hover { background: #c42b1c; color: #fff; }

/* ——— 콘솔 본체 ——— */
.ps-console {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 40px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 140px),
    var(--ps-bg);
  scroll-behavior: smooth;
}
.ps-console:focus { outline: none; }

.line { white-space: pre-wrap; word-break: break-word; margin-bottom: 4px; }
.line:last-child { margin-bottom: 0; }

/* 색상 계열 (ANSI 스타일) */
.c-system { color: var(--ps-cyan); }
.c-warn { color: var(--ps-yellow); }
.c-error { color: var(--ps-red); }
.c-ok { color: var(--ps-green); }
.c-dim { color: var(--ps-dim); }
.c-user { color: #fff; }
.c-agent { color: var(--ps-green); font-weight: 700; }
.c-title { color: var(--ps-yellow); }
.c-head { color: var(--ps-dim); }
.c-cmd { color: var(--ps-mag); }

/* 배너 */
.banner { margin: 6px 0 14px; }
.banner pre {
  color: var(--ps-green);
  font-size: 12px;
  line-height: 1.2;
  margin-bottom: 6px;
  text-shadow: 0 0 8px rgba(22, 198, 12, 0.35);
}
.banner .sub { color: var(--ps-cyan); font-weight: 700; }
.banner .warn { color: var(--ps-yellow); font-size: 13px; margin-top: 4px; }

/* 구분선 */
.rule {
  border: none;
  border-top: 1px solid var(--ps-line);
  margin: 10px 0;
  color: var(--ps-dim);
  font-size: 12px;
}

/* 메시지 블록 */
.msg { margin: 8px 0; }
.msg-head {
  font-family: var(--ps-ui);
  font-size: 11.5px;
  color: var(--ps-dim);
  margin-bottom: 2px;
  user-select: none;
}
.msg-head .t { margin-right: 6px; }
.msg-user .msg-head { color: var(--ps-blue); }
.msg-agent .msg-head { color: var(--ps-green); }
.msg-error .msg-head { color: var(--ps-red); }
.msg-body { white-space: pre-wrap; word-break: break-word; }
.msg-user .msg-body { color: #fff; }
.msg-agent .msg-body { color: var(--ps-text); }

/* 도구 실행 블록 (PowerShell 명령 결과 느낌) */
.tool {
  margin: 8px 0;
  border: 1px solid var(--ps-border);
  border-radius: 6px;
  background: var(--ps-inset);
  overflow: hidden;
}
.tool-head {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 5px 12px;
  background: var(--ps-btn);
  font-family: var(--ps-ui);
  font-size: 12px;
  color: #fff;
  user-select: none;
}
.tool-head .tool-name { color: var(--ps-yellow); font-weight: 600; }
.tool-head .tool-cmd { color: #b8c8dd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-body {
  padding: 8px 12px;
  font-size: 13px;
  color: #c6d4e6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  border-top: 1px solid var(--ps-line);
}

/* 입력 대기 커서 */
.waiting { color: var(--ps-dim); }
.waiting::after { content: "▋"; animation: blink 1s step-end infinite; }

/* 업무 칩 */
.chips { margin: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--ps-border);
  background: var(--ps-inset);
  color: var(--ps-cyan); font-size: 13px;
  text-decoration: none; cursor: pointer;
}
.chip:hover { border-color: var(--ps-cyan); background: var(--ps-btn); color: #fff; }

/* 에이전트 디렉토리 (루트) */
.dir-group { margin: 10px 0 14px; }
.dir-title { color: var(--ps-yellow); font-weight: 700; margin-bottom: 6px; }
.dir-links { display: flex; flex-wrap: wrap; gap: 6px; }

/* ——— 입력 줄 ——— */
.ps-inputbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--ps-bg-2);
  border-top: 1px solid var(--ps-border);
}
.ps-prompt {
  color: var(--ps-green);
  font-weight: 700;
  flex-shrink: 0;
  text-shadow: 0 0 6px rgba(22, 198, 12, 0.4);
}
#cmdInput {
  flex: 1;
  background: transparent;
  border: none; outline: none;
  color: var(--ps-text);
  font-family: var(--ps-font);
  font-size: 15px;
  caret-color: var(--ps-green);
}
#cmdInput::placeholder { color: #4d6a94; }
#sendBtn {
  width: 42px; height: 32px;
  background: var(--ps-btn); color: var(--ps-green);
  border: 1px solid var(--ps-border); border-radius: 5px;
  font-size: 15px; flex-shrink: 0;
}
#sendBtn:hover { background: var(--ps-btn-hover); border-color: var(--ps-cyan); }
#sendBtn:disabled { opacity: 0.45; cursor: not-allowed; }

/* 스크롤바 */
.ps-console::-webkit-scrollbar { width: 10px; }
.ps-console::-webkit-scrollbar-track { background: var(--ps-inset); }
.ps-console::-webkit-scrollbar-thumb { background: var(--ps-btn); border-radius: 5px; }
.ps-console::-webkit-scrollbar-thumb:hover { background: var(--ps-btn-hover); }

@media (max-width: 600px) {
  body { font-size: 13px; }
  #cmdInput { font-size: 13px; }
  .ps-doc { display: none; }
  .ps-console { padding: 10px 10px 30px; }
  .ps-inputbar { padding: 8px 10px; }
}
