/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-hover: #252525;
  --border: #333;
  --text: #f1f1f1;
  --text-dim: #aaa;
  --accent: #ff4444;
  --ppp: #E61E2B;
  --dpk: #004EA2;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.4);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,15,15,.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 800;
  white-space: nowrap;
}

.logo-icon { font-size: 1.6rem; }
.logo .highlight { color: var(--accent); }

.header-stats {
  font-size: 0.85rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ===== Buttons ===== */
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .2s;
  white-space: nowrap;
}

.btn:hover { opacity: .85; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover { background: var(--surface-hover); }

/* ===== Filter Bar ===== */
.filter-bar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px;
}

.filter-section { margin-bottom: 16px; }

.filter-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all .2s;
  user-select: none;
}

.chip:hover { border-color: #555; color: var(--text); }

.chip.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(255,68,68,.12);
}

.chip .party-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Region chips */
.chip-region.active {
  border-color: #ffa500;
  background: rgba(255,165,0,.12);
  color: var(--text);
}

/* Position chips */
.chip-position.active {
  border-color: #4ecdc4;
  background: rgba(78,205,196,.12);
  color: var(--text);
}

/* Party-specific chip colors */
.party-chip[data-value="국민의힘"].active {
  border-color: var(--ppp);
  background: rgba(230,30,43,.12);
}

.party-chip[data-value="더불어민주당"].active {
  border-color: var(--dpk);
  background: rgba(0,78,162,.12);
}

.party-chip[data-value="진보당"].active {
  border-color: #D6001C;
  background: rgba(214,0,28,.12);
}

.party-chip[data-value="all"].active {
  border-color: var(--accent);
  background: rgba(255,68,68,.12);
}

/* ===== Status ===== */
.status-bar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.status-text {
  font-size: 0.9rem;
  color: var(--text-dim);
}

.status-text strong { color: var(--text); }

/* ===== Video Grid ===== */
.video-grid {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.video-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 420px;
  overflow: hidden;
  background: #000;
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-thumb .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.35);
  opacity: 0;
  transition: opacity .2s;
}

.video-card:hover .play-overlay { opacity: 1; }

.play-btn {
  width: 56px;
  height: 56px;
  background: rgba(255,0,0,.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-btn::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 0 10px 18px;
  border-color: transparent transparent transparent #fff;
  margin-left: 3px;
}

.video-info { padding: 14px; }

.video-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.video-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.video-channel {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.video-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  color: #fff;
}

.tag-region {
  background: #555;
}

.tag-position {
  background: #3a7d78;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 9 / 16;
  max-height: 85vh;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}

.modal iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,.6);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { background: rgba(0,0,0,.8); }

/* ===== Loading ===== */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--text-dim);
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Empty ===== */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-dim);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { color: var(--text); margin-bottom: 8px; }

/* ===== Scroll to top ===== */
.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 50;
}

.scroll-top.visible { opacity: 1; pointer-events: auto; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; align-items: stretch; }
  .logo { justify-content: center; }
  .header-stats { text-align: center; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
  .filter-bar { padding: 14px 16px; }
  .video-grid { padding: 0 16px 40px; }
  .status-bar { padding: 0 16px 12px; }
}

@media (max-width: 480px) {
  .video-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .video-info { padding: 10px; }
  .video-title { font-size: 0.8rem; }
  .video-meta { gap: 4px; }
  .chip { font-size: 0.78rem; padding: 5px 10px; }
}
