:root {
  --bg-primary: #030712;
  --bg-secondary: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #273549;
  --bg-input: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-dark: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5);
  --transition: all 0.25s ease;
  --max-width: 1280px;
  --header-height: 68px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent-light); text-decoration: none; transition: var(--transition); }
a:hover { color: #a5b4fc; }
img { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* ===== HEADER ===== */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-height);
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%;
}

.logo {
  font-size: 1.25rem; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}

.logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent-gradient);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; color: white;
}

.logo span { color: var(--accent-light); }

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

.nav a {
  padding: 8px 16px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.9rem; font-weight: 500;
  transition: var(--transition);
}

.nav a:hover, .nav a.active {
  color: var(--text-primary); background: rgba(99, 102, 241, 0.1);
}

.nav a.active { color: var(--accent-light); }

.mobile-toggle {
  display: none; background: none; border: none;
  color: var(--text-primary); font-size: 1.5rem; padding: 4px;
}

.mobile-nav {
  display: none; position: fixed; top: var(--header-height); left: 0; right: 0;
  background: rgba(3, 7, 18, 0.95); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border); padding: 16px 24px;
  flex-direction: column; gap: 8px; z-index: 99;
}

.mobile-nav.open { display: flex; }
.mobile-nav a {
  padding: 12px 16px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 1rem;
}
.mobile-nav a:hover { color: var(--text-primary); background: rgba(99, 102, 241, 0.1); }

/* ===== HERO ===== */
.hero {
  padding: 140px 0 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 800px; height: 600px;
  background: radial-gradient(ellipse, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800; line-height: 1.15;
  margin-bottom: 16px; position: relative;
}

.hero h1 .gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.125rem; color: var(--text-secondary);
  max-width: 600px; margin: 0 auto 40px; position: relative;
}

/* ===== SEARCH ===== */
.search-box {
  max-width: 640px; margin: 0 auto 48px; position: relative;
}

.search-box input {
  width: 100%; padding: 16px 24px 16px 52px;
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: 999px; color: var(--text-primary);
  font-size: 1rem; outline: none; transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-box input::placeholder { color: var(--text-muted); }

.search-box .search-icon {
  position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 1.1rem; pointer-events: none;
}

.search-box .search-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  padding: 10px 24px; background: var(--accent-gradient);
  border: none; border-radius: 999px; color: white;
  font-weight: 600; font-size: 0.9rem; transition: var(--transition);
}

.search-box .search-btn:hover { opacity: 0.9; transform: translateY(-50%) scale(1.02); }

/* ===== CATEGORIES ===== */
.categories {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; margin-bottom: 48px;
}

.cat-chip {
  padding: 8px 18px; border-radius: 999px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); white-space: nowrap;
}

.cat-chip:hover, .cat-chip.active {
  background: rgba(99, 102, 241, 0.15); border-color: var(--accent);
  color: var(--accent-light);
}

/* ===== SECTION ===== */
.section { padding: 60px 0; }
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 32px; flex-wrap: wrap; gap: 16px;
}
.section-title {
  font-size: 1.5rem; font-weight: 700;
}
.section-link {
  font-size: 0.9rem; color: var(--accent-light); font-weight: 500;
  display: flex; align-items: center; gap: 4px;
}

/* ===== PRODUCT GRID ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  transition: var(--transition); cursor: pointer;
  display: flex; flex-direction: column;
}

.product-card:hover {
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.08);
}

.product-card-header {
  display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px;
}

.product-thumb {
  width: 56px; height: 56px; border-radius: var(--radius-sm);
  background: var(--bg-secondary); flex-shrink: 0;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}

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

.product-thumb .fallback {
  font-size: 1.5rem; font-weight: 700; color: var(--accent-light);
}

.product-info { flex: 1; min-width: 0; }
.product-name {
  font-size: 1rem; font-weight: 600; color: var(--text-primary);
  margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.product-tagline {
  font-size: 0.85rem; color: var(--text-secondary); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 14px;
  border-top: 1px solid var(--border);
}

.product-stats {
  display: flex; gap: 14px;
}

.stat {
  display: flex; align-items: center; gap: 4px;
  font-size: 0.8rem; color: var(--text-muted);
}
.stat .icon { font-size: 0.85rem; }
.stat .value { font-weight: 600; color: var(--text-secondary); }

.product-topics {
  display: flex; gap: 6px; flex-wrap: wrap;
}

.topic-tag {
  font-size: 0.7rem; padding: 3px 8px;
  border-radius: 999px; background: rgba(99, 102, 241, 0.1);
  color: var(--accent-light); white-space: nowrap;
}

/* ===== RANKINGS TABLE ===== */
.rankings-controls {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 24px;
  align-items: center;
}

.filter-select {
  padding: 10px 16px; background: var(--bg-card);
  border: 1px solid var(--border-light); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 0.9rem; outline: none;
  min-width: 180px;
}

.filter-select:focus { border-color: var(--accent); }
.filter-select option { background: var(--bg-card); }

.ranking-list { display: flex; flex-direction: column; gap: 8px; }

.ranking-item {
  display: grid;
  grid-template-columns: 50px 56px 1fr auto;
  gap: 16px; align-items: center;
  padding: 16px 20px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: var(--transition); cursor: pointer;
}

.ranking-item:hover {
  border-color: rgba(99, 102, 241, 0.3);
  background: var(--bg-card-hover);
}

.rank-num {
  font-size: 1.1rem; font-weight: 700; color: var(--text-muted);
  text-align: center;
}
.rank-num.top3 { color: var(--warning); }

.ranking-thumb {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  overflow: hidden; background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
}
.ranking-thumb img { width: 100%; height: 100%; object-fit: cover; }

.ranking-info { min-width: 0; }
.ranking-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 2px; }
.ranking-tagline {
  font-size: 0.8rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.ranking-stats { display: flex; gap: 20px; align-items: center; }

.rank-stat {
  text-align: center; min-width: 60px;
}
.rank-stat-value {
  font-size: 1rem; font-weight: 700; color: var(--text-primary);
}
.rank-stat-label {
  font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== TRENDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  text-align: center;
}

.stat-card-value {
  font-size: 2rem; font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card-label {
  font-size: 0.85rem; color: var(--text-muted); margin-top: 4px;
}

.chart-container {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  margin-bottom: 24px;
}

.chart-title {
  font-size: 1.1rem; font-weight: 600; margin-bottom: 20px;
}

.chart-canvas { width: 100%; max-height: 360px; }

.top-categories {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.cat-bar-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.cat-bar-name { font-size: 0.9rem; font-weight: 500; min-width: 140px; }

.cat-bar-track {
  flex: 1; height: 8px; background: var(--bg-secondary);
  border-radius: 999px; overflow: hidden;
}

.cat-bar-fill {
  height: 100%; background: var(--accent-gradient);
  border-radius: 999px; transition: width 0.8s ease;
}

.cat-bar-count { font-size: 0.85rem; color: var(--text-muted); min-width: 40px; text-align: right; }

/* ===== PRODUCT DETAIL ===== */
.product-detail {
  padding-top: calc(var(--header-height) + 40px);
  padding-bottom: 60px;
}

.detail-header {
  display: flex; gap: 24px; align-items: flex-start;
  margin-bottom: 32px; flex-wrap: wrap;
}

.detail-thumb {
  width: 80px; height: 80px; border-radius: var(--radius);
  overflow: hidden; background: var(--bg-card); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }

.detail-meta { flex: 1; }
.detail-name { font-size: 1.75rem; font-weight: 800; margin-bottom: 4px; }
.detail-tagline { font-size: 1.05rem; color: var(--text-secondary); margin-bottom: 12px; }

.detail-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.9rem; border: none;
  transition: var(--transition);
}
.btn-primary { background: var(--accent-gradient); color: white; }
.btn-primary:hover { opacity: 0.9; color: white; }
.btn-outline {
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent-light); }

.detail-stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin-bottom: 32px;
}

.detail-stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 20px; text-align: center;
}

.detail-stat-value { font-size: 1.5rem; font-weight: 700; }
.detail-stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

.detail-description {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 32px;
}

.detail-description h3 { font-size: 1.1rem; margin-bottom: 12px; }
.detail-description p { color: var(--text-secondary); line-height: 1.8; }

.detail-topics {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 40px;
}

.detail-topic {
  padding: 6px 16px; border-radius: 999px;
  background: rgba(99, 102, 241, 0.1); border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--accent-light); font-size: 0.85rem; font-weight: 500;
}

/* ===== DETAIL CHARTS ===== */
.detail-charts-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px;
}

.detail-chart-half { margin-bottom: 0; }

.gauge-container {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 10px 0;
}

.gauge { text-align: center; position: relative; }

.gauge-svg { width: 180px; height: 110px; }

.gauge-fill { transition: stroke-dasharray 1.2s ease; }

.gauge-value {
  font-size: 2.2rem; font-weight: 800; margin-top: -16px;
}

.gauge-label {
  font-size: 0.8rem; color: var(--text-muted); margin-top: 2px;
}

.gauge-metrics {
  display: flex; gap: 24px; margin-top: 16px; justify-content: center;
}

.gauge-metric { text-align: center; }

.gauge-metric-val {
  display: block; font-size: 1.1rem; font-weight: 700; color: var(--text-primary);
}

