/* ========================================
   CINEMA KPI DASHBOARD - Design System
   ======================================== */

/* === CSS Variables === */
:root {
  /* Colors - Dark Mode */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(25, 25, 35, 0.7);
  --bg-card-hover: rgba(35, 35, 50, 0.8);

  /* Accent Colors - Modern Gradient */
  --accent-primary: #38bdf8;
  --accent-secondary: #f472b6;
  --accent-tertiary: #a78bfa;
  --accent-quaternary: #fb923c;
  --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #a78bfa 35%, #f472b6 65%, #fb923c 100%);
  --accent-glow: rgba(244, 114, 182, 0.4);

  /* Status Colors */
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  --warning: #f59e0b;

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);

  /* Borders */
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(244, 114, 182, 0.3);

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--accent-glow);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

/* Background Effects */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -20%, rgba(56, 189, 248, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 0%, rgba(244, 114, 182, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(251, 146, 60, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* === Typography === */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 1.75rem;
}

h3 {
  font-size: 1.25rem;
}

/* === Layout === */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.dashboard {
  padding: var(--spacing-lg) 0;
}

/* === Header === */
.header {
  padding: var(--spacing-lg) 0;
  margin-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.header__title {
  font-size: 2.5rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 60px var(--accent-glow);
  animation: titleGlow 3s ease-in-out infinite alternate;
}

.header__subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-top: var(--spacing-xs);
}

.header__date {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: var(--spacing-sm);
  backdrop-filter: blur(10px);
}

/* === KPI Cards Grid === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-xl);
}

/* === Glass Card === */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  animation: cardSlideIn 0.6s ease-out backwards;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.card:nth-child(1) {
  animation-delay: 0.1s;
}

.card:nth-child(2) {
  animation-delay: 0.2s;
}

.card:nth-child(3) {
  animation-delay: 0.3s;
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
}

.card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 8px 24px var(--accent-glow);
}

.card__label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card__value {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  margin: var(--spacing-sm) 0;
  font-variant-numeric: tabular-nums;
}

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

/* CA Section in Entries Card */
.ca-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-sm);
  border-top: 1px solid var(--border-color);
}

.ca-display {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ca-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ca-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* === Comparison Badge === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 600;
}

.badge--success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge--danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* === Ranking Card === */
.ranking-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 80px;
  margin: var(--spacing-md) 0;
}

.ranking-bar {
  flex: 1;
  background: rgba(167, 139, 250, 0.2);
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: all var(--transition-normal);
  min-height: 8px;
}

.ranking-bar:hover {
  background: rgba(167, 139, 250, 0.4);
}

.ranking-bar--current {
  background: var(--accent-gradient);
  box-shadow: 0 0 20px var(--accent-glow);
}

.ranking-bar::after {
  content: attr(data-year);
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--text-muted);
}

.ranking-position {
  font-size: 4rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.ranking-suffix {
  font-size: 1.5rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* === Table Section === */
.section {
  margin-top: var(--spacing-xl);
  animation: cardSlideIn 0.8s ease-out backwards;
  animation-delay: 0.4s;
}

.section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
}

.section__title {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.section__title::before {
  content: '🏆';
  font-size: 1.75rem;
}

/* === Data Table === */
.table-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
}

.data-table thead {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: rgba(244, 114, 182, 0.05);
}

/* Table Cell Styles */
.film-cell {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.film-rank {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.film-rank--gold {
  background: linear-gradient(135deg, #ffd700, #ffb700);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.film-rank--silver {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
}

.film-rank--bronze {
  background: linear-gradient(135deg, #cd7f32, #b87333);
}

.film-poster {
  width: 48px;
  height: 68px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-secondary);
}

.film-info {
  display: flex;
  flex-direction: column;
}

.film-title {
  font-weight: 600;
  color: var(--text-primary);
}

.film-genre {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.entries-cell {
  font-weight: 700;
  font-size: 1.125rem;
  font-variant-numeric: tabular-nums;
}

.tarif-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tarif-main {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tarif-vad {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 2px 8px;
  background: rgba(56, 189, 248, 0.1);
  border-radius: 50px;
}

.tarif-vad svg {
  width: 12px;
  height: 12px;
}

/* === Secondary KPI Grid === */
.kpi-grid--three {
  grid-template-columns: repeat(3, 1fr);
  margin-top: var(--spacing-md);
}

@media (max-width: 1024px) {
  .kpi-grid--three {
    grid-template-columns: 1fr;
  }
}

.card--secondary {
  animation-delay: 0.4s;
}

.card--secondary:nth-child(2) {
  animation-delay: 0.5s;
}

.card--secondary:nth-child(3) {
  animation-delay: 0.6s;
}

/* Stat Row (Vente Cartes) */
.stat-row {
  display: flex;
  gap: var(--spacing-lg);
  margin-top: var(--spacing-sm);
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Conversion Display */
.conversion-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: var(--spacing-sm) 0;
}

.conversion-value {
  font-size: 3rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.conversion-percent {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.stat-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
}

.stat-evolution {
  margin-top: var(--spacing-xs);
}

/* Confiserie List */
.confiserie-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: var(--spacing-sm);
}

.confiserie-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.confiserie-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.confiserie-item__left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.confiserie-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

.confiserie-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.confiserie-percent {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-secondary);
}

.confiserie-bar-container {
  flex: 1;
  max-width: 80px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  margin-left: var(--spacing-sm);
  overflow: hidden;
}

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

/* === Animations === */
@keyframes titleGlow {
  from {
    filter: drop-shadow(0 0 20px var(--accent-glow));
  }

  to {
    filter: drop-shadow(0 0 40px var(--accent-glow));
  }
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes countUp {
  from {
    opacity: 0;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

@keyframes barGrow {
  from {
    height: 0;
  }
}

/* === Responsive === */
@media (max-width: 768px) {
  .header__title {
    font-size: 1.75rem;
  }

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

  .card__value {
    font-size: 2.25rem;
  }

  .data-table th,
  .data-table td {
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  .film-poster {
    display: none;
  }
}

/* === Chart Container === */
.chart-container {
  position: relative;
  height: 100px;
  margin-top: var(--spacing-sm);
}

/* === Sparkline === */
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 40px;
}

.sparkline__bar {
  flex: 1;
  background: rgba(56, 189, 248, 0.3);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

.sparkline__bar:hover {
  background: var(--accent-primary);
}