/* hf-studio Codex 터미널 스타일 — Phase B 2026-05-11.
   `--hf-codex-*` prefix 토큰. base.html app.css 토큰과 join 하지 않음.
   xterm.js 의 기본 .xterm 컨테이너를 wrapper 로 감싸 sticky prompt + history layout. */

:root {
  --hf-codex-bg:           #08090a;
  --hf-codex-bg-elev:      #0e0f12;
  --hf-codex-border:       #1d1f23;
  --hf-codex-border-soft:  #16181c;
  --hf-codex-text:         #d9dbe0;
  --hf-codex-text-dim:     #7f828a;
  --hf-codex-accent:       #7170ff;
  --hf-codex-accent-soft:  rgba(113, 112, 255, 0.16);
  --hf-codex-warn:         #f5a524;
  --hf-codex-danger:       #ef4444;
  --hf-codex-ok:           #22c55e;
  --hf-codex-radius:       10px;
  --hf-codex-mono:         ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

.hf-codex-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: calc(100vh - 220px);
}

.hf-codex-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--hf-codex-bg-elev);
  border: 1px solid var(--hf-codex-border);
  border-radius: var(--hf-codex-radius);
}

.hf-codex-header__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--hf-codex-text);
}

.hf-codex-header__title strong {
  font-weight: 600;
  letter-spacing: -0.1px;
}

.hf-codex-header__meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--hf-codex-mono);
  font-size: 11px;
  color: var(--hf-codex-text-dim);
}

.hf-codex-header__dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--hf-codex-text-dim);
  display: inline-block;
}

.hf-codex-header__dot[data-state="ready"]    { background: var(--hf-codex-ok); box-shadow: 0 0 6px rgba(34, 197, 94, 0.55); }
.hf-codex-header__dot[data-state="busy"]     { background: var(--hf-codex-warn); animation: hf-codex-pulse 1.2s ease-in-out infinite; }
.hf-codex-header__dot[data-state="error"]    { background: var(--hf-codex-danger); }
.hf-codex-header__dot[data-state="closed"]   { background: var(--hf-codex-text-dim); }

@keyframes hf-codex-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.hf-codex-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--hf-codex-border);
  border-radius: var(--hf-codex-radius);
  background: rgba(245, 165, 36, 0.06);
  color: var(--hf-codex-text);
  font-size: 12.5px;
  line-height: 1.55;
}

.hf-codex-notice strong { color: var(--hf-codex-warn); font-weight: 600; }
.hf-codex-notice code {
  font-family: var(--hf-codex-mono);
  font-size: 11.5px;
  padding: 1px 5px;
  background: var(--hf-codex-bg);
  border: 1px solid var(--hf-codex-border-soft);
  border-radius: 4px;
  color: var(--hf-codex-text);
}

.hf-codex-terminal {
  background: var(--hf-codex-bg);
  border: 1px solid var(--hf-codex-border);
  border-radius: var(--hf-codex-radius);
  padding: 14px;
  flex: 1;
  min-height: 380px;
  position: relative;
  font-family: var(--hf-codex-mono);
  overflow: hidden;
}

.hf-codex-terminal .xterm {
  height: 100%;
  min-height: 360px;
  padding: 0;
}

.hf-codex-terminal .xterm-viewport {
  background: transparent !important;
  scrollbar-width: thin;
  scrollbar-color: var(--hf-codex-border) transparent;
}

.hf-codex-terminal .xterm-screen { background: transparent; }

.hf-codex-prompt {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px;
  background: var(--hf-codex-bg-elev);
  border: 1px solid var(--hf-codex-border);
  border-radius: var(--hf-codex-radius);
}

.hf-codex-prompt__input {
  resize: none;
  min-height: 56px;
  max-height: 220px;
  padding: 10px 12px;
  border: 1px solid var(--hf-codex-border);
  border-radius: 8px;
  background: var(--hf-codex-bg);
  color: var(--hf-codex-text);
  font-family: var(--hf-codex-mono);
  font-size: 13px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.hf-codex-prompt__input::placeholder { color: var(--hf-codex-text-dim); }

.hf-codex-prompt__input:focus {
  border-color: var(--hf-codex-accent);
  box-shadow: 0 0 0 3px var(--hf-codex-accent-soft);
}

.hf-codex-prompt__input[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.hf-codex-prompt__actions {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  gap: 6px;
}

.hf-codex-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 7px;
  border: 1px solid var(--hf-codex-border);
  background: var(--hf-codex-bg);
  color: var(--hf-codex-text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 510;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  user-select: none;
}

.hf-codex-btn:hover:not([disabled]) {
  background: var(--hf-codex-accent-soft);
  border-color: var(--hf-codex-accent);
  color: #fff;
}

.hf-codex-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hf-codex-btn--primary {
  background: var(--hf-codex-accent);
  border-color: var(--hf-codex-accent);
  color: #fff;
}

.hf-codex-btn--primary:hover:not([disabled]) {
  background: color-mix(in oklab, var(--hf-codex-accent) 85%, #fff 15%);
}

.hf-codex-prompt__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  font-family: var(--hf-codex-mono);
  font-size: 10.5px;
  color: var(--hf-codex-text-dim);
  grid-column: 1 / -1;
}

.hf-codex-prompt__meta b { color: var(--hf-codex-text); font-weight: 510; }

@media (max-width: 640px) {
  .hf-codex-shell { gap: 8px; }
  .hf-codex-prompt { grid-template-columns: 1fr; }
  .hf-codex-prompt__actions { flex-direction: row; }
}
