:root {
  --primary: #0284c7;       /* Bleu athlétique */
  --primary-hover: #0369a1;
  --accent: #f97316;        /* Orange roller hockey */
  --accent-hover: #ea580c;
  --bg-color: #f1f5f9;      /* Fond ardoise clair */
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  padding: 16px;
}

.app-wrapper {
  max-width: 1200px;
  margin: 0 auto;
}

/* ==========================================================================
   EN-TÊTE ET NAVIGATION
   ========================================================================== */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0f172a;
  color: #ffffff;
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

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

.hockey-puck {
  font-size: 2rem;
}

.top-nav h1 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tagline {
  font-size: 0.8rem;
  color: #94a3b8;
}

.api-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #cbd5e1;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #94a3b8;
}

.status-dot.online {
  background-color: var(--success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
}

.status-dot.offline {
  background-color: var(--danger);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}

/* Onglets */
.tabs-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-main);
  border-color: #cbd5e1;
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.3);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ==========================================================================
   CARTES ET LAYOUTS
   ========================================================================== */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

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

.section-header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Grille du Dashboard Évaluations */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 320px 1fr;
  }
}

.panel-header {
  margin-bottom: 16px;
}

.panel-header h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.filter-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #f8fafc;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 500;
}

/* Liste des joueurs dans la sidebar */
.player-select-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px;
}

.player-item-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: all 0.15s;
}

.player-item-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.player-item-btn.selected {
  background: #e0f2fe;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.player-avatar-mini {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #334155;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.player-item-info {
  flex: 1;
  min-width: 0;
}

.player-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-item-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.filter-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Badges */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.skater-badge {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.goalie-badge {
  background: #ede9fe;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.all-roles-badge {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.role-filter-indicator {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.category-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
}

.surclasse-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Fiche Joueur Hero */
.player-hero-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.player-hero-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.player-avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #0284c7;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  background-size: cover;
  background-position: center;
  border: 3px solid #ffffff;
  box-shadow: var(--shadow);
}

.hero-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

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

/* Graphique d'évolution */
.chart-card {
  padding-bottom: 24px;
}

.chart-wrapper {
  width: 100%;
  position: relative;
  overflow-x: auto;
}

canvas#evolutionCanvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8rem;
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

.notes-color {
  background-color: #0284c7;
}

.target-color {
  background-color: #f97316;
}

/* Grille de synthèse des skills */
.skills-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.skill-summary-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 14px;
  background: #f8fafc;
}

.skill-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.skill-summary-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}

.progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-fill.success {
  background: var(--success);
}

.progress-fill.warning {
  background: var(--warning);
}

.progress-fill.danger {
  background: var(--danger);
}

.target-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #f97316;
  z-index: 2;
}

.skill-scores-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Historique */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.history-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: #ffffff;
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 8px;
}

.history-date {
  font-weight: 700;
  font-size: 0.95rem;
}

.history-average {
  font-size: 0.85rem;
  font-weight: 700;
  background: #e0f2fe;
  color: #0369a1;
  padding: 4px 10px;
  border-radius: 999px;
}

.history-ratings {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.rating-chip {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.history-coach-note {
  font-size: 0.85rem;
  color: #475569;
  font-style: italic;
  background: #f8fafc;
  padding: 8px 12px;
  border-left: 3px solid var(--primary);
  border-radius: 0 4px 4px 0;
}

/* ==========================================================================
   GESTION DES JOUEURS & SKILLS (GRILLES)
   ========================================================================== */
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.player-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}

.player-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.player-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.player-card-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.player-card-details {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex: 1;
}

.player-card-actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}

/* Grille des Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.skill-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.skill-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 8px;
}

.skill-scale-badge {
  background: #f1f5f9;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.skill-card-desc {
  font-size: 0.875rem;
  color: #475569;
  margin-bottom: 14px;
  flex: 1;
}

.skill-targets-block {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.8rem;
  margin-bottom: 14px;
}

.skill-targets-title {
  font-weight: 700;
  margin-bottom: 6px;
  color: #334155;
}

.target-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.target-pill {
  background: #ffffff;
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.skill-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}

/* ==========================================================================
   FORMULAIRES ET MODALS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

.modal-large {
  max-width: 720px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.flex-1 {
  flex: 1;
  min-width: 180px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: #334155;
}

input[type="text"],
input[type="url"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  background: #f8fafc;
  transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: #ffffff;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Photo Picker */
.photo-picker {
  display: flex;
  align-items: center;
  gap: 16px;
}

.photo-preview {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border: 2px dashed #94a3b8;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.photo-inputs {
  flex: 1;
}

.file-input {
  font-size: 0.85rem;
}

/* Table d'objectifs par catégorie pour les skills */
.categories-goals-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  background: #f8fafc;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.category-goal-item {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.category-goal-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.category-goal-input {
  width: 100% !important;
  padding: 6px !important;
  font-size: 0.85rem !important;
  text-align: center;
}

/* Saisie de notation d'évaluation */
.eval-skills-inputs {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 6px;
}

.eval-skill-row {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: #f8fafc;
}

.eval-skill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.eval-skill-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.eval-target-badge {
  font-size: 0.75rem;
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.eval-slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.eval-slider-group input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
  cursor: pointer;
}

.eval-score-display {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--primary);
  width: 48px;
  text-align: right;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

/* ==========================================================================
   BOUTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #e2e8f0;
  color: #334155;
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: #334155;
}

.btn-outline:hover {
  background: #f1f5f9;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.8rem;
}

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

.btn-danger-outline:hover {
  background: var(--danger);
  color: white;
}

/* ==========================================================================
   ALERTES ET ÉTATS VIDES
   ========================================================================== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 16px;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-info {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.15rem;
  color: #0f172a;
  margin-bottom: 6px;
}

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

.text-muted {
  color: var(--text-muted);
}

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

.hidden {
  display: none !important;
}

.app-footer {
  text-align: center;
  margin-top: 40px;
  padding: 20px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}
