/* ── index 전용 스타일 ── */

/* ── 상단 컨트롤 바 ── */
.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.sort-area { display: flex; align-items: center; gap: 10px; }
.period-area { display: flex; align-items: center; gap: 8px; }

.filter-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; }
.filter-select { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: 'Noto Sans KR', sans-serif; font-size: 13px; padding: 6px 12px; cursor: pointer; outline: none; transition: border-color 0.2s; width: 100%; }
.filter-select:focus { border-color: var(--accent); }

.date-input { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-family: 'Noto Sans KR', sans-serif; font-size: 13px; padding: 6px 10px; outline: none; transition: border-color 0.2s; }
.date-input:focus { border-color: var(--accent); }
.date-sep { color: var(--muted); font-size: 13px; }

.sort-btn { border: 1px solid var(--border); background: transparent; border-radius: 6px; padding: 5px 12px; font-size: 12px; font-family: 'Noto Sans KR', sans-serif; color: var(--muted); cursor: pointer; transition: all 0.2s; }
.sort-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.total-count { font-size: 12px; color: var(--muted); margin-left: 8px; }
.total-count span { color: var(--text); font-weight: 700; }

/* 오늘 수집만 버튼: 평소에도 눈에 띄게 accent 톤 유지 */
#btn-today-only {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(79,127,255,0.1);
  font-weight: 700;
}
#btn-today-only:hover {
  background: rgba(79,127,255,0.2);
}
#btn-today-only.active {
  background: var(--accent);
  color: #fff;
}

/* ── 바디 레이아웃 ── */
.body-wrap { display: flex; align-items: flex-start; min-height: calc(100vh - 110px); }

/* ── 사이드바 ── */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 60px;
  height: calc(100vh - 110px);
  overflow-y: auto;
}

