/* Dolmaro Tools · 키워드 분석 대시보드 */

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

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f8fafc;
  color: #0f172a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.55;
}

.dash-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.dash-header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff;
  padding: 28px 0 22px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.dash-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}
.dash-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.dash-subtitle {
  margin-top: 6px;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 400;
}
.dash-last-run {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.last-run-label {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.last-run-value {
  font-size: 15px;
  font-weight: 600;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}
.source-badge {
  margin-top: 4px;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(59, 130, 246, 0.18);
  color: #bfdbfe;
  border: 1px solid rgba(59, 130, 246, 0.35);
  cursor: help;
}
.source-badge[data-source="selenium"] {
  background: rgba(16, 185, 129, 0.18);
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.35);
}

/* Main */
.dash-main { flex: 1; padding: 28px 0 56px; }

/* Help section (collapsible) */
.help-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 20px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.help-section[open] { border-color: #cbd5e1; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); }
.help-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  list-style: none;
  user-select: none;
}
.help-summary::-webkit-details-marker { display: none; }
.help-summary:hover { background: #f8fafc; }
.help-section[open] .help-summary { border-bottom: 1px solid #e2e8f0; }
.help-icon { font-size: 18px; }
.help-title { flex: 1; }
.help-arrow {
  color: #94a3b8;
  font-size: 14px;
  transition: transform 0.15s;
}
.help-section[open] .help-arrow { transform: rotate(180deg); }

.help-body {
  padding: 8px 24px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 8px 32px;
}
.help-block {
  padding: 14px 0;
  border-bottom: 1px dashed #e2e8f0;
}
.help-block:last-child { border-bottom: none; }
.help-block h3 {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.help-block p {
  font-size: 13px;
  color: #334155;
  margin-bottom: 8px;
  line-height: 1.6;
}
.help-block ul, .help-block ol {
  font-size: 13px;
  color: #334155;
  margin: 8px 0 12px;
  padding-left: 22px;
  line-height: 1.7;
}
.help-block ul ul, .help-block ol ul { margin: 4px 0; }
.help-block li { margin-bottom: 4px; }
.help-block code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'SF Mono', 'Consolas', 'D2Coding', monospace;
  color: #0f172a;
  word-break: break-all;
}
.help-block pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12px;
  overflow-x: auto;
  margin: 8px 0;
}
.help-block pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}
.help-block kbd {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: #334155;
}
.help-block a { color: #2563eb; text-decoration: none; }
.help-block a:hover { text-decoration: underline; }
.help-block strong { color: #0f172a; font-weight: 600; }
.help-tip {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  padding: 8px 12px;
  border-radius: 4px;
  color: #713f12 !important;
  font-size: 12.5px !important;
  margin-top: 8px !important;
}
.help-block-quick { grid-column: 1 / -1; }
.help-cmd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.help-cmd-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}
.help-cmd-table td:first-child {
  width: 30%;
  color: #64748b;
  white-space: nowrap;
}
.help-cmd-table td:last-child { color: #0f172a; }
.help-cmd-table tr:last-child td { border-bottom: none; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  max-width: 640px;
  margin: 40px auto;
}
.empty-state.error { border-color: #fecaca; background: #fef2f2; }
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h2 { font-size: 20px; margin-bottom: 12px; }
.empty-state p { color: #475569; font-size: 14px; margin-bottom: 8px; }
.empty-state code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'SF Mono', Consolas, monospace;
}
.empty-setup { margin-top: 16px; color: #334155 !important; }

/* Disease tabs */
.disease-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 1px;
}
.disease-tab {
  padding: 12px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  border-bottom: 3px solid transparent;
  font-family: inherit;
  transition: all 0.15s;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.disease-tab:hover { color: #0f172a; }
.disease-tab.active { color: #0f172a; }
.disease-tab .tab-count {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #e2e8f0;
  color: #475569;
  font-weight: 500;
}
.disease-tab.active .tab-count { background: rgba(var(--disease-rgb, 67, 56, 202), 0.15); color: var(--disease-color, #4338ca); }

/* Summary */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.summary-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 18px;
  transition: box-shadow 0.15s;
}
.summary-card:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); }
.summary-card .label {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 6px;
}
.summary-card .value {
  font-size: 26px;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.summary-card .sub {
  margin-top: 4px;
  font-size: 11px;
  color: #94a3b8;
}
.summary-card.accent .value { color: var(--disease-color, #4338ca); }
.summary-card.positive .value { color: #059669; }
.summary-card.warn .value { color: #dc2626; }

/* Recommend */
.recommend-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 28px;
  border-left: 4px solid var(--disease-color, #4338ca);
}
.section-head { margin-bottom: 16px; }
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}
.section-desc { font-size: 13px; color: #64748b; }
.section-desc strong { color: var(--disease-color, #4338ca); }
.recommend-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  counter-reset: rec;
}
.recommend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 8px;
  counter-increment: rec;
  font-size: 13.5px;
}
.recommend-item::before {
  content: counter(rec);
  width: 24px;
  height: 24px;
  background: var(--disease-color, #4338ca);
  color: #fff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.recommend-item .kw { font-weight: 500; color: #0f172a; flex: 1; }
.recommend-item .pri-tag {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(var(--disease-rgb, 67, 56, 202), 0.1);
  color: var(--disease-color, #4338ca);
  font-weight: 600;
  flex-shrink: 0;
}
.recommend-empty {
  padding: 20px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
  background: #f8fafc;
  border-radius: 8px;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 16px;
}
.filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-label {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 4px;
}
.filter-btn {
  padding: 6px 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.filter-btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.filter-btn.active {
  background: var(--disease-color, #4338ca);
  color: #fff;
  border-color: var(--disease-color, #4338ca);
}
.search-group { flex: 1; min-width: 240px; justify-content: flex-end; }
.search-input {
  flex: 1;
  max-width: 280px;
  padding: 7px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--disease-color, #4338ca); }
.result-count { font-size: 12px; color: #64748b; }

/* Table */
.table-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}
.table-wrap { overflow-x: auto; }
.keyword-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.keyword-table thead th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  white-space: nowrap;
}
.keyword-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.keyword-table tbody tr:hover { background: #f8fafc; }
.keyword-table tbody tr.exposed { background: rgba(16, 185, 129, 0.03); }
.keyword-table tbody tr.exposed:hover { background: rgba(16, 185, 129, 0.07); }

.kw-cell { font-weight: 500; color: #0f172a; }
.kw-cell a { color: inherit; text-decoration: none; border-bottom: 1px dotted #cbd5e1; }
.kw-cell a:hover { color: var(--disease-color, #4338ca); border-bottom-color: currentColor; }

.pri-cell {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.pri-최상 { background: #fef3c7; color: #92400e; }
.pri-상 { background: #dbeafe; color: #1e40af; }
.pri-중 { background: #f1f5f9; color: #475569; }

.exp-cell { text-align: center; font-weight: 700; font-size: 14px; }
.exp-O { color: #059669; }
.exp-X { color: #dc2626; }

.ch-cell { text-align: center; color: #cbd5e1; font-weight: 600; }
.ch-cell.on { color: #059669; }

/* 발행 체크 컬럼 */
.pub-cell { text-align: center; }
.pub-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  font-size: 12px;
  color: #64748b;
  user-select: none;
}
.pub-toggle:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.pub-checkbox {
  cursor: pointer;
  margin: 0;
  accent-color: #6366f1;
}
.pub-checkbox:checked + .pub-label {
  color: #6366f1;
  font-weight: 600;
}
.keyword-table tbody tr.is-published {
  opacity: 0.55;
}
.keyword-table tbody tr.is-published:hover {
  opacity: 1;
}

/* Footer */
.dash-footer {
  border-top: 1px solid #e2e8f0;
  padding: 20px 0;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
  background: #fff;
}

/* Responsive */
@media (max-width: 720px) {
  .dash-container { padding: 0 16px; }
  .dash-title { font-size: 22px; }
  .summary-card .value { font-size: 22px; }
  .keyword-table { font-size: 12px; }
  .keyword-table thead th,
  .keyword-table tbody td { padding: 9px 10px; }
}
