/* ============================================
   Design Tokens
   ============================================ */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f0f0f5;
  --text-secondary: #9898a8;
  --text-muted: #5c5c6e;
  --accent: #00C73C;
  --accent-light: #00E676;
  --accent-glow: rgba(0, 199, 60, 0.15);
  --accent-2: #6366f1;
  --accent-2-light: #818cf8;
  --danger: #ff4757;
  --orange: #f59e0b;
  --cyan: #06b6d4;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --font-sans: 'Inter', 'Noto Sans KR', -apple-system, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   Background Effects
   ============================================ */
.bg-effects {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.gradient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
}

.orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(0, 199, 60, 0.12), transparent 70%);
  top: -200px; right: -100px;
  animation: orbFloat1 20s ease-in-out infinite;
}

.orb-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.1), transparent 70%);
  bottom: -150px; left: -100px;
  animation: orbFloat2 25s ease-in-out infinite;
}

.orb-3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0, 230, 118, 0.06), transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: orbFloat3 30s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(-50px, 80px); }
  66% { transform: translate(30px, -40px); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(60px, -40px); }
  66% { transform: translate(-30px, 60px); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
}

/* ============================================
   Container
   ============================================ */
.container {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* ============================================
   Header
   ============================================ */
.header {
  text-align: center;
  margin-bottom: 32px;
  animation: fadeInUp 0.6s ease-out;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 10px;
}

.logo-icon {
  width: 40px; height: 40px;
  filter: drop-shadow(0 0 12px rgba(0, 199, 60, 0.3));
}

.logo h1 {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ============================================
   Glass Card
   ============================================ */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ============================================
   Tab Navigation
   ============================================ */
.tab-nav {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 32px;
  animation: fadeInUp 0.6s ease-out 0.05s both;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition);
}

.tab-btn svg {
  width: 18px; height: 18px;
}

.tab-btn:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  background: linear-gradient(135deg, rgba(0, 199, 60, 0.12), rgba(0, 230, 118, 0.08));
  color: var(--accent-light);
  box-shadow: 0 2px 12px rgba(0, 199, 60, 0.1);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
  display: block;
}

/* ============================================
   Magazine List
   ============================================ */
.magazine-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 10px;
  animation: fadeInUp 0.4s ease-out both;
}

.magazine-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.25);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.magazine-card-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(99, 102, 241, 0.06));
  border-radius: var(--radius-md);
  min-width: 70px;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

.magazine-card-date .day {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-2-light);
  line-height: 1;
}

.magazine-card-date .month {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
}

.magazine-card-date .weekday {
  font-size: 11px;
  color: var(--accent-2-light);
  margin-top: 4px;
  font-weight: 500;
}

.magazine-card-body {
  flex: 1;
}

.magazine-card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.magazine-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.magazine-card-arrow {
  width: 20px; height: 20px;
  color: var(--text-muted);
  transition: transform var(--transition), color var(--transition);
}

.magazine-card:hover .magazine-card-arrow {
  transform: translateX(4px);
  color: var(--accent-2-light);
}

/* ============================================
   Back Button
   ============================================ */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 20px;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.back-btn svg {
  width: 16px; height: 16px;
}

/* ============================================
   Magazine Info Card
   ============================================ */
.magazine-info {
  padding: 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.magazine-info-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-2-light));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.magazine-info-icon svg {
  width: 28px; height: 28px;
  color: white;
}

.magazine-info-text h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.magazine-info-text p {
  font-size: 13px;
  color: var(--text-muted);
}

.magazine-info-stats {
  margin-left: auto;
  display: flex;
  gap: 20px;
}

.stat-item {
  text-align: center;
}

.stat-item .stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-light);
}

.stat-item .stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   Analysis Tabs
   ============================================ */
.analysis-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.analysis-tab {
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
}

.analysis-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.analysis-tab.active {
  background: rgba(0, 199, 60, 0.1);
  border-color: rgba(0, 199, 60, 0.2);
  color: var(--accent-light);
}