/* 통계 */
.sidebar-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-item { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.stat-val { font-size: 18px; font-weight: 700; color: var(--accent); }
.stat-lbl { font-size: 10px; color: var(--muted); }

/* 사이드바 섹션 */
.sidebar-section { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 14px; }

/* 타입 + Status 한 줄 */
.type-status-row { display: flex; gap: 6px; align-items: center; }
.type-btn { border: 1px solid var(--border); background: var(--surface2); border-radius: 8px; padding: 6px 10px; font-size: 12px; font-family: 'Noto Sans KR', sans-serif; color: var(--muted); cursor: pointer; transition: all 0.2s; white-space: nowrap; }
.type-btn.active-video { background: rgba(255,79,127,0.15); border-color: var(--tag-video); color: var(--tag-video); }
.type-btn.active-da { background: rgba(79,223,255,0.15); border-color: var(--tag-da); color: var(--tag-da); }
.status-inline { flex: 1; padding: 6px 8px; font-size: 12px; }

/* 게임 검색 통합 */
.game-search-wrap { position: relative; }
.game-search-input {
  width: 100%;
  padding: 7px 10px;
  background: var(--accent);
  background: rgba(79,127,255,0.12);
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 13px;
  font-weight: 700;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
}
.game-search-input:focus { background: var(--surface2); border-color: var(--accent); }
.game-search-input::placeholder { color: var(--text); font-weight: 700; }
.game-search-input.searching::placeholder { color: var(--muted); font-weight: 400; }

/* 게임 목록 */
.sidebar-games { flex: 1; }
.game-list { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.game-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
  color: var(--muted);
}
.game-item:hover { background: var(--surface2); color: var(--text); }
.game-item.active { background: rgba(79,127,255,0.12); color: var(--text); font-weight: 700; border-left: 2px solid var(--accent); }
.game-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-count { font-size: 11px; color: var(--muted); font-weight: 600; min-width: 16px; text-align: right; }
.badge-data {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(76,252,156,0.15);
  border: 1px solid #4cfc9c;
  color: #4cfc9c;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* ── 광고 그리드 ── */
.grid { flex: 1; padding: 20px 24px 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; align-content: start; }

/* ── 카드 ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--card-radius); overflow: hidden; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; }
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.5); border-color: var(--accent); }
.card-thumb { position: relative; width: 100%; padding-top: 125%; overflow: hidden; background: var(--surface2); }
.card-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.card:hover .card-thumb img { transform: scale(1.04); }
.card-thumb-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.thumb-icon { width: 44px; height: 44px; opacity: 0.2; }
.thumb-label { font-size: 11px; color: var(--muted); opacity: 0.5; }

.card-type-badge { position: absolute; top: 8px; left: 8px; border-radius: 4px; padding: 3px 7px; font-size: 10px; font-weight: 700; letter-spacing: 1px; }
.badge-video { background: rgba(255,79,127,0.85); color: #fff; }
.badge-da { background: rgba(79,223,255,0.85); color: #0f1117; }
.badge-ai { background: rgba(168,85,247,0.85); color: #fff; border-radius: 4px; padding: 3px 6px; font-size: 9px; font-weight: 700; }

/* 우측 상단 배지 스택 (국가/AI/Data가 서로 안 겹치도록 flex로 쌓음) */
.card-badge-stack { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* source 배지 */
.badge-source { position: absolute; bottom: 8px; left: 8px; border-radius: 4px; padding: 2px 6px; font-size: 9px; font-weight: 700; letter-spacing: 0.5px; }
.badge-meta   { background: rgba(24,119,242,0.85); color: #fff; }
.badge-manual { background: rgba(255,170,0,0.85); color: #000; }

/* 국가 배지 (썸네일 우측 상단, badge-ai와 겹치지 않도록 AI 배지 있을 때는 JS에서 위치 보정 없이 순서로 처리) */
.badge-country {
  background: rgba(15,17,23,0.85);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.card-body { padding: 20px 20px 22px; }
.card-game-name { font-size: 17px; font-weight: 700; color: var(--accent); line-height: 1.4; margin-bottom: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.6; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.card-date { font-size: 12px; color: var(--muted); }
.card-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; margin-bottom: 8px; }
.card-status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.card-status.active { color: #4cfc9c; }
.card-status.active::before { background: #4cfc9c; }
.card-status.inactive { color: var(--muted); }
.card-status.inactive::before { background: var(--muted); }

.empty-state { grid-column: 1/-1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 0; gap: 12px; color: var(--muted); }
.empty-icon { width: 56px; height: 56px; opacity: 0.2; }
.empty-text { font-size: 14px; }

/* ── 상세 모달 ── */
.modal.modal-wide { max-width: 70vw; width: 70vw; }
.modal-body { padding: 36px; display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.modal-media { border-radius: 12px; overflow: hidden; background: var(--surface2); aspect-ratio: 9/16; display: flex; align-items: center; justify-content: center; }
.modal-media img, .modal-media video { width: 100%; height: 100%; object-fit: contain; }
.modal-details { display: flex; flex-direction: column; gap: 22px; }

/* 가로형 레이아웃 (영상/이미지 비율 가로 > 세로) */
.modal.modal-wide.landscape { max-width: 75vw; width: 75vw; }
.modal-body.landscape { grid-template-columns: 1fr; gap: 24px; }
.modal-body.landscape .modal-media { aspect-ratio: 16/9; width: 100%; }
.modal-body.landscape .modal-details { max-height: 40vh; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 32px; align-content: start; }
.modal-body.landscape .modal-details .ad-text-box,
.modal-body.landscape .modal-details > div:last-child { grid-column: 1 / -1; }
.detail-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-bottom: 6px; }
.detail-value { font-size: 16px; color: var(--text); line-height: 1.5; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ad-text-box { padding: 16px; background: var(--surface2); border-radius: 10px; font-size: 15px; line-height: 1.7; color: var(--text); border: 1px solid var(--border); }
.btn-landing { display: inline-block; padding: 12px 22px; background: rgba(79,127,255,0.1); border: 1px solid var(--accent); border-radius: 9px; color: var(--accent); font-size: 14px; text-decoration: none; transition: all 0.2s; cursor: pointer; }
.btn-landing:hover { background: rgba(79,127,255,0.2); }

/* 카드 Data 뱃지 */
.badge-data-card {
  background: rgba(76,252,156,0.85);
  color: #0f1117;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ── 국가 필터 바 ── */
.grid-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.grid-wrap .grid { flex: 1; }

.country-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.country-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-family: 'Noto Sans KR', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}
.country-btn:hover { border-color: var(--accent); color: var(--accent); }
.country-btn.active {
  background: rgba(79,127,255,0.15);
  border-color: var(--accent);
  color: var(--accent);
}
.country-btn.all { color: var(--text); border-color: var(--border); }
.country-btn.all.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── 페이지네이션 ── */
.ad-pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.page-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.page-ellipsis {
  color: var(--muted);
  padding: 0 4px;
  align-self: center;
}
