/* ========================================
   STATISTICS PAGE - MODERN DESIGN
======================================== */

#statistics {
  font-family: var(--main-font);
  background: transparent;
  min-height: 100vh;
  /* padding supprimé - géré par .statistics-main-container */
  color: var(--primary-color);
  margin-left: 0;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

/* Header sobre */
.statistics-header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px 0;
}

.statistics-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-color);
  font-family: var(--main-font);
}

/* Conteneur principal avec flexbox (comme apprentissage) */
.statistics-main-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  padding: 1rem;
  flex: 1;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Section grid 2x2 pour les 4 périodes */
.statistics-grid-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}

/* Section bottom pour le bouton delete */
.statistics-bottom-section {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: 1rem;
}

/* DEPRECATED: Ancien container (gardé pour compatibilité) */
.statistics-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* Chart sections - Design moderne sobre */
.chart-section {
  background: white;
  border-radius: 16px;
  padding: 0;
  border: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.chart-section:hover {
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

/* Chart dans la section grid - Harmonisation complète */
.statistics-grid-section .chart-section {
  width: 100%;
  min-width: 0; /* Évite les débordements */
  max-width: 100%;
  position: relative;
  flex: none; /* Retire le flexbox pour utiliser grid */
}

/* Stats Header dans chaque chart */
.stats-header {
  background: var(--gradient-primary);
  color: white;
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  border-radius: 16px 16px 0 0;
}

.stats-header h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  font-family: var(--main-font);
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}

/* Period Navigation */
.period-navigation {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.period-display {
  color: white;
  font-size: 14px;
  font-weight: 500;
  min-width: 120px;
  text-align: center;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.nav-btn svg {
  stroke: currentColor;
}

/* ========================================
   STATS BOXES (Work Time + Count)
======================================== */

.stats-boxes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 0 1rem;
  width: 100%;
  box-sizing: border-box;
}

.stat-box {
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
  max-width: 100%;
}

.stat-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.stat-box-time {
  /* Synchronized with chartConfig.colors.time --primary-color #274C77 */
  background: linear-gradient(135deg, rgba(39, 76, 119, 1) 0%, rgba(39, 76, 119, 0.85) 100%);
}

.stat-box-count {
  /* Synchronized with chartConfig.colors.count --secondary-color #6096BA */
  background: linear-gradient(135deg, rgba(96, 150, 186, 1) 0%, rgba(96, 150, 186, 0.85) 100%);
}

.stat-box .stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1;
  color: white;
}

.stat-box .stat-label {
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.95;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
}

/* ========================================
   STATISTICS RESPONSIVE DESIGN MODERNE
======================================== */

/* Desktop avec sidebar (≥1245px) */
@media (min-width: 1245px) {
  .statistics-header h1 {
    font-size: 28px;
  }

  .statistics-main-container {
    padding: 30px;
    gap: 24px;
  }

  .statistics-grid-section {
    gap: 24px;
  }
}

/* Desktop moyen avec sidebar déployée (1024-1244px) - See consolidated media query above */

/* Tablette et petits écrans (≤1024px) */
@media (max-width: 1024px) {
  .statistics-header h1 {
    font-size: 24px;
  }

  .statistics-main-container {
    padding: 20px;
    gap: 20px;
  }

  .statistics-grid-section {
    gap: 16px;
  }

  .stats-header {
    padding: 0.75rem 1rem;
    min-height: 50px;
  }

  .stats-header h2 {
    font-size: 1.05rem;
  }
}

/* Tablette (≤768px) */
@media (max-width: 768px) {
  /* padding supprimé - géré par .statistics-main-container */

  .statistics-header {
    padding: 1rem;
  }

  .statistics-header h1 {
    font-size: 22px;
  }

  .statistics-main-container {
    padding: 1rem;
    gap: 1rem;
  }

  .statistics-grid-section {
    gap: 0.8rem;
  }

  .stats-header {
    padding: 0.6rem;
  }

  .stats-header h2 {
    font-size: 0.9rem;
  }

  .chart-wrapper {
    height: 250px;
    padding: 0.75rem;
  }

  .period-navigation {
    gap: 0.5rem;
    padding: 0.4rem;
  }

  .period-display {
    min-width: 90px;
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
  }

  .nav-btn {
    width: 28px;
    height: 28px;
  }

  .nav-btn svg {
    width: 14px;
    height: 14px;
  }

  /* Stat boxes responsive */
  .stats-boxes {
    grid-template-columns: 1fr; /* 1 column on tablet */
    gap: 0.5rem;
    margin: 1rem 0;
    padding: 0 0.5rem;
    max-width: 100%;
    box-sizing: border-box;
  }

  .stat-box {
    width: 100%;
    padding: 1rem;
  }

  .stat-value {
    font-size: 1.5rem; /* Smaller on tablet */
  }

  .stat-label {
    font-size: 0.8rem;
  }

  .delete-history-btn {
    width: 50px;
    height: 50px;
  }

  .delete-history-btn svg {
    width: 20px;
    height: 20px;
  }
}

/* Mobile (≤640px) */
@media (max-width: 640px) {
  .statistics-header {
    padding: 0.8rem;
  }

  .statistics-header h1 {
    font-size: 22px;
  }

  .statistics-main-container {
    padding: 0.6rem;
    gap: 0.6rem;
    max-width: 100%;
    box-sizing: border-box;
  }

  .statistics-grid-section {
    grid-template-columns: 1fr; /* 1 colonne sur mobile */
    gap: 0.5rem;
  }

  /* Mobile stat boxes */
  .stats-boxes {
    grid-template-columns: 1fr;
    gap: 0.4rem;
    margin: 0.75rem 0;
    padding: 0 0.4rem;
  }

  .stat-box {
    width: 100%;
    padding: 0.8rem;
  }

  .stat-value {
    font-size: 1.3rem;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .stats-header {
    padding: 0.5rem;
  }

  .stats-header h2 {
    font-size: 0.85rem;
  }

  .chart-wrapper {
    height: 200px;
    padding: 0.5rem;
  }

  .period-navigation {
    gap: 0.4rem;
    padding: 0.3rem;
  }

  .period-display {
    min-width: 80px;
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
  }

  .nav-btn {
    width: 24px;
    height: 24px;
  }

  .nav-btn svg {
    width: 12px;
    height: 12px;
  }

  .delete-history-btn {
    width: 45px;
    height: 45px;
  }

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

/* Mobile XS (≤480px) */
@media (max-width: 480px) {
  /* padding supprimé - géré par .statistics-main-container */

  .statistics-header {
    padding: 0.6rem;
    margin-bottom: 0.2rem;
  }

  .statistics-header h1 {
    font-size: 20px;
  }

  .statistics-main-container {
    padding: 0.4rem;
    gap: 0.4rem;
  }

  .statistics-grid-section {
    gap: 0.4rem;
    grid-template-columns: 1fr; /* Maintient 1 colonne */
  }

  .chart-section {
    margin-bottom: 0;
    min-height: 350px;
  }

  .stats-header {
    padding: 0.4rem 0.6rem;
    min-height: 40px;
  }

  .stats-header h2 {
    font-size: 0.8rem;
  }

  .chart-wrapper {
    height: 180px;
    padding: 0.4rem;
  }

  .period-display {
    min-width: 70px;
    font-size: 0.7rem;
  }

  .nav-btn {
    width: 22px;
    height: 22px;
  }

  .delete-history-btn {
    width: 40px;
    height: 40px;
  }
}



/* Consolidated responsive - Statistics */
@media (min-width: 1024px) and (max-width: 1244px) {
  /* === STATISTICS === */
  .statistics-header h1 {
    font-size: 28px;
  }

  .statistics-main-container {
    padding: 24px;
  }

  .statistics-grid-section {
    gap: 20px;
  }

  /* Fix stat boxes to avoid truncation with sidebar */
  .stats-boxes {
    gap: 0.75rem;
    padding: 0 0.75rem;
    margin: 1.25rem 0;
  }

  .stat-box {
    padding: 1rem;
    min-width: 0; /* Allow compression */
  }

  .stat-value {
    font-size: 1.8rem;
  }

  .stat-label {
    font-size: 0.85rem;
  }
}