.analysis-panel {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.analysis-panel.active {
  display: block;
}

/* ============================================
   Word Cloud
   ============================================ */
.wordcloud-container {
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
  overflow: hidden;
}

.wordcloud-container canvas {
  width: 100%;
  max-height: 500px;
  border-radius: var(--radius-md);
}

.wordcloud-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.legend-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--glass-border);
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}

/* ============================================
   Keywords Grid
   ============================================ */
.keywords-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}

.keyword-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  cursor: pointer;
}

.keyword-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(0, 199, 60, 0.2);
}

.keyword-rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  width: 24px;
  text-align: center;
}

.keyword-rank.top3 {
  color: var(--accent-light);
}

.keyword-word {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.keyword-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.keyword-bar {
  position: relative;
  height: 4px;
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
  overflow: hidden;
  min-width: 60px;
}

.keyword-bar-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 2px;
  transition: width 0.6s ease-out;
}

/* ============================================
   Text Viewer
   ============================================ */
.text-viewer {
  padding: 24px;
  max-height: 600px;
  overflow-y: auto;
}

.text-page {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.text-page:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.text-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.text-page-num {
  font-size: 11px;
  color: var(--accent-2-light);
  font-weight: 600;
  padding: 3px 10px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 100px;
}

.text-page-chars {
  font-size: 11px;
  color: var(--text-muted);
}

.text-page-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ============================================
   Related News
   ============================================ */
.related-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.related-keyword-btn {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
}

.related-keyword-btn:hover {
  background: rgba(0, 199, 60, 0.08);
  border-color: rgba(0, 199, 60, 0.2);
  color: var(--accent-light);
}

.related-keyword-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  border-color: transparent;
}

/* ============================================
   Search Section (News Tab)
   ============================================ */
.search-section { margin-bottom: 32px; }

.search-box { padding: 24px; }

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 6px 6px 6px 18px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
  width: 20px; height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

#searchInput {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 16px;
  font-family: var(--font-sans);
  outline: none;
  padding: 10px 0;
}

#searchInput::placeholder { color: var(--text-muted); }

.search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0, 199, 60, 0.35);
}

.search-btn:active { transform: translateY(0); }
.search-btn svg { width: 16px; height: 16px; }

.search-options {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.option-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.option-group label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.option-group select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239898a8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.option-group select:focus { border-color: var(--accent); }
.option-group select option { background: var(--bg-secondary); color: var(--text-primary); }

/* ============================================
   Results / News Cards
   ============================================ */
.results-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 4px;
}

#totalCount { font-size: 14px; color: var(--text-secondary); font-weight: 500; }
#totalCount strong { color: var(--accent-light); font-weight: 600; }
#currentRange { font-size: 13px; color: var(--text-muted); }

.results-grid { display: flex; flex-direction: column; gap: 12px; }

.news-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition);
  cursor: pointer;
  animation: fadeInUp 0.4s ease-out both;
}

.news-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(0, 199, 60, 0.2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.news-card-title {
  font-size: 17px; font-weight: 600;
  line-height: 1.5; margin-bottom: 10px;
  color: var(--text-primary);
  transition: color var(--transition);
}

.news-card:hover .news-card-title { color: var(--accent-light); }
.news-card-title b { color: var(--accent-light); font-weight: 700; }

.news-card-desc {
  font-size: 14px; line-height: 1.7;
  color: var(--text-secondary); margin-bottom: 14px;
}

.news-card-desc b { color: var(--accent); font-weight: 600; }

.news-card-meta {
  display: flex; align-items: center;
  gap: 16px; flex-wrap: wrap;
}

.news-card-date {
  display: flex; align-items: center;
  gap: 6px; font-size: 12px; color: var(--text-muted);
}

.news-card-date svg { width: 14px; height: 14px; }

.news-card-source {
  font-size: 12px; color: var(--text-muted);
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.news-card-link {
  margin-left: auto;
  display: flex; align-items: center;
  gap: 4px; font-size: 12px;
  color: var(--accent); text-decoration: none; font-weight: 500;
  opacity: 0; transform: translateX(-8px);
  transition: all var(--transition);
}

.news-card:hover .news-card-link { opacity: 1; transform: translateX(0); }
.news-card-link svg { width: 14px; height: 14px; }

/* ============================================
   Loading / Error / Empty
   ============================================ */
.loading { text-align: center; padding: 60px 20px; }

.spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.06);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

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

.loading p { color: var(--text-muted); font-size: 14px; }

.error-message {
  display: flex; align-items: center;
  gap: 14px; padding: 20px 24px;
  margin-bottom: 20px;
  border-color: rgba(255, 71, 87, 0.2);
  background: rgba(255, 71, 87, 0.05);
}

.error-message svg { width: 24px; height: 24px; color: var(--danger); flex-shrink: 0; }
.error-message p { color: var(--danger); font-size: 14px; }

.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-state svg { width: 100px; height: 100px; margin-bottom: 24px; opacity: 0.6; }
.empty-state h2 { font-size: 20px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--text-muted); }

