/* ══════════════════════════════════════════════════════
   서울 도시 뉴스 대시보드 — 스타일시트
   map_wwr.html 의 디자인 언어 계승 (다크 + 민트 그린 + 글래스)
   ══════════════════════════════════════════════════════ */

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

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: 'Noto Sans KR', sans-serif;
  background: #002015;
  color: #ffffff;
  overflow-x: hidden;
}

#bg-gradient {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(94, 232, 176, 0.10) 0%, transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.07) 0%, transparent 45%),
    linear-gradient(135deg, #002015 0%, #12362a 50%, #1f4a3a 100%);
  z-index: -1;
}

#flash {
  position: fixed;
  inset: 0;
  background: rgba(94, 232, 176, 0.1);
  pointer-events: none;
  opacity: 0;
  z-index: 100;
  transition: opacity 0.35s;
}

/* ═══════ 상단 헤더 ═══════ */
#top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: rgba(0, 32, 21, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  flex-wrap: wrap;
  gap: 14px;
}

.title-block h1 {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.title-block .subtitle {
  font-size: 10px;
  font-weight: 300;
  color: #5ee8b0;
  letter-spacing: 0.28em;
  margin-top: 4px;
}

.top-right-block {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#today-date-box, #generated-at-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

#today-date-box .label, #generated-at-box .label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.62);
  letter-spacing: 0.05em;
}

#today-date-box .value, #generated-at-box .value {
  font-size: 12px;
  color: #fff;
  font-weight: 500;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

#update-badge {
  background: rgba(0, 32, 21, 0.9);
  color: #5ee8b0;
  font-size: 11px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 20px;
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(94, 232, 176, 0.3);
  letter-spacing: 0.05em;
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #5ee8b0;
  animation: pulse 2s infinite;
}
.dot.idle { background: #888; animation: none; }
.dot.busy { background: #ffbf5e; animation: pulse 0.8s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 8px currentColor; }
  50%       { opacity: 0.4; transform: scale(0.8); }
}

/* ═══════ Agent 진행 패널 ═══════ */
#agent-panel {
  margin: 14px 28px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(94, 232, 176, 0.2);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.agent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 10px;
}

.agent-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-icon {
  font-size: 18px;
  animation: breathe 2.5s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%       { transform: scale(1.15); opacity: 1; }
}

.agent-title {
  font-size: 14px;
  font-weight: 700;
  color: #5ee8b0;
  letter-spacing: 0.03em;
}

.agent-stage {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.18);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid rgba(94, 232, 176, 0.3);
}

#run-btn {
  font-family: 'Noto Sans KR', sans-serif;
  background: rgba(255, 255, 255, 0.18);
  color: #5ee8b0;
  border: 1px solid rgba(94, 232, 176, 0.4);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.03em;
  font-weight: 500;
}
#run-btn:hover {
  background: rgba(94, 232, 176, 0.28);
  transform: translateY(-1px);
}
#run-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* 진행률 바 */
.progress-bar-bg {
  position: relative;
  height: 22px;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 11px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid rgba(94, 232, 176, 0.1);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(94, 232, 176, 0.6),
    rgba(125, 232, 192, 0.9),
    rgba(94, 232, 176, 0.6)
  );
  background-size: 200% 100%;
  animation: progressShimmer 2s linear infinite;
  border-radius: 11px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes progressShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.progress-percent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

/* 스테이지 체크리스트 */
.stage-checklist {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.stage-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 20px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
  transition: all 0.3s;
  flex: 1;
  justify-content: center;
  min-width: 100px;
}

.stage-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  transition: all 0.3s;
}

.stage-item.active {
  background: rgba(255, 191, 94, 0.12);
  border-color: rgba(255, 191, 94, 0.5);
  color: #ffbf5e;
  animation: stagePulse 1.2s ease-in-out infinite;
}
.stage-item.active .stage-dot {
  background: #ffbf5e;
  box-shadow: 0 0 10px #ffbf5e;
}

.stage-item.done {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(94, 232, 176, 0.5);
  color: #5ee8b0;
}
.stage-item.done .stage-dot {
  background: #5ee8b0;
  box-shadow: 0 0 8px #5ee8b0;
}

.stage-item.error {
  background: rgba(255, 100, 100, 0.12);
  border-color: rgba(255, 100, 100, 0.5);
  color: #ff7b7b;
}
.stage-item.error .stage-dot {
  background: #ff7b7b;
}

@keyframes stagePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 191, 94, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(255, 191, 94, 0); }
}

.stage-arrow {
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
  flex-shrink: 0;
}

/* Agent 로그 */
.agent-log {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(94, 232, 176, 0.08);
  border-radius: 6px;
  padding: 10px 14px;
  max-height: 120px;
  overflow-y: auto;
  font-family: 'Consolas', 'Menlo', 'Monaco', 'Noto Sans KR', monospace;
  font-size: 11px;
  line-height: 1.6;
}

.agent-log::-webkit-scrollbar       { width: 5px; }
.agent-log::-webkit-scrollbar-thumb { background: rgba(94, 232, 176, 0.25); border-radius: 3px; }

.log-line {
  display: flex;
  gap: 10px;
  margin-bottom: 2px;
  animation: logFadeIn 0.25s;
}
@keyframes logFadeIn {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

.log-time {
  color: rgba(255, 255, 255, 0.4);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.log-line.info  .log-msg { color: rgba(255, 255, 255, 0.85); }
.log-line.ok    .log-msg { color: #5ee8b0; }
.log-line.warn  .log-msg { color: #ffbf5e; }
.log-line.error .log-msg { color: #ff7b7b; }

/* ═══════ 통계 바 ═══════ */
#stats-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stat-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.62);
  letter-spacing: 0.03em;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.stat-value.accent { color: #5ee8b0; }
.stat-value.muted  { color: rgba(255, 255, 255, 0.4); }

.stat-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.1);
}

#reload-btn {
  font-family: 'Noto Sans KR', sans-serif;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}
#reload-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #5ee8b0;
  border-color: rgba(94, 232, 176, 0.35);
}

/* ═══════ 카테고리 필터 ═══════ */
#filter-bar {
  display: flex;
  gap: 8px;
  padding: 12px 28px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.chip {
  font-family: 'Noto Sans KR', sans-serif;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.chip:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(94, 232, 176, 0.4);
  color: #5ee8b0;
}
.chip.active {
  background: rgba(94, 232, 176, 0.22);
  color: #5ee8b0;
  border-color: #5ee8b0;
  font-weight: 500;
}

/* ═══════ 메인 그리드 ═══════ */
/*
 * Row 1: 어제 | 오늘 | 다이제스트
 * Row 2: 이번 주 뉴스 (full-width)
 * Row 3: 키워드 + 카테고리 분포 (full-width, 내부 2분할)
 */
#main-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 16px;
  padding: 18px 28px;
}

#yesterday-panel { grid-column: 1; grid-row: 1; }
#today-panel     { grid-column: 2; grid-row: 1; }
#digest-panel    { grid-column: 3; grid-row: 1; }
#week-panel      { grid-column: 1 / -1; grid-row: 2; }
#side-panel      { grid-column: 1 / -1; grid-row: 3; }

/* 하단 사이드 — 키워드 / 카테고리 분포 가로 2분할 */
.side-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
}
.side-grid .side-col .panel-title { margin-top: 0; }

@media (max-width: 1200px) {
  #main-grid { grid-template-columns: 1fr 1fr; }
  #yesterday-panel { grid-column: 1; grid-row: 1; }
  #today-panel     { grid-column: 2; grid-row: 1; }
  #digest-panel    { grid-column: 1 / -1; grid-row: 2; }
  #week-panel      { grid-column: 1 / -1; grid-row: 3; }
  #side-panel      { grid-column: 1 / -1; grid-row: 4; }
}

@media (max-width: 800px) {
  #main-grid { grid-template-columns: 1fr; }
  #yesterday-panel, #today-panel, #digest-panel,
  #week-panel, #side-panel { grid-column: 1; }
  .side-grid { grid-template-columns: 1fr; gap: 18px; }
}

/* ═══════ 패널 공통 ═══════ */
.panel {
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 18px 20px;
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #5ee8b0 transparent;
}

.panel::-webkit-scrollbar       { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: rgba(94, 232, 176, 0.3); border-radius: 3px; }

.panel.full-width { max-height: 80vh; }

.highlight-panel {
  border-color: rgba(94, 232, 176, 0.35);
  background: rgba(255, 255, 255, 0.13);
  box-shadow: 0 0 20px rgba(94, 232, 176, 0.06);
}

