/* ========================================
   COMPOSANTS SPÉCIFIQUES - GAMEATON
   ======================================== */

/* ========================================
   NAVIGATION PAR ONGLETS
   ======================================== */

.tab-link {
  color: #AFA8C9;
  text-decoration: none;
  position: relative;
  font-weight: 500;
  font-size: 0.875rem;
}

.tab-link:hover {
  color: #F0EDFA;
  background-color: rgba(119, 81, 255, 0.1);
}

.tab-link.active {
  color: #F0EDFA;
  background-color: #7751FF;
  box-shadow: 0 2px 4px rgba(119, 81, 255, 0.3);
}

.tab-link.active svg {
  color: #FFFFFF;
}

.tab-link:focus {
  outline: 2px solid #7751FF;
  outline-offset: 2px;
}

/* Animation pour les transitions d'onglets */
.tab-link {
  transition: all 0.2s ease-in-out;
}

/* Responsive pour les onglets */
@media (max-width: 640px) {
  .tab-link span {
    display: none;
  }
  
  .tab-link {
    padding: 0.5rem;
  }
  
  .tab-link svg {
    width: 1.25rem;
    height: 1.25rem;
  }
}

/* ========================================
   LIENS DE NAVIGATION RAPIDE
   ======================================== */

.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--color-primary);
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: var(--radius-md);
  z-index: var(--z-fixed);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 6px;
}

/* ========================================
   NOTIFICATIONS ET ALERTES
   ======================================== */

.notification {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-bg-elevated);
  color: var(--color-text-primary);
}

.notification-success {
  background: var(--color-success);
  border-color: var(--color-success);
}

.notification-error {
  background: var(--color-error);
  border-color: var(--color-error);
}

.notification-warning {
  background: var(--color-warning);
  border-color: var(--color-warning);
}

.notification-info {
  background: var(--color-info);
  border-color: var(--color-info);
}

.error-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--color-error);
  color: white;
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-tooltip);
  max-width: 300px;
}

/* ========================================
   AMÉLIORATIONS DES SLIDERS
   ======================================== */

/* Style des sliders noUiSlider */
.noUi-target {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-bg-elevated);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.noUi-connects {
  background: var(--color-bg-tertiary);
}

.noUi-connect {
  background: var(--color-primary);
}

.noUi-handle {
  background: var(--color-primary);
  border: 2px solid var(--color-text-primary);
  border-radius: 50%;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.noUi-handle:hover {
  background: var(--color-primary-hover);
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

.noUi-handle:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.noUi-tooltip {
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-bg-elevated);
  border-radius: var(--radius-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.75rem;
  box-shadow: var(--shadow-md);
}

/* ========================================
   AMÉLIORATIONS DES TOOLTIPS
   ======================================== */

.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 200px;
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  text-align: center;
  border-radius: var(--radius-md);
  padding: var(--spacing-sm);
  border: 1px solid var(--color-bg-elevated);
  box-shadow: var(--shadow-lg);
  
  /* Positionnement */
  position: absolute;
  z-index: var(--z-tooltip);
  bottom: 125%;
  left: 50%;
  margin-left: -100px;
  
  /* Animation */
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.tooltip .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--color-bg-primary) transparent transparent transparent;
}

/* ========================================
   AMÉLIORATIONS DES MODALES
   ======================================== */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal.show {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal.show .modal-content {
  transform: scale(1);
}

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

.modal-title {
  margin: 0;
  color: var(--color-text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-tertiary);
}

/* ========================================
   AMÉLIORATIONS DES FORMULAIRES
   ======================================== */

.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-xs);
  color: var(--color-text-primary);
  font-weight: 500;
}

.form-help {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-top: var(--spacing-xs);
}

.form-error {
  color: var(--color-error);
  font-size: 0.875rem;
  margin-top: var(--spacing-xs);
}

.input.error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input.success {
  border-color: var(--color-success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* ========================================
   AMÉLIORATIONS DES TABLEAUX
   ======================================== */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-bg-elevated);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg-secondary);
}

.table th,
.table td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--color-bg-elevated);
}