.gauge-metric-lbl {
  display: block; font-size: 0.7rem; color: var(--text-muted); margin-top: 2px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ===== LEGAL / STATIC PAGES ===== */
.legal-page {
  padding-top: calc(var(--header-height) + 48px); padding-bottom: 60px;
  max-width: 800px; margin: 0 auto;
}

.legal-page h1 {
  font-size: 2rem; font-weight: 800; margin-bottom: 8px;
}

.legal-page .legal-updated {
  color: var(--text-muted); font-size: 0.85rem; margin-bottom: 36px;
}

.legal-page h2 {
  font-size: 1.25rem; font-weight: 700; margin: 32px 0 12px;
  padding-top: 16px; border-top: 1px solid var(--border);
}

.legal-page h2:first-of-type { border-top: none; padding-top: 0; }

.legal-page p, .legal-page li {
  color: var(--text-secondary); line-height: 1.85; margin-bottom: 12px;
}

.legal-page ul { padding-left: 24px; margin-bottom: 16px; }
.legal-page li { margin-bottom: 6px; }

.legal-page a { color: var(--accent-light); }
.legal-page a:hover { text-decoration: underline; }

/* ===== ABOUT PAGE ===== */
.about-hero {
  padding: calc(var(--header-height) + 60px) 0 48px;
  text-align: center; position: relative;
}

.about-hero::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 700px; height: 500px;
  background: radial-gradient(ellipse, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.about-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem); font-weight: 800; margin-bottom: 12px;
  position: relative;
}

.about-hero p {
  color: var(--text-secondary); font-size: 1.05rem;
  max-width: 600px; margin: 0 auto; position: relative; line-height: 1.7;
}

.about-section { padding: 48px 0; }

.about-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px; margin-top: 32px;
}

.about-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
}

.about-card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(99, 102, 241, 0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; margin-bottom: 16px;
}

.about-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.about-card p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.6; }

.about-numbers {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin-top: 32px;
}

.about-num-card { text-align: center; padding: 24px; }

.about-num-val {
  font-size: 2rem; font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.about-num-lbl { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex; justify-content: center; align-items: center;
  gap: 8px; margin-top: 40px;
}

.page-btn {
  padding: 8px 14px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 0.9rem; font-weight: 500;
  transition: var(--transition);
}

.page-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: white; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== LOADING ===== */
.loading {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 0; gap: 16px;
}

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

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

.loading-text { color: var(--text-muted); font-size: 0.9rem; }

.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state p { font-size: 1rem; }

/* ===== FOOTER ===== */
.footer {
  border-top: 1px solid var(--border); padding: 48px 0 24px;
  margin-top: 60px;
}

.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr;
  gap: 40px; margin-bottom: 32px;
}

.footer-logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1.05rem; margin-bottom: 12px;
}

.footer-desc {
  color: var(--text-muted); font-size: 0.85rem; line-height: 1.6;
  max-width: 320px;
}

.footer-col { display: flex; flex-direction: column; gap: 8px; }

.footer-col-title {
  font-weight: 600; font-size: 0.85rem; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
}

.footer-col a { font-size: 0.85rem; color: var(--text-muted); }
.footer-col a:hover { color: var(--text-primary); }

.footer-bottom {
  font-size: 0.8rem; color: var(--text-muted);
  border-top: 1px solid var(--border); padding-top: 20px;
  text-align: center;
}

/* ===== PAGE HEADER ===== */
.page-hero {
  padding: calc(var(--header-height) + 48px) 0 40px;
  text-align: center;
}

.page-hero h1 {
  font-size: 2rem; font-weight: 800; margin-bottom: 8px;
}

.page-hero p {
  color: var(--text-secondary); font-size: 1rem; max-width: 540px; margin: 0 auto;
}

/* ===== BACK LINK ===== */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted); font-size: 0.9rem;
  margin-bottom: 24px; padding-top: calc(var(--header-height) + 24px);
}
.back-link:hover { color: var(--accent-light); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .ranking-item { grid-template-columns: 40px 48px 1fr auto; gap: 12px; }
  .ranking-stats { gap: 14px; }
}

@media (max-width: 768px) {
  .nav { display: none; }
  .mobile-toggle { display: block; }

  .hero { padding: 120px 0 60px; }
  .hero h1 { font-size: 1.75rem; }

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

  .ranking-item {
    grid-template-columns: 36px 1fr;
    gap: 10px;
  }
  .ranking-thumb { display: none; }
  .ranking-stats { grid-column: 1 / -1; justify-content: flex-start; }

  .detail-header { flex-direction: column; }
  .detail-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-charts-row { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .top-categories { grid-template-columns: 1fr; }

  .search-box .search-btn { padding: 10px 16px; font-size: 0.8rem; }

  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .hero h1 { font-size: 1.5rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .detail-stats-grid { grid-template-columns: 1fr 1fr; }
  .ranking-stats { flex-wrap: wrap; gap: 10px; }
}