.panel-title {
  font-size: 14px;
  font-weight: 700;
  color: #5ee8b0;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-badge {
  font-size: 10px;
  background: rgba(94, 232, 176, 0.2);
  color: #5ee8b0;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  margin-left: auto;
}

.yesterday-date,
.today-date {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.62);
  margin-bottom: 10px;
  margin-top: -6px;
  letter-spacing: 0.03em;
}

/* ═══════ 다이제스트 ═══════ */
.digest-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.digest-card {
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid #5ee8b0;
  padding: 12px 14px;
  border-radius: 6px;
  transition: all 0.2s;
}
.digest-card:hover {
  background: rgba(94, 232, 176, 0.08);
  transform: translateX(2px);
}

.digest-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #5ee8b0;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.digest-card-title .count {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.62);
  font-weight: 400;
}

.digest-card-body {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.65;
}

/* ═══════ 기사 카드 ═══════ */
.articles-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.articles-list.week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}

.article-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.10);
  padding: 11px 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.article-card:hover {
  background: rgba(94, 232, 176, 0.06);
  border-color: rgba(94, 232, 176, 0.3);
  transform: translateY(-1px);
}

.article-card.new {
  animation: slideIn 0.5s ease-out;
  border-color: rgba(94, 232, 176, 0.5);
  box-shadow: 0 0 12px rgba(94, 232, 176, 0.2);
}

@keyframes slideIn {
  0%   { opacity: 0; transform: translateX(-12px); }
  100% { opacity: 1; transform: translateX(0); }
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  font-size: 10px;
  flex-wrap: wrap;
}

.article-category {
  background: rgba(94, 232, 176, 0.2);
  color: #5ee8b0;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.article-source {
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
}

.article-date {
  color: rgba(255, 255, 255, 0.4);
  margin-left: auto;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.article-title {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 5px;
  line-height: 1.4;
}

.article-summary {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.55;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.keyword-chip {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.62);
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 10px;
}

/* ═══════ 키워드 클라우드 ═══════ */
.keyword-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.cloud-word {
  background: rgba(94, 232, 176, 0.08);
  color: rgba(255, 255, 255, 0.85);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 400;
  transition: all 0.2s;
  cursor: default;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.cloud-word:hover {
  background: rgba(94, 232, 176, 0.25);
  color: #5ee8b0;
  transform: scale(1.05);
}

/* ═══════ 카테고리 분포 ═══════ */
.category-dist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.dist-label {
  min-width: 60px;
  color: rgba(255, 255, 255, 0.85);
}

.dist-bar-bg {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.13);
  border-radius: 4px;
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  background: linear-gradient(to right, #5ee8b0, #7de8c0);
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

.dist-count {
  min-width: 26px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.62);
}

/* ═══════ 빈 상태 ═══════ */
.empty-state {
  text-align: center;
  padding: 26px 14px;
  color: rgba(255, 255, 255, 0.4);
}
.empty-state p      { font-size: 12.5px; }
.empty-state .hint  { font-size: 11px; color: rgba(255, 255, 255, 0.32); margin-top: 6px; }

/* ═══════ 모달 ═══════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: rgba(0, 32, 21, 0.98);
  border: 1px solid rgba(94, 232, 176, 0.3);
  border-radius: 12px;
  padding: 26px 30px;
  max-width: 620px;
  width: 92%;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: rgba(255, 255, 255, 0.13);
  color: rgba(255, 255, 255, 0.85);
  border: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.modal-close:hover { background: rgba(255, 100, 100, 0.3); color: #fff; }

.modal-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.modal-category {
  background: rgba(94, 232, 176, 0.22);
  color: #5ee8b0;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.modal-date {
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
}

.modal-content h3 {
  font-size: 18px;
  color: #fff;
  line-height: 1.4;
  margin-bottom: 6px;
}

.modal-source {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.62);
  margin-bottom: 18px;
}

.modal-body h4 {
  font-size: 11px;
  color: #5ee8b0;
  letter-spacing: 0.05em;
  margin-top: 14px;
  margin-bottom: 6px;
}

.modal-body p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.7;
}

.modal-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.modal-link {
  display: inline-block;
  margin-top: 20px;
  padding: 9px 18px;
  background: rgba(255, 255, 255, 0.18);
  color: #5ee8b0;
  text-decoration: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(94, 232, 176, 0.35);
  transition: all 0.2s;
}
.modal-link:hover {
  background: rgba(94, 232, 176, 0.3);
  transform: translateY(-1px);
}