/* ============================================
   Pagination
   ============================================ */
.pagination {
  display: flex; justify-content: center;
  align-items: center; gap: 20px; margin-top: 32px;
}

.page-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 14px; font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition);
}

.page-btn:hover:not(:disabled) {
  background: rgba(0, 199, 60, 0.08);
  border-color: rgba(0, 199, 60, 0.2);
  color: var(--accent-light);
}

.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.page-btn svg { width: 16px; height: 16px; }
.page-info { font-size: 14px; color: var(--text-muted); font-weight: 500; }

/* ============================================
   Footer
   ============================================ */
.footer {
  position: relative; z-index: 1;
  text-align: center; padding: 40px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  margin-top: 40px;
}

.footer p { font-size: 13px; color: var(--text-muted); }
.footer strong { color: var(--accent); font-weight: 600; }

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
  .container { padding: 24px 16px; }
  .logo h1 { font-size: 22px; }
  .search-box { padding: 16px; }

  .search-input-wrap {
    flex-wrap: wrap; padding: 12px; gap: 8px;
  }

  .search-icon { display: none; }
  #searchInput { width: 100%; padding: 8px 0; }
  .search-btn { width: 100%; justify-content: center; padding: 14px; }
  .search-options { flex-direction: column; gap: 10px; }

  .magazine-card { flex-direction: column; text-align: center; }
  .magazine-info { flex-direction: column; text-align: center; }
  .magazine-info-stats { margin-left: 0; }

  .news-card { padding: 18px; }
  .news-card-title { font-size: 15px; }
  .news-card-link { opacity: 1; transform: none; }

  .keywords-grid { grid-template-columns: 1fr; }
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ============================================
   Trend Tabs & Panels
   ============================================ */
.trend-tab {
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-sans);
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
}

.trend-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.trend-tab.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
  color: var(--accent-2-light);
}

.trend-panel {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.trend-panel.active {
  display: block;
}

/* Trend keyword chips */
.trend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid;
  cursor: default;
}

.trend-chip .remove-chip {
  cursor: pointer;
  opacity: 0.6;
  font-size: 14px;
}

.trend-chip .remove-chip:hover {
  opacity: 1;
}

/* ============================================
   Daily Hot Grid
   ============================================ */
.daily-hot-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 10px;
  animation: fadeInUp 0.3s ease-out both;
}

.daily-hot-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.daily-hot-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-2-light);
  min-width: 90px;
}

.daily-hot-title {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.daily-hot-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hot-keyword {
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.hot-keyword:hover {
  transform: scale(1.05);
}

/* ============================================
   Compare Results
   ============================================ */
.compare-section {
  margin-bottom: 20px;
}

.compare-section-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
}

.compare-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}

.compare-item:hover {
  background: var(--bg-card-hover);
}

.compare-change {
  font-weight: 600;
  font-size: 12px;
}

.compare-change.up { color: #f43f5e; }
.compare-change.down { color: #06b6d4; }
.compare-change.new { color: var(--accent-light); }
.compare-change.gone { color: var(--text-muted); }

/* ============================================
   Stock Grid
   ============================================ */
.stock-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all var(--transition);
  animation: fadeInUp 0.3s ease-out both;
}

.stock-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(245, 158, 11, 0.2);
}

.stock-rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  width: 24px;
  text-align: center;
}

.stock-rank.top3 { color: var(--orange); }

