:root {
  --bg: #0b0d10;
  --panel: #14181f;
  --muted: #9aa4b2;
  --text: #e8ecf1;
  --accent: #6ae3ff;
  --accent-2: #ffd166;
  --danger: #ff6b6b;
}

/* Fullscreen styles */
#leaflet-heatmap:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0 !important;
}

#leaflet-heatmap:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  border-radius: 0 !important;
}

#leaflet-heatmap:-moz-full-screen {
  width: 100vw;
  height: 100vh;
  border-radius: 0 !important;
}

.btn-fullscreen:hover {
  background: rgba(106, 227, 255, 0.3) !important;
  transform: translateY(-1px);
  transition: all 0.2s ease;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #0b0d10 0%, #0f1220 50%, #1a1d2e 100%);
  background-attachment: fixed;
  background-size: cover;
  overflow-x: hidden;
  min-height: 100vh;
}

.container { max-width: 1200px; margin: 0 auto; padding: 16px; }

.header { position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px); border-bottom: 1px solid rgba(255,255,255,0.08); background: linear-gradient(180deg, rgba(15, 18, 32, 0.9), rgba(15,18,32,0.6)); }
.header h1 { margin: 12px 0 6px; font-size: 24px; }
.header p { margin: 0 0 12px; color: var(--muted); }

