/* 주간정책동향 딸깍 — 기본 스타일 (md2hwpx topbar 톤 일치) */

:root {
  --bg:       #1a1a1a;
  --panel:    #232323;
  --toolbar:  #2a2a2a;
  --border:   #383838;
  --text1:    #ebebee;
  --text2:    #b0b0b7;
  --text3:    #70707a;
  --accent:   #4a9eff;
  --accent2:  #6db1ff;
  --success:  #5cd75c;
  --warn:     #ffb84a;
  --r:        4px;
  --tph:      40px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── Topbar (md2hwpx 패턴 그대로) ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--tph);
  background: var(--toolbar); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px; z-index: 100; gap: 8px;
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 5px; flex: 1; min-width: 0; }
.tb-right { justify-content: flex-end; }

.home-link {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 9px; border-radius: 6px;
  color: var(--text2); text-decoration: none;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  background: rgba(74,158,255,0.06);
  border: 1px solid rgba(74,158,255,0.18);
  transition: all 0.15s;
  white-space: nowrap; flex-shrink: 0;
}
.home-link:hover { background: rgba(74,158,255,0.14); border-color: var(--accent); color: var(--accent2); }

.sep { width: 1px; height: 18px; background: var(--border); margin: 0 2px; flex-shrink: 0; }

.logo {
  display: flex; align-items: center; gap: 5px;
  color: var(--accent); font-weight: 700; font-size: 12px;
  white-space: nowrap;
}

.version-badge {
  font-size: 10.5px; color: var(--text3);
  padding: 3px 7px; border-radius: 999px;
  border: 1px solid var(--border);
}

/* md2hwpx 톤의 topbar 보조 버튼 */
.tbtn {
  display: flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  color: var(--text2); padding: 4px 7px; border-radius: var(--r);
  font-size: 11.5px; text-decoration: none;
  transition: background .12s, color .12s;
  white-space: nowrap; font-family: inherit;
}
.tbtn:hover { background: #333; color: var(--text1); }

/* ── stage ── */
.stage {
  position: absolute; top: var(--tph); left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  padding: 24px 16px 80px;
}

/* ── 페이지 인트로 ── */
.page-intro {
  max-width: 880px; margin: 0 auto 24px;
  padding: 0 8px;
}
.page-intro h1 {
  font-size: 22px; font-weight: 700;
  color: var(--text1); margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.page-intro p {
  color: var(--text2); margin: 0; font-size: 13px; line-height: 1.6;
}
.page-intro strong { color: var(--accent); font-weight: 600; }

/* ── step-card ── */
.step-card {
  max-width: 980px; margin: 0 auto 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.step-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: rgba(74,158,255,0.04);
  border-bottom: 1px solid var(--border);
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--accent); color: white;
  font-size: 12px; font-weight: 700;
  border-radius: 50%;
  flex-shrink: 0;
}
.step-title {
  font-size: 14px; font-weight: 600;
  color: var(--text1);
}
.step-optional, .step-hint {
  font-size: 11px; color: var(--text3); font-weight: 400;
  margin-left: 4px;
}
.step-body {
  padding: 16px 20px;
}
.step-desc {
  margin: 0 0 12px; font-size: 12.5px; color: var(--text2);
  line-height: 1.55;
}

/* ── 보도자료 목록 (Phase 7) ── */
.article-list-section {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #1d1d1d;
  overflow: hidden;
}
.als-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(74,158,255,0.04);
}
.als-label {
  font-size: 12px; font-weight: 700; color: var(--accent2);
}
.als-meta {
  font-size: 11px; color: var(--text3);
}
.als-filters {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: #1a1a1a;
}
.als-select, .als-search {
  background: #1d1d1d; color: var(--text1);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 5px 9px; font-size: 12px; font-family: inherit;
}
.als-select { flex: 0 0 180px; max-width: 220px; cursor: pointer; }
.als-search { flex: 1; min-width: 160px; }
.als-select:focus, .als-search:focus { outline: none; border-color: var(--accent); }

