/* Polarpulse AI Report - 흑백 모노톤 */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css');

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Pretendard Variable','Pretendard','Apple SD Gothic Neo','Malgun Gothic',sans-serif;
  background: #FFFFFF;
  color: #000;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* Top Bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid #EEE;
}
.brand { font-size: 14pt; font-weight: 700; letter-spacing: 0.04em; color: #000; }
.nav { display: flex; gap: 24px; }
.nav a {
  font-size: 13px; color: #999; padding-bottom: 4px;
}
.nav a.active { color: #000; font-weight: 600; border-bottom: 2px solid #000; }

/* Generic */
.container { max-width: 960px; margin: 0 auto; padding: 0 32px; }
.muted { color: #666; }
.tiny { font-size: 11px; color: #666; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px;
  border: 1px solid #000; border-radius: 4px;
  background: #FFF; color: #000;
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background-color 0.12s;
}
.btn:hover { background: #F5F5F5; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.btn-text {
  border: none; padding: 6px 0; background: transparent;
}
.btn.btn-text:hover { background: transparent; text-decoration: underline; }

/* Inputs */
.input {
  width: 100%;
  border: none; border-bottom: 1px solid #CCC;
  padding: 12px 4px;
  font-family: inherit; font-size: 16px; color: #000;
  background: transparent; outline: none;
}
.input:focus { border-bottom-color: #000; border-bottom-width: 2px; padding-bottom: 11px; }
.input::placeholder { color: #999; }

/* Dashboard */
.dashboard {
  padding-top: 80px;
}
.dashboard h1 {
  font-size: 26pt; font-weight: 700; color: #000;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.dashboard .subtitle { color: #666; margin: 0 0 32px; font-size: 13px; }
.input-card { max-width: 720px; margin: 0 auto; }
.input-row {
  display: flex; gap: 12px; align-items: flex-end;
}
.input-row .input { flex: 1; }
.input-hint { color: #999; font-size: 11px; margin-top: 6px; min-height: 16px; }
.suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  background: #FFF; border: 1px solid #EEE; max-height: 240px; overflow: auto; z-index: 10;
}
.suggestions div {
  padding: 10px 12px; cursor: pointer; font-size: 13px;
}
.suggestions div:hover { background: #F5F5F5; }

/* Recent Reports */
.recent-section { margin-top: 100px; }
.recent-section h2 {
  font-size: 16px; font-weight: 600; color: #000; margin: 0 0 16px;
}
.report-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.report-card {
  border: 1px solid #EEE; padding: 24px; background: #FFF;
  display: flex; flex-direction: column; min-height: 130px;
}
.report-card .name { font-size: 14px; font-weight: 600; color: #000; }
.report-card .date { font-size: 11px; color: #666; margin-top: 4px; }
.report-card .actions { margin-top: auto; display: flex; gap: 12px; padding-top: 16px; }
.report-card .actions a { font-size: 12px; color: #000; text-decoration: underline; }
.report-card .actions a:hover { color: #333; }

/* Generating */
.gen-page { max-width: 720px; margin: 0 auto; padding: 80px 32px; }
.gen-header h1 { font-size: 26pt; font-weight: 700; margin: 0; }
.gen-header .subtitle { color: #666; font-size: 14px; margin-top: 4px; }
.gen-status {
  display: flex; align-items: center; gap: 14px;
  margin: 60px 0 12px;
  font-size: 32pt; font-weight: 600; color: #000;
}
.queue-info {
  display: flex; flex-direction: column; gap: 14px;
  margin: 28px 0 0;
  padding: 22px 24px;
  background: #FFF; border: 1px solid #000; border-radius: 4px;
}
.queue-info .queue-title { font-size: 13pt; font-weight: 600; color: #000; }
.queue-info .queue-stats { font-size: 11pt; color: #666; line-height: 1.7; }
.queue-info .queue-stat-row { display: flex; gap: 16px; align-items: baseline; }
.queue-info .queue-stat-label { color: #999; min-width: 56px; font-weight: 500; }
.queue-info .queue-stat-value { color: #000; }
.queue-info .queue-stat-value strong { font-size: 12pt; color: #000; font-weight: 700; }
.queue-info .queue-message {
  font-size: 10pt; color: #666; line-height: 1.5;
  padding-top: 10px; border-top: 1px solid #EEE;
}
.spinner {
  width: 28px; height: 28px;
  border: 3px solid #EEE; border-top-color: #000; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.dots::after {
  content: '...';
  display: inline-block;
  width: 1.5em;
  text-align: left;
  animation: dots 1.5s steps(4, end) infinite;
}
@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%, 100% { content: '...'; }
}
.elapsed { font-size: 12px; color: #666; font-variant-numeric: tabular-nums; }

.progressbar { height: 4px; background: #EEE; margin: 32px 0 8px; position: relative; }
.progressbar > .fill { background: #000; height: 100%; transition: width 0.4s ease; }
.progress-meta { font-size: 11px; color: #666; text-align: right; margin-bottom: 24px; font-variant-numeric: tabular-nums; }

.section-list { border-top: 1px solid #EEE; }
.section-list .row {
  display: flex; align-items: center; height: 40px;
  padding: 0 24px; border-bottom: 1px solid #EEE;
  font-size: 13px;
}
.section-list .icon { width: 20px; text-align: center; margin-right: 12px; font-size: 12px; }
.section-list .row.done { color: #000; }
.section-list .row.done .icon { color: #000; }
.section-list .row.loading { color: #000; font-weight: 600; }
.section-list .row.loading .icon { color: #000; }
.section-list .row.waiting { color: #999; }
.section-list .row.waiting .icon { color: #CCC; }
.section-list .name { flex: 1; }
.section-list .time { font-size: 11px; color: #666; font-variant-numeric: tabular-nums; }

.gen-footer { margin-top: 48px; display: flex; justify-content: flex-end; }

/* Viewer */
.viewer-actionbar {
  display: flex; align-items: center; padding: 12px 32px;
  border-bottom: 1px solid #EEE;
  gap: 24px;
}
.viewer-actionbar .back { font-size: 12px; color: #000; }
.viewer-actionbar .back:hover { text-decoration: underline; }
.viewer-actionbar .title { flex: 1; text-align: center; }
.viewer-actionbar .title strong { font-size: 14px; font-weight: 600; }
.viewer-actionbar .title .meta { font-size: 11px; color: #666; margin-top: 2px; }
.viewer-actionbar .actions { display: flex; gap: 8px; }
.viewer-actionbar .btn { padding: 8px 16px; font-size: 12px; }

.viewer-body { display: flex; min-height: calc(100vh - 110px); }
.viewer-toc {
  width: 240px; padding: 32px 24px; border-right: 1px solid #EEE;
  position: sticky; top: 0; height: 100vh; overflow: auto;
  transition: width 0.18s ease, padding 0.18s ease;
}
.viewer-toc h3 { font-size: 11pt; font-weight: 600; margin: 0 0 16px; }
.viewer-toc a {
  display: block; padding: 10px 12px;
  font-size: 13px; color: #666; border-left: 2px solid transparent;
}
.viewer-toc a:hover { color: #000; }
.viewer-toc a.active { color: #000; font-weight: 600; border-left-color: #000; }

/* 사이드바 토글 버튼 */
.toc-toggle {
  position: absolute; top: 12px; right: 8px;
  width: 26px; height: 26px;
  background: #FFF; border: 1px solid #DDD; border-radius: 4px;
  font-size: 11px; cursor: pointer; color: #666;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.toc-toggle:hover { background: #F5F5F5; color: #000; border-color: #000; }

/* 사이드바 접힌 상태 */
.viewer-body.toc-collapsed .viewer-toc {
  width: 40px; padding: 12px 4px; overflow: visible;
}
.viewer-body.toc-collapsed .viewer-toc h3,
.viewer-body.toc-collapsed .viewer-toc a {
  display: none;
}
.viewer-body.toc-collapsed .toc-toggle {
  position: relative; top: 0; right: 0; margin: 0 auto; display: flex;
}

.viewer-frame {
  flex: 1; padding: 0; display: flex;
}
.viewer-frame .frame-pane {
  flex: 1; display: flex; flex-direction: column;
  min-width: 0;  /* flex 자식 overflow 방지 */
}
.viewer-frame iframe {
  width: 100%; height: calc(100vh - 110px); border: none; background: #FFF;
  flex: 1;
}
/* split 모드 */
.viewer-frame.editing .frame-pane-original {
  border-right: 1px solid #DDD;
}
.viewer-frame.editing iframe {
  height: calc(100vh - 142px);  /* label 높이만큼 줄임 */
}
.frame-label {
  font-size: 11pt; font-weight: 600; color: #666;
  padding: 8px 16px; background: #F9F9F9;
  border-bottom: 1px solid #EEE;
  letter-spacing: 0.05em;
}
.frame-pane-original .frame-label { color: #999; }
.frame-pane-edit .frame-label { color: #000; background: #FAFFF8; border-bottom-color: #B5E5C4; }

/* 수정 / 저장 / 취소 버튼 색상 */
.btn-save {
  background: #000; color: #FFF; border-color: #000;
}
.btn-save:hover { background: #222; }
.btn-cancel {
  background: #FFF; color: #999; border-color: #DDD;
}
.btn-cancel:hover { background: #F5F5F5; color: #000; border-color: #000; }

/* 변경 비교 모달 */
.modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.modal-panel {
  position: relative; background: #FFF; border: 1px solid #000; border-radius: 6px;
  width: 96vw; max-width: 1600px; height: 92vh;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.modal-body-split {
  display: flex; padding: 0; overflow: hidden;
}
.diff-pane {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  border-right: 1px solid #DDD;
}
.diff-pane:last-child { border-right: none; }
.diff-pane-label {
  font-size: 11pt; font-weight: 600; color: #666;
  padding: 10px 16px; background: #F9F9F9;
  border-bottom: 1px solid #EEE;
  letter-spacing: 0.05em;
}
.diff-pane-label-edit {
  color: #000; background: #FAFFF8; border-bottom-color: #B5E5C4;
}
.diff-pane iframe {
  flex: 1; width: 100%; border: none; background: #FFF;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid #EEE;
}
.modal-header h2 { font-size: 14pt; margin: 0; font-weight: 600; }
.modal-close {
  background: none; border: none; font-size: 24px; cursor: pointer;
  color: #999; padding: 0 8px;
}
.modal-close:hover { color: #000; }
.modal-body {
  flex: 1; overflow: auto; padding: 16px 24px;
}
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 24px; border-top: 1px solid #EEE;
}

/* Diff 표시 */
.diff-legend {
  display: flex; gap: 16px; align-items: center;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid #EEE;
  font-size: 11pt;
}
.diff-summary { color: #666; font-size: 10pt; margin-left: auto; }
.diff-output {
  font-size: 12pt; line-height: 1.7; white-space: pre-wrap;
  font-family: -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: #333;
}
.diff-output ins {
  background: #DCFCE7; color: #14532D; text-decoration: none;
  padding: 1px 2px; border-radius: 2px;
}
.diff-output del {
  background: #FEE2E2; color: #7F1D1D; text-decoration: line-through;
  padding: 1px 2px; border-radius: 2px;
}

.home-btn {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 28px;
  background: transparent; color: #000; border: 1px solid #000; border-radius: 4px;
  font-family: inherit; font-size: 13px; font-weight: 500;
  transition: background-color 0.12s;
  z-index: 100;
}
.home-btn:hover { background: #F5F5F5; }