.section {
  padding: 40px 0;
  opacity: 0;
  animation: fadeInUp 0.8s ease-out forwards;
}
.section:nth-child(1) { animation-delay: 0.05s; }
.section:nth-child(2) { animation-delay: 0.1s; }
.section:nth-child(3) { animation-delay: 0.15s; }
.section:nth-child(4) { animation-delay: 0.2s; }
.section:nth-child(5) { animation-delay: 0.25s; }
.section:nth-child(6) { animation-delay: 0.3s; }
.section:nth-child(7) { animation-delay: 0.35s; }
.section:nth-child(8) { animation-delay: 0.4s; }
.section:nth-child(9) { animation-delay: 0.45s; }
.section:nth-child(10) { animation-delay: 0.5s; }
.section h2 {
  font-size: 26px;
  margin-bottom: 24px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.hero { padding-top: 36px; }
.hero-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.filters-card {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 24px;
  margin: 16px 0;
}

.filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.filters-header h2 {
  margin: 0;
  font-size: 20px;
}

.btn-reset {
  background: rgba(255, 107, 107, 0.1);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-reset:hover {
  background: rgba(255, 107, 107, 0.2);
  border-color: var(--danger);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-item label {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
}

.chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.chip:hover {
  background: rgba(106, 227, 255, 0.1);
  border-color: rgba(106, 227, 255, 0.3);
}

.chip.active {
  background: var(--accent);
  color: #0b0d10;
  border-color: var(--accent);
  font-weight: 600;
}

.chip.active:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 8px 0 16px; }
.kpi { background: var(--panel); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 14px; }
.kpi-value { font-size: 28px; font-weight: 700; }
.kpi-label { color: var(--muted); font-size: 12px; }

.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.card {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.16);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.card.wide { grid-column: 1 / -1; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.card-header h2 { font-size: 16px; margin: 0; }
.card-header h3 { font-size: 14px; margin: 0; }
.card-actions { display: flex; gap: 8px; align-items: center; }

.stat-badge {
  background: rgba(106, 227, 255, 0.15);
  border: 1px solid rgba(106, 227, 255, 0.3);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 8px;
  vertical-align: middle;
}

.data-source-badge.billetterie {
  background: rgba(106, 227, 255, 0.15);
  border: 1px solid rgba(106, 227, 255, 0.4);
  color: var(--accent);
}

.data-source-badge.formulaire {
  background: rgba(255, 209, 102, 0.15);
  border: 1px solid rgba(255, 209, 102, 0.4);
  color: var(--accent-2);
}

.search-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 8px 16px;
  color: var(--text);
  font-size: 13px;
  min-width: 300px;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(106, 227, 255, 0.1);
}

.search-input::placeholder {
  color: var(--muted);
}
.chart { height: 360px; padding: 8px 12px; }
.chart.small { height: 260px; }
.chart-large { height: 500px; padding: 16px; }
.chart-featured { height: 600px; padding: 20px 24px; }

.featured-card {
  background: linear-gradient(135deg, rgba(106, 227, 255, 0.08) 0%, rgba(255, 209, 102, 0.08) 100%);
  border: 2px solid rgba(106, 227, 255, 0.2);
  box-shadow: 0 4px 20px rgba(106, 227, 255, 0.15);
}
.featured-card:hover {
  border-color: rgba(106, 227, 255, 0.4);
  box-shadow: 0 8px 32px rgba(106, 227, 255, 0.25);
}

.bigrams-layout { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; padding: 16px; }
.bigrams-list { overflow: auto; max-height: 500px; }
.snippets-container h4 { margin: 0 0 12px 0; font-size: 14px; color: var(--muted); }
.list {
  margin: 0;
  padding: 0 0 0 28px;
  list-style: decimal;
}
.list li {
  padding: 8px 0;
  cursor: pointer;
  transition: color 0.2s;
}
.list li:hover { color: var(--accent); }
.snippets { list-style: none; margin: 0; padding: 0; max-height: 450px; overflow: auto; }
.snippets li { padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.08); font-size: 13px; line-height: 1.5; }
.snippets mark { background: rgba(255, 209, 102, 0.25); border: 1px solid rgba(255,209,102,0.5); border-radius: 4px; padding: 0 2px; }

.comments-section {
  background: rgba(0, 0, 0, 0.2);
  border-top: 2px solid rgba(255,255,255,0.05);
  padding: 60px 0 40px;
}

.comments-container-full {
  max-height: 800px;
  overflow-y: auto;
  padding: 20px;
}

.comment-item {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.6;
  transition: all 0.2s ease;
}

.comment-item:hover {
  border-color: rgba(106, 227, 255, 0.3);
  background: rgba(106, 227, 255, 0.05);
  transform: translateX(2px);
}

/* D3 axis/theme */
.axis path, .axis line { stroke: rgba(255,255,255,0.2); }
.axis text { fill: var(--muted); font-size: 11px; }
.bar {
  fill: var(--accent);
  opacity: 0.85;
  transition: opacity 0.2s ease, fill 0.2s ease;
}
.bar:hover {
  opacity: 1;
  fill: var(--accent-2);
}
.dot {
  fill: var(--accent-2);
  opacity: 0.9;
  stroke: rgba(0,0,0,0.2);
  transition: r 0.2s ease, opacity 0.2s ease;
}
.dot:hover {
  opacity: 1;
}
.dot.dim { opacity: 0.18; }

@media (max-width: 960px) {
  .controls { grid-template-columns: repeat(2, 1fr); }
  .charts { grid-template-columns: 1fr; }
  .bigrams-layout { grid-template-columns: 1fr; }
  .hero-inner { flex-direction: column; align-items: flex-start; }

  /* Adjust KPIs for mobile */
  .kpis { grid-template-columns: repeat(2, 1fr); }

  /* Reduce chart heights on mobile */
  .chart { height: 280px; }
  .chart-large { height: 400px; }
  .chart-featured { height: 450px; }

  /* Make filters scrollable on mobile */
  .filters-grid {
    grid-template-columns: 1fr;
    max-height: 400px;
    overflow-y: auto;
  }

  /* Adjust search input width */
  .search-input { min-width: 100%; }

  /* Better spacing for section headers */
  .section h2 { font-size: 20px; }

  /* Data source badges on mobile */
  .data-source-badge {
    font-size: 9px;
    padding: 2px 6px;
    display: inline-block;
    margin-top: 4px;
  }

  /* Adjust card header for mobile */
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .card-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

.footer { border-top: 1px solid rgba(255,255,255,0.08); margin-top: 16px; color: var(--muted); font-size: 12px; }
