/* ══════════════════════════════════════════════════════════════════
   CSS ADDITIONNEL POUR DATASETS V4
   À ajouter à la fin de style.css
   ══════════════════════════════════════════════════════════════════ */

/* ── Boutons de vue statistiques (Synthèse / Tableau récap) ─────── */
.stat-view-toggle {
  display: flex;
  gap: .25rem;
  margin-bottom: .75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
}

.stat-view-btn {
  flex: 1;
  padding: .4rem .6rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: .8rem;
  cursor: pointer;
  transition: all .2s;
  color: var(--text);
}

.stat-view-btn:hover {
  background: var(--bg-body);
}

.stat-view-btn.active {
  background: var(--c-primary);
  color: white;
}

.stat-view-btn i {
  font-size: .75rem;
  margin-right: .25rem;
}

/* ── Contenus des vues ────────────────────────────────────────────── */
.stat-view-content {
  display: none;
}

.stat-view-content.active {
  display: block;
}

/* ── Améliorations pour les % dans synthèse catégorielle ──────────── */
.top-val-count small {
  font-size: .75rem;
  font-weight: normal;
  opacity: .85;
}

/* ── Bouton download PNG sur graphiques ──────────────────────────── */
.graph-var-header .btn-outline-secondary {
  padding: .25rem .5rem;
  font-size: .8rem;
  border-color: #dee2e6;
}

.graph-var-header .btn-outline-secondary:hover {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: white;
}

.graph-var-header .d-flex {
  flex-shrink: 0;
}

/* ── Sélecteur de type de graphique amélioré ────────────────────── */
.graph-type-select {
  font-size: .8rem;
  padding: .25rem .5rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  min-width: 110px;
}

.graph-type-select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 2px rgba(61, 90, 241, .1);
}

/* ── Tableaux récap avec scroll ───────────────────────────────────── */
.stat-view-content table {
  margin-bottom: 0;
}

.stat-view-content table thead.sticky-top {
  position: sticky;
  top: 0;
  background: var(--bg-body);
  z-index: 2;
}

.stat-view-content table tfoot {
  position: sticky;
  bottom: 0;
  background: var(--bg-body);
}

/* ── Amélioration du footer des tableaux de stats ──────────────────── */
.stat-view-content table tfoot td {
  border-top: 2px solid var(--border);
  padding-top: .5rem;
  padding-bottom: .5rem;
}

/* ── Responsive pour boutons d'export ──────────────────────────────── */
@media (max-width: 768px) {
  .btn-group-sm {
    display: flex;
    flex-direction: column;
    gap: .25rem;
  }
  
  .btn-group-sm .btn {
    border-radius: 6px !important;
  }
}

/* ── Animation pour les cards de stats ──────────────────────────────── */
.stat-var-card {
  transition: transform .2s, box-shadow .2s;
}

.stat-var-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

/* ── Amélioration pour les graphiques ──────────────────────────────── */
.graph-var-card {
  transition: transform .2s, box-shadow .2s;
}

.graph-var-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}

/* ── Style pour les tooltips des graphiques ────────────────────────── */
.chartjs-tooltip {
  opacity: 1;
  position: absolute;
  background: rgba(0, 0, 0, .8);
  color: white;
  border-radius: 6px;
  padding: .5rem;
  font-size: .8rem;
  pointer-events: none;
  transform: translate(-50%, -100%);
  transition: all .2s ease;
}

/* ── Scroll custom pour tableaux de stats ──────────────────────────── */
.stat-view-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.stat-view-content::-webkit-scrollbar-track {
  background: var(--bg-body);
  border-radius: 4px;
}

.stat-view-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.stat-view-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Amélioration du badge de type ──────────────────────────────────── */
.stat-var-header .badge {
  font-weight: 600;
  letter-spacing: .02em;
  padding: .3rem .6rem;
}

/* ── Style pour les pourcentages dans les tableaux ──────────────────── */
.stat-view-content table td strong {
  font-weight: 600;
}

.stat-view-content table .text-end strong {
  color: var(--c-primary);
}

/* ── Animation fade-in améliorée ────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeInUp .3s ease-out;
}

/* ── Style pour les annotations des graphiques ──────────────────────── */
.datalabels-plugin {
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .1);
}

/* ── Amélioration de la lisibilité des graphiques ───────────────────── */
.graph-var-body canvas {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* ── Style pour les alertes de succès ───────────────────────────────── */
.toast.toast-success {
  background: linear-gradient(135deg, #2e7d32 0%, #4caf50 100%);
}

.toast.toast-error {
  background: linear-gradient(135deg, #c62828 0%, #ef5350 100%);
}

.toast.toast-warning {
  background: linear-gradient(135deg, #f57c00 0%, #ff9800 100%);
}

.toast.toast-info {
  background: linear-gradient(135deg, #1976d2 0%, #2196f3 100%);
}