/* ── 히스토리 페이지 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --purple: #6c47ff;
  --purple-dark: #5535e0;
  --pink: #ff6b9d;
  --orange: #ffa94d;
  --cyan: #22d3ee;
  --yellow: #ffd32a;
  --text: #111827;
  --text-mid: #4b5563;
  --text-soft: #9ca3af;
  --bg-soft: #f9fafb;
  --border: rgba(0, 0, 0, 0.08);
}

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #fff;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── 헤더 (travel 패턴 동일) ── */
.history-header {
  background: var(--purple);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.history-back {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  width: 80px;
}
.history-back:hover { color: #fff; }
.history-header-center { text-align: center; }
.history-title {
  font-family: 'Syne', 'Noto Sans KR', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  color: #fff;
  letter-spacing: -0.02em;
}
.history-subtitle {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}

/* ── 메인 ── */
.history-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* ── 빈 상태 ── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}
.empty-emoji { font-size: 3.5rem; margin-bottom: 16px; }
.empty-title {
  font-size: 1.15rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  margin-bottom: 10px;
}
.empty-desc {
  font-size: 0.92rem;
  color: var(--text-mid);
  margin-bottom: 28px;
}
.empty-btn {
  display: inline-block;
  padding: 14px 32px;
  background: linear-gradient(135deg, #ff4757 0%, #ff6b9d 50%, #ffa94d 100%);
  color: #fff;
  border-radius: 14px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(255, 71, 87, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.empty-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(255, 71, 87, 0.42); }

/* ── 요약 카드 ── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.summary-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 14px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(108, 71, 255, 0.04);
  transition: transform 0.18s ease, box-shadow 0.2s ease;
}
.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(108, 71, 255, 0.12);
}
.summary-label {
  font-size: 0.75rem;
  color: var(--text-soft);
  font-weight: 600;
  margin-bottom: 6px;
}
.summary-value {
  font-family: 'Syne', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  letter-spacing: -0.02em;
}
.summary-unit {
  font-size: 0.7rem;
  color: var(--text-soft);
  margin-top: 2px;
}

/* ── 차트 그리드 ── */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 28px;
}
.chart-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(108, 71, 255, 0.04);
}
.chart-card.chart-wide { grid-column: 1 / -1; }
.chart-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.chart-wrap {
  position: relative;
  height: 220px;
}
.chart-wide .chart-wrap { height: 200px; }

/* ── 필터 바 ── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.filter-input {
  flex: 1;
  min-width: 200px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.filter-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(108, 71, 255, 0.15);
}
.filter-select {
  padding: 12px 32px 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 0.92rem;
  background: #fff;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236c47ff' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.filter-select:focus {
  outline: none;
  border-color: var(--purple);
}
.filter-count {
  font-size: 0.82rem;
  color: var(--text-soft);
  margin-bottom: 14px;
  padding-left: 4px;
}

/* ── 리스트 ── */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}
.history-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.18s;
}
.history-card:hover {
  border-color: rgba(108, 71, 255, 0.25);
  box-shadow: 0 6px 16px rgba(108, 71, 255, 0.08);
  transform: translateY(-1px);
}
.history-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.history-mode-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  letter-spacing: 0.3px;
}
.history-mode-badge.text { background: rgba(108, 71, 255, 0.1); color: var(--purple); }
.history-mode-badge.image { background: rgba(34, 211, 238, 0.12); color: #0e9dac; }
.history-time {
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-left: auto;
}
.history-vs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.history-option {
  font-weight: 700;
  font-size: 0.95rem;
  padding: 4px 10px;
  border-radius: 8px;
  background: #f5f3ff;
  color: var(--text-mid);
}
.history-option.winner {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
}
.history-vs-dot {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-soft);
}
.history-reasoning {
  font-size: 0.86rem;
  color: var(--text-mid);
  font-style: italic;
  line-height: 1.5;
}

/* ── 하단 액션 ── */
.bottom-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.action-btn {
  padding: 10px 20px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-mid);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.action-btn:hover {
  border-color: rgba(108, 71, 255, 0.35);
  color: var(--purple);
  transform: translateY(-1px);
}
.action-danger:hover {
  border-color: #ef4444;
  color: #ef4444;
}

/* ── 반응형 ── */
@media (max-width: 768px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-card.chart-wide { grid-column: 1; }
}
@media (max-width: 480px) {
  .history-main { padding: 20px 14px 60px; }
  .history-title { font-size: 1.15rem; }
  .summary-value { font-size: 1.35rem; }
  .filter-input { min-width: 0; }
}