.table th {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table tbody tr:hover {
  background: var(--color-bg-tertiary);
}

.table tbody tr:focus-within {
  background: var(--color-primary);
  color: white;
}

/* ========================================
   AMÉLIORATIONS DES PAGINATIONS
   ======================================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  margin: var(--spacing-lg) 0;
}

.pagination-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: var(--spacing-sm);
  border: 1px solid var(--color-bg-elevated);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.pagination-item:hover {
  background: var(--color-bg-tertiary);
  border-color: var(--color-primary);
}

.pagination-item.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.pagination-item:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================
   AMÉLIORATIONS DES LOADING STATES
   ======================================== */

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--color-bg-elevated);
  border-radius: 50%;
  border-top-color: var(--color-primary);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, 
    var(--color-bg-tertiary) 25%, 
    var(--color-bg-elevated) 50%, 
    var(--color-bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--spacing-xs);
  border-radius: var(--radius-sm);
}

.skeleton-text:last-child {
  width: 60%;
}

/* ========================================
   AMÉLIORATIONS DES SCROLLBARS
   ======================================== */

.scrollable {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) var(--color-bg-secondary);
}

.scrollable::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.scrollable::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
}

.scrollable::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-bg-secondary);
}

.scrollable::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-hover);
}

/* ========================================
   AMÉLIORATIONS DES FOCUS INDICATORS
   ======================================== */

.focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.focus-ring {
  position: relative;
}

.focus-ring::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border: 2px solid transparent;
  border-radius: inherit;
  pointer-events: none;
  transition: border-color var(--transition-fast);
}

.focus-ring:focus-visible::after {
  border-color: var(--color-primary);
}

/* ========================================
   AMÉLIORATIONS DES TRANSITIONS
   ======================================== */

.fade-enter {
  opacity: 0;
  transform: translateY(10px);
}

.fade-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: all var(--transition-normal);
}

.fade-exit {
  opacity: 1;
  transform: translateY(0);
}

.fade-exit-active {
  opacity: 0;
  transform: translateY(-10px);
  transition: all var(--transition-normal);
}

/* ========================================
   AMÉLIORATIONS DES BREAKPOINTS
   ======================================== */

@media (max-width: 640px) {
  .modal-content {
    width: 95%;
    padding: var(--spacing-lg);
  }
  
  .table-container {
    font-size: 0.875rem;
  }
  
  .pagination {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .notification {
    max-width: calc(100vw - 40px);
  }
  
  .tooltip .tooltip-text {
    width: calc(100vw - 40px);
    left: 0;
    margin-left: 0;
  }
}

/* ========================================
   AMÉLIORATIONS DES PREFÉRENCES UTILISATEUR
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-contrast: high) {
  :root {
    --color-bg-elevated: #4a4783;
    --color-text-secondary: #ffffff;
  }
}

@media (prefers-color-scheme: light) {
  :root {
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f8fafc;
    --color-bg-tertiary: #e2e8f0;
    --color-bg-elevated: #cbd5e1;
    --color-text-primary: #1e293b;
    --color-text-secondary: #475569;
    --color-text-muted: #64748b;
  }
}

/* ========================================
   STYLES POUR LES FAVORIS
   ======================================== */

/* Bouton favoris dans game_detail */
.favorite-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.favorite-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(119, 81, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.favorite-btn:hover::before {
  width: 100%;
  height: 100%;
}

.favorite-btn:active {
  transform: scale(0.95);
}

.favorite-btn.favorite-active {
  animation: heartBeat 0.6s ease-in-out;
}

@keyframes heartBeat {
  0% { transform: scale(1); }
  14% { transform: scale(1.1); }
  28% { transform: scale(1); }
  42% { transform: scale(1.1); }
  70% { transform: scale(1); }
}

/* Cartes de jeux dans favorites - style preset */
.preset-card {
  transition: none;
  position: relative;
  overflow: hidden;
}

.preset-card img[data-action="select"] {
  transition: none;
}

.preset-card img[data-action="select"]:hover {
  transform: scale(1.02);
  filter: brightness(1.1);
}

.preset-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(119, 81, 255, 0.1), transparent);
  transition: none;
  z-index: 1;
}

.preset-card:hover::before {
  left: 100%;
}

.preset-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Ancien style pour compatibilité */
.game-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.game-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(119, 81, 255, 0.1), transparent);
  transition: left 0.5s;
}