.stock-name {
  font-size: 14px;
  font-weight: 600;
  min-width: 100px;
}

.stock-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  overflow: hidden;
}

.stock-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), #f59e0b);
  border-radius: 3px;
  transition: width 0.8s ease-out;
}

.stock-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 30px;
  text-align: right;
}

.stock-sparkline {
  display: flex;
  align-items: end;
  gap: 2px;
  height: 24px;
}

.spark-bar {
  width: 6px;
  background: rgba(245, 158, 11, 0.3);
  border-radius: 2px 2px 0 0;
  transition: height 0.5s ease-out;
}

.spark-bar.has-value {
  background: var(--orange);
}

.compare-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239898a8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.compare-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ============================================
   Dashboard
   ============================================ */
.dash-hero {
  padding: 28px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, rgba(0, 199, 60, 0.06), rgba(99, 102, 241, 0.04));
}

.dash-hero-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.dash-hero-icon svg { width: 30px; height: 30px; color: white; }

.dash-hero-text h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.dash-hero-text p { font-size: 13px; color: var(--text-muted); }

.dash-hero-stats {
  margin-left: auto;
  display: flex; gap: 24px;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.dash-card {
  padding: 20px;
}

.dash-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.dash-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 13px;
}

.dash-item:last-child { border-bottom: none; }

.dash-item-name {
  font-weight: 500;
  cursor: pointer;
  transition: color var(--transition);
}

.dash-item-name:hover { color: var(--accent-light); }

.dash-item-value { color: var(--text-muted); font-weight: 500; }
.dash-item-change { font-weight: 600; font-size: 12px; }
.dash-item-change.up { color: #f43f5e; }
.dash-item-change.down { color: #06b6d4; }

/* Sentiment bars */
.sentiment-bar-wrap {
  margin-bottom: 6px;
}

.sentiment-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}

.sentiment-bar {
  height: 24px;
  display: flex;
  border-radius: 4px;
  overflow: hidden;
}

.sentiment-pos {
  background: linear-gradient(90deg,  #00C73C, #00E676);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: white;
  transition: width 0.6s ease-out;
}

.sentiment-neg {
  background: linear-gradient(90deg, #ff4757, #ff6b81);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: white;
  transition: width 0.6s ease-out;
}

/* Sector ranking item */
.sector-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  animation: fadeInUp 0.3s ease-out both;
}

.sector-rank {
  font-size: 16px;
  font-weight: 700;
  width: 28px;
  text-align: center;
}

.sector-name {
  font-size: 14px;
  font-weight: 600;
  min-width: 110px;
}

.sector-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  overflow: hidden;
}

.sector-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s ease-out;
}

.sector-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

@media (max-width: 640px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-hero { flex-direction: column; text-align: center; }
  .dash-hero-stats { margin-left: 0; }
}

/* Deep Analysis Tabs */
.deep-tab {
  padding: 10px 20px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.deep-tab.active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: var(--glass-border);
}

.deep-panel { display: none; margin-top: 16px; }
.deep-panel.active { display: block; animation: fadeInUp 0.3s ease-out; }

/* Anomaly Banner */
.anomaly-banner {
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  animation: fadeInUp 0.4s ease-out;
  cursor: pointer;
  transition: transform var(--transition);
}

.anomaly-banner:hover {
  transform: translateY(-1px);
}

.anomaly-banner.surge {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.25);
  color: #f43f5e;
}

.anomaly-banner.drop {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.25);
  color: #06b6d4;
}

.anomaly-banner.new-kw {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.25);
  color: #a855f7;
}

.anomaly-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.anomaly-word {
  font-weight: 700;
  font-size: 15px;
}

.anomaly-change {
  margin-left: auto;
  font-weight: 700;
  font-size: 14px;
}

.anomaly-meta {
  color: var(--text-muted);
  font-size: 12px;
}

/* Co-occurrence table */
.cooc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.cooc-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--glass-border);
}

.cooc-table td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.cooc-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.cooc-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  width: 100%;
}

.cooc-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.6s ease-out;
}

/* Timeline slider */
#timelineSlider {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  outline: none;
}

#timelineSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(0, 199, 60, 0.4);
}