/* 부처 즐겨찾기 토글 — select 옆 별표 */
.als-fav-btn {
  flex: 0 0 auto;
  width: 30px; height: 28px;
  background: #1d1d1d;
  color: var(--text3);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 16px; line-height: 1;
  cursor: pointer;
  transition: all .12s;
  font-family: inherit;
  padding: 0;
}
.als-fav-btn:hover { color: var(--warn); border-color: var(--warn); }
.als-fav-btn.active { color: var(--warn); background: rgba(255,184,74,0.10); border-color: rgba(255,184,74,0.40); }
.als-fav-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.als-list {
  max-height: 360px; overflow-y: auto;
}
.als-empty, .als-error {
  padding: 18px 12px; text-align: center;
  font-size: 12px; color: var(--text3);
}
.als-error { color: #ff6b6b; }

/* 항목 — 한 행 (메인 row) + expand 본문 (collapsed 기본) */
.als-item {
  border-bottom: 1px solid #2a2a2a;
  color: var(--text1);
}
.als-item:last-child { border-bottom: none; }
.als-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background .1s;
  user-select: none;
}
.als-row:hover { background: rgba(74,158,255,0.06); }
.als-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* 부처 chip — 고정 너비 (정렬 위해) */
.als-agency {
  flex: 0 0 130px;
  font-size: 10.5px; font-weight: 600;
  padding: 2px 7px; border-radius: 100px;
  background: rgba(74,158,255,0.10);
  border: 1px solid rgba(74,158,255,0.25);
  color: var(--accent2);
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}
.als-date {
  flex: 0 0 50px;
  font-size: 11px; color: var(--text3);
  font-family: 'Consolas', monospace;
}
.als-title {
  flex: 1; min-width: 0;
  font-size: 12.5px; color: var(--text1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 새 탭 버튼 — 항목 우측, 색 있는 link 버튼 */
.als-newtab {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  background: rgba(74,158,255,0.12);
  border: 1px solid rgba(74,158,255,0.35);
  border-radius: 4px;
  color: var(--accent2);
  font-size: 11px; font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all .12s;
}
.als-newtab:hover {
  background: rgba(74,158,255,0.25);
  border-color: var(--accent);
  color: #fff;
}

/* 본문 description — collapsed 기본 */
.als-desc {
  display: none;
  padding: 10px 14px 12px;
  font-size: 12px; color: var(--text2);
  line-height: 1.6;
  background: #1a1a1a;
  border-top: 1px dashed #2a2a2a;
}
.als-item.expanded .als-desc { display: block; }
.als-item.expanded .als-row { background: rgba(74,158,255,0.08); }
.als-desc-text {
  white-space: pre-wrap;
  margin-bottom: 8px;
}
.als-actions {
  display: flex; flex-direction: column; gap: 4px;
  padding-top: 8px;
  border-top: 1px solid #262626;
}
.als-action-status {
  font-size: 11.5px; color: var(--text2);
  margin-top: 4px;
}
.als-action-status.ok    { color: var(--success); }
.als-action-status.err   { color: #ff6b6b; }
.als-action-status.busy  { color: var(--accent2); }

/* 첨부 — 아이콘 + 파일명 한 줄 */
.att-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--text2);
  font-size: 12px;
  transition: all .12s;
  background: #1d1d1d;
}
.att-row:hover {
  border-color: var(--accent);
  background: rgba(74,158,255,0.06);
  color: var(--text1);
}
.att-primary {
  background: rgba(74,158,255,0.08);
  border-color: rgba(74,158,255,0.30);
  color: var(--text1);
}
.att-primary:hover {
  background: rgba(74,158,255,0.15);
  border-color: var(--accent);
}
.att-ext {
  flex: 0 0 64px;        /* 고정 너비 — HWPX/PDF/HWP 모두 동일 폭, 파일명 정렬 */
  text-align: center;
  font-size: 10.5px; font-weight: 700;
  padding: 2px 0;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-sizing: border-box;
}
.att-ext-hwpx { background: rgba(92,215,92,0.15);  color: var(--success); }
.att-ext-pdf  { background: rgba(255,107,107,0.15); color: #ff6b6b; }
.att-ext-hwp  { background: rgba(255,184,74,0.15);  color: var(--warn); }
.att-name {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* "② HWPX 파일 직접 업로드" 라벨 — 섹션 구분 */
.upload-section-label {
  font-size: 12px; font-weight: 700; color: var(--accent2);
  margin-bottom: 8px;
  padding-left: 2px;
}

/* ③ 본문 텍스트 직접 입력 영역 */
.body-text-input {
  width: 100%;
  min-height: 110px;
  max-height: 280px;
  background: #1d1d1d;
  color: var(--text1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 9px 11px;
  font-size: 12.5px;
  font-family: inherit;
  line-height: 1.55;
  resize: vertical;
}
.body-text-input:focus { outline: none; border-color: var(--accent); }
.body-text-input::placeholder { color: var(--text3); }
.body-text-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 6px;
}
.body-text-status { font-size: 11.5px; color: var(--text3); }
.body-text-status.ok { color: var(--success); }

/* ── 드래그·드롭 zone ── */
.drop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 140px;
  border: 2px dashed var(--border);
  border-radius: 6px;
  background: rgba(255,255,255,0.015);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.drop-zone:hover {
  border-color: var(--accent);
  background: rgba(74,158,255,0.04);
}
.drop-zone.drag-over {
  border-color: var(--accent2);
  background: rgba(74,158,255,0.10);
}
.dz-icon { font-size: 32px; margin-bottom: 8px; }
.dz-text { font-size: 13px; color: var(--text2); font-weight: 500; line-height: 1.6; }
.dz-sub { color: var(--text3); font-size: 11.5px; font-weight: 400; }

/* ── 미리보기 박스 (단순화 v0.3.2 — 본문 텍스트 X, status + AI 버튼만) ── */
.preview-box {
  margin-top: 12px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #1d1d1d;
  overflow: hidden;
}
.preview-box.hidden { display: none; }
.pb-hint {
  margin: 0; padding: 8px 12px;
  font-size: 12px; color: var(--warn);
  background: rgba(255,184,74,0.04);
  line-height: 1.5;
}
.pb-hint:empty { display: none; }
.pb-hint.ok  { color: var(--success); background: rgba(92,215,92,0.05); }
.pb-hint.err { color: #ff6b6b;        background: rgba(255,107,107,0.05); }

/* AI 요약 영역 — 미리보기 박스 안 */
.ai-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: rgba(74,158,255,0.04);
}
.ai-status {
  font-size: 12px; color: var(--text2); flex: 1; min-width: 200px;
}
.ai-status.ok    { color: var(--success); }
.ai-status.err   { color: #ff6b6b; }
.ai-status.busy  { color: var(--accent2); }

/* ── form 필드 ── */
.field {
  margin-bottom: 12px;
}
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; margin-bottom: 4px;
  font-size: 12px; color: var(--text2); font-weight: 600;
}
.fld-hint {
  font-size: 11px; color: var(--text3); font-weight: 400;
  margin-left: 4px;
}
.field input[type="text"],
.field textarea,
.dl-date {
  width: 100%;
  background: #1d1d1d; color: var(--text1);
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 7px 10px;
  font-size: 13px; font-family: inherit; line-height: 1.55;
  transition: border-color 0.12s;
}
.field input[type="text"]:focus,
.field textarea:focus,
.dl-date:focus {
  outline: none; border-color: var(--accent);
}
.field textarea {
  resize: none;
  min-height: 0;
  height: auto;
  overflow-y: auto;
}
.field input::placeholder, .field textarea::placeholder {
  color: var(--text3); font-size: 12px;
}

/* ── 카테고리 그룹 ── */
.cat-group {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.012);
  border: 1px solid #2e2e2e;
  border-radius: 6px;
}
.cat-group:last-child { margin-bottom: 0; }
.cat-head {
  font-size: 12px; font-weight: 700; color: var(--accent2);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}

/* ── 다운로드 (Step 7) ── */
.step-final {
  background: linear-gradient(180deg, var(--panel) 0%, #1e2530 100%);
  border-color: rgba(74,158,255,0.3);
}
.step-final .step-head {
  background: rgba(74,158,255,0.10);
}
.step-final-body { padding: 20px 24px; }
/* PPT 다운로드 row — 큰 다운로드 + 작은 비우기 (높이 균형) */
.dl-row {
  display: flex; align-items: stretch; gap: 8px;
  flex-wrap: wrap;
}
.dl-row .btn-lg { flex: 1; min-width: 200px; }
.dl-row .btn-sm {
  flex: 0 0 auto;
  padding: 9px 14px;     /* .btn-lg 와 vertical 동일 */
  font-size: 12.5px;     /* horizontal 만 작음 */
}

.dl-status {
  margin-top: 10px; min-height: 18px;
  font-size: 12px; color: var(--text2);
}
.dl-status.ok    { color: var(--success); }
.dl-status.err   { color: #ff6b6b; }
.dl-status.busy  { color: var(--accent2); }

/* ── 버튼 ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #2a2a2a; color: var(--text1);
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 7px 14px;
  font-size: 13px; font-weight: 500; font-family: inherit;
  cursor: pointer;
  transition: all 0.12s;
}
.btn:hover { background: #333; border-color: #4a4a4a; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent); color: white;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); }

.btn-lg {
  padding: 9px 18px; font-size: 14px;
  flex: 1; justify-content: center;
}

.btn-ghost {
  background: transparent; color: var(--text2);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text1); background: #2a2a2a; }

.btn-sm {
  padding: 5px 10px; font-size: 11.5px;
}
