/* ── 리셋 & 베이스 ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f4f5f7;
  --surface:   #ffffff;
  --border:    #e2e4e9;
  --primary:   #1a56db;
  --primary-h: #1648c0;
  --danger:    #e02424;
  --success:   #057a55;
  --text:      #111928;
  --muted:     #6b7280;
  --radius:    8px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

body {
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 네비게이션 ────────────────────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.navbar-brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.navbar-brand:hover { text-decoration: none; color: var(--primary); }

.nav-links { display: flex; gap: 4px; }
.nav-links a {
  padding: 6px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-links a:hover       { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-links a.active      { background: #eff6ff; color: var(--primary); }

/* ── 컨테이너 ──────────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 28px 20px; }

/* ── 페이지 헤더 ────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-header .subtitle { color: var(--muted); font-size: 13px; }

/* ── 카드 ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

/* ── 폼 ────────────────────────────────────────────────────────────────── */
.form-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

input[type="text"],
input[type="date"],
select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s;
  min-width: 200px;
}
input[type="text"]:focus,
input[type="date"]:focus,
select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.12); }

/* ── 버튼 ──────────────────────────────────────────────────────────────── */
.btn {
  height: 38px;
  padding: 0 18px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background .15s, opacity .15s;
}
.btn-sm   { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { opacity: .88; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .88; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg); }

/* ── 상태 박스 ─────────────────────────────────────────────────────────── */
.status-box {
  background: #1e2433;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  flex-direction: column;
  gap: 10px;
}
.status-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #e2e8f0;
  font-weight: 600;
  font-size: 13px;
}
.status-log {
  max-height: 180px;
  overflow-y: auto;
  font-family: "Menlo", "Consolas", monospace;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.8;
}
.status-log div:last-child { color: #cbd5e1; }

/* ── 스피너 ────────────────────────────────────────────────────────────── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 결과 헤더 ─────────────────────────────────────────────────────────── */
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 8px;
}

/* ── 테이블 ────────────────────────────────────────────────────────────── */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: #f8f9fc;
  padding: 11px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .3px;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafbff; }
tbody td { padding: 10px 14px; vertical-align: middle; }

td.num   { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.email { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.channel-link { font-weight: 600; color: var(--text); }
.channel-link:hover { color: var(--primary); }
.link-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: #eff6ff;
  color: var(--primary);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  margin-right: 4px;
}
.link-btn:hover { background: #dbeafe; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ── 배지 ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-cat { background: #ede9fe; color: #5b21b6; }

/* ── 단건 결과 카드 ─────────────────────────────────────────────────────── */
.result-card { margin-top: 8px; }
.result-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.result-card-header h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-item {
  background: var(--bg);
  border-radius: 8px;
  padding: 14px 16px;
}
.stat-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.stat-value { font-size: 18px; font-weight: 700; color: var(--text); }
.video-links { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── 탭 ────────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover  { color: var(--text); }

/* ── 필터 바 ────────────────────────────────────────────────────────────── */
.filter-bar { padding: 14px 20px; }

/* ── 페이지네이션 ────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; justify-content: center; padding: 12px 0; }
.page-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.page-btn:hover { background: var(--bg); color: var(--text); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-gap { display: flex; align-items: center; color: var(--muted); font-size: 13px; }