.game-card:hover::before {
  left: 100%;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Checkbox de sélection */
.game-checkbox {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #6b7280;
  border-radius: 4px;
  background-color: #1f2937;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease-in-out;
}

.game-checkbox:checked {
  background-color: #7751FF;
  border-color: #7751FF;
}

.game-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.game-checkbox:hover {
  border-color: #7751FF;
  box-shadow: 0 0 0 3px rgba(119, 81, 255, 0.1);
}

/* Bouton de suppression */
.remove-favorite {
  opacity: 0;
  transition: all 0.2s ease-in-out;
  z-index: 10;
}

.preset-card:hover .remove-favorite,
.game-card:hover .remove-favorite {
  opacity: 1;
}

.remove-favorite:hover {
  transform: scale(1.1);
}

/* Radar chart container */
#radar-chart-container {
  position: relative;
  min-height: 400px;
}

#radar-chart {
  max-height: 600px;
  width: 100% !important;
  height: auto !important;
}

/* Légende du chart */
#chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

#chart-legend > div {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: rgba(119, 81, 255, 0.1);
  border-radius: 6px;
  border: 1px solid rgba(119, 81, 255, 0.2);
}

/* État vide */
#empty-state {
  animation: fadeInUp 0.6s ease-out;
}

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

/* Animations pour les notifications */
.notification-enter {
  transform: translateX(100%);
  opacity: 0;
}

.notification-enter-active {
  transform: translateX(0);
  opacity: 1;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-exit {
  transform: translateX(0);
  opacity: 1;
}

.notification-exit-active {
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Amélioration de la lisibilité du radar chart */
#radar-chart-container {
  background: rgba(30, 25, 78, 0.3);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(119, 81, 255, 0.2);
}

#radar-chart {
  filter: contrast(1.1) brightness(1.05);
}

/* Styles pour la comparaison des critères - tableau */
#criteria-comparison-container {
  background: rgba(30, 25, 78, 0.3);
  border-radius: 12px;
  border: 1px solid rgba(119, 81, 255, 0.2);
}

#criteria-comparison-table {
  scrollbar-width: thin;
  scrollbar-color: rgba(119, 81, 255, 0.5) transparent;
}

#criteria-comparison-table::-webkit-scrollbar {
  height: 8px;
}

#criteria-comparison-table::-webkit-scrollbar-track {
  background: rgba(58, 56, 105, 0.3);
  border-radius: 4px;
}

#criteria-comparison-table::-webkit-scrollbar-thumb {
  background: rgba(119, 81, 255, 0.5);
  border-radius: 4px;
}

#criteria-comparison-table::-webkit-scrollbar-thumb:hover {
  background: rgba(119, 81, 255, 0.7);
}

/* Styles pour le tableau de comparaison */
#criteria-comparison-table th {
  position: sticky;
  top: 0;
  z-index: 10;
}

#criteria-comparison-table tr:hover {
  background-color: rgba(42, 31, 92, 0.3);
}

#criteria-comparison-table td {
  vertical-align: top;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

#criteria-comparison-table .game-cell {
  position: sticky;
  left: 0;
  background-color: #1E194E;
  z-index: 5;
  width: 200px;
  max-width: 200px;
  min-width: 200px;
}

/* Responsive pour les favoris */
@media (max-width: 768px) {
  .favorite-btn {
    padding: 8px;
  }
  
  .favorite-btn svg {
    width: 20px;
    height: 20px;
  }
  
  .preset-card {
    margin-bottom: 8px;
  }
  
  .game-card {
    margin-bottom: 16px;
  }
  
  #radar-chart-container {
    min-height: 300px;
    padding: 15px;
  }
  
  #chart-legend {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .favorite-btn {
    padding: 6px;
  }
  
  .favorite-btn svg {
    width: 18px;
    height: 18px;
  }
  
  #radar-chart-container {
    padding: 16px;
  }
  
  #chart-legend > div {
    font-size: 12px;
    padding: 2px 6px;
  }
}

/* Amélioration de l'accessibilité */
.favorite-btn:focus-visible {
  outline: 2px solid #7751FF;
  outline-offset: 2px;
}

.game-checkbox:focus-visible {
  outline: 2px solid #7751FF;
  outline-offset: 2px;
}

.remove-favorite:focus-visible {
  outline: 2px solid #ef4444;
  outline-offset: 2px;
}

/* Animation de chargement pour les favoris */
.favorites-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.favorites-loading .loading {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

/* Styles pour les états de sélection */
.game-card.selected {
  border: 2px solid #7751FF;
  box-shadow: 0 0 0 3px rgba(119, 81, 255, 0.1);
}

.game-card.selected::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: #7751FF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-card.selected::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: bold;
}