/**
 * Styles: 99 Noms d'Allah (Asma ul-Husna)
 *
 * Feuille de styles pour le module de mémorisation des 99 Noms d'Allah
 *
 * Sections:
 * - CSS Variables (Blue Theme)
 * - Container principal
 * - Sélecteur de langue (drapeaux top-right)
 * - Tabs navigation
 * - Grid de sélection
 * - Flashcards (flip animation)
 * - Boutons de rating
 * - Statistiques
 * - Responsive design
 *
 * Last updated: 2025-11-03
 * Design: Modern blue gradient aesthetic with glassmorphism
 */

/* =============================================================================
 * CSS Variables - Blue Theme
 * ============================================================================= */

:root {
  /* Blue Gradients */
  --allah-blue-gradient: linear-gradient(135deg, #274c77 0%, #6096ba 100%);
  --allah-blue-light: linear-gradient(135deg, #6096ba 0%, #a3cef1 100%);
  --allah-blue-dark: linear-gradient(135deg, #274c77 0%, #22405c 100%);
  --allah-blue-bg: linear-gradient(135deg, rgba(39, 76, 119, 0.1), rgba(96, 150, 186, 0.1));
  --allah-blue-radial: radial-gradient(circle at 50% 50%, rgba(39, 76, 119, 0.15), rgba(96, 150, 186, 0.05));

  /* Glassmorphism */
  --glass-white: rgba(255, 255, 255, 0.25);
  --glass-white-hover: rgba(255, 255, 255, 0.35);
  --glass-blue: rgba(39, 76, 119, 0.15);
  --glass-blue-hover: rgba(39, 76, 119, 0.25);

  /* Shadows */
  --shadow-blue: 0 8px 20px rgba(39, 76, 119, 0.4);
  --shadow-blue-lg: 0 12px 40px rgba(39, 76, 119, 0.5);
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.1);

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 50px;
}

/* =============================================================================
 * Container Principal
 * ============================================================================= */

.allah-names-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.5rem;
  position: relative;
  min-height: calc(100vh - 100px);
}

/* =============================================================================
 * Sélecteur de Langue (drapeaux top-right)
 * ============================================================================= */

.flashcard-lang-btn {
  font-size: 1.5rem;
  padding: 0.35rem 0.6rem;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: relative;
}

.flashcard-lang-btn:hover {
  transform: scale(1.15) rotate(5deg);
}

.flashcard-lang-btn.active {
  border-color: transparent;
  background: linear-gradient(135deg, rgba(39, 76, 119, 0.25), rgba(39, 76, 119, 0.25));
  box-shadow: 0 0 0 2px rgba(39, 76, 119, 0.4);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(39, 76, 119, 0.4);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(39, 76, 119, 0.5);
  }
}

/* =============================================================================
 * Tabs Navigation
 * ============================================================================= */

.tabs-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 0.75rem;
  background: var(--allah-blue-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(39, 76, 119, 0.1);
  position: relative;
  z-index: 10; /* Below sidebar (z-index: 98) to prevent overlap */
}

.allah-names-tab-btn {
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: #666;
  border-radius: var(--radius-md);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.allah-names-tab-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--allah-blue-gradient);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.allah-names-tab-btn:hover {
  color: #274c77;
  transform: translateY(-3px);
}

.allah-names-tab-btn:hover::before {
  opacity: 0.1;
}

.allah-names-tab-btn.active {
  color: white;
  background: var(--allah-blue-gradient);
  box-shadow: var(--shadow-blue);
  transform: translateY(-2px);
}

.allah-names-tab-btn.active::before {
  opacity: 1;
}

/* Tab Content */
.allah-names-tab-content {
  display: none;
}

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

/* =============================================================================
 * Grid de Sélection - DEPRECATED v2.0 (onglet Sélection supprimé)
 * ============================================================================= */

/* Styles supprimés car l'onglet Sélection n'existe plus */

/* Container Dropdown Configuration */
.config-dropdown-container {
  position: relative;
  margin-left: auto;
  z-index: 100001; /* Au-dessus du dropdown menu pour maintenir le stacking context */
}

/* Bouton Icône Paramètres (PLUS VISIBLE) */
.config-icon-toggle {
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, #274c77 0%, #6096ba 100%);
  border: none;
  border-radius: 50%;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(39, 76, 119, 0.4);
}

.config-icon-toggle svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

.config-icon-toggle:hover {
  background: linear-gradient(135deg, #6096ba 0%, #274c77 100%);
  box-shadow: 0 4px 12px rgba(39, 76, 119, 0.5);
  transform: scale(1.1);
}

.config-icon-toggle:hover svg {
  animation: rotate-settings 0.5s ease;
}

@keyframes rotate-settings {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(90deg); }
}

.config-icon-toggle.active {
  background: linear-gradient(135deg, #274c77 0%, #22405c 100%);
}

.config-icon-toggle.active svg {
  transform: rotate(90deg);
}

/* Dropdown Menu */
.config-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  min-width: 250px;
  padding: 0.5rem 0;
  z-index: 100000; /* Above all elements including tooltips (99999) and hovered cards (10001) */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.config-dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  color: #333;
  transition: all 0.2s ease;
}

.dropdown-item:hover {
  background: rgba(39, 76, 119, 0.1);
  color: #274c77;
}

.dropdown-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.dropdown-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 0.5rem 0;
}

/* Dropdown Section */
.dropdown-section {
  padding: 0.75rem 1.25rem;
}

.dropdown-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #666;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Langue Selector dans Dropdown */
.dropdown-language-selector {
  display: flex;
  gap: 0.5rem;
}

.flashcard-lang-btn-dropdown {
  flex: 1;
  padding: 0.5rem 1rem;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  color: #666;
}

.flashcard-lang-btn-dropdown:hover {
  border-color: #274c77;
  background: rgba(39, 76, 119, 0.05);
  color: #274c77;
}

.flashcard-lang-btn-dropdown.active {
  border-color: #274c77;
  background: #274c77;
  color: white;
  font-weight: 600;
}

/* Direction Selector dans Dropdown */
.dropdown-direction-selector {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dropdown-radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s ease;
}

.dropdown-radio-label:hover {
  background: rgba(39, 76, 119, 0.05);
}

.dropdown-radio-label input[type="radio"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.dropdown-radio-label span {
  font-size: 0.9rem;
  color: #333;
}

/* Configuration card wrapper - Compact & Collapsible */
.review-config-card {
  max-width: 100%;
  margin: 0;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  overflow: hidden;
  max-height: 500px;
}

/* Animation uniquement quand la config est dépliée (pas au chargement) */
.review-config-card:not(.collapsed) {
  animation: slideDown 0.3s ease;
}

.review-config-card.collapsed {
  max-height: 0;
  padding: 0;
  margin: 0;
  opacity: 0;
  box-shadow: none;
}

@keyframes slideDown {
  from {
    max-height: 0;
    opacity: 0;
    padding: 0;
  }
  to {
    max-height: 500px;
    opacity: 1;
    padding: 1.5rem;
  }
}

/* Language selector inline layout - Modern design */
.flashcard-lang-selector-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0;
  border-bottom: none;
}

.flashcard-lang-selector-wrapper label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #64748b;
  margin: 0;
}

.flashcard-lang-selector {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0.25rem 0.5rem;
  background: rgba(39, 76, 119, 0.08);
  border-radius: 50px;
  border: 1px solid rgba(39, 76, 119, 0.15);
  box-shadow: none;
  backdrop-filter: none;
}

.flashcard-lang-selector:hover {
  transform: none;
  box-shadow: none;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* =============================================================================
 * Flashcards
 * ============================================================================= */

#flashcard-container {
  perspective: 1500px;
  min-height: 400px;
  margin: 2rem auto;
  max-width: 600px;
  position: relative;
}

/* Border removed per user request - cleaner look */

.flashcard-text {
  background: white;
  position: relative;
  padding: 3rem 2rem;
  border-radius: 20px;
  box-shadow: var(--shadow-blue-lg),
              0 0 60px rgba(39, 76, 119, 0.2),
              inset 0 1px 0 rgba(255, 255, 255, 0.8);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  animation: flipIn3D 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  margin-bottom: 1rem;
  overflow: hidden;
}

/* Static subtle background (animation removed for performance) */
.flashcard-text::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(39, 76, 119, 0.08) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  z-index: 0;
  /* Pulse animation removed for performance */
}

.flashcard-text * {
  position: relative;
  z-index: 1;
}

/* Texte arabe (RTL) */
.flashcard-text.arabic {
  font-family: 'Amiri', 'Noto Sans Arabic', 'Traditional Arabic', serif;
  font-size: 2.8rem;
  direction: rtl;
  line-height: 1.8;
  font-weight: 700;
  background: var(--allah-blue-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 4px 8px rgba(39, 76, 119, 0.3);
}

/* Texte traduction */
.flashcard-text.translation {
  font-size: 2rem;
  font-weight: 600;
  color: #333;
  line-height: 1.5;
}

/* Enhanced Flip Animation */
@keyframes flipIn3D {
  0% {
    opacity: 0;
    transform: rotateY(-180deg) scale(0.8);
    box-shadow: 0 0 0 rgba(39, 76, 119, 0);
  }
  50% {
    transform: rotateY(-90deg) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: rotateY(0deg) scale(1);
    box-shadow: var(--shadow-blue-lg), 0 0 60px rgba(39, 76, 119, 0.2);
  }
}

/* Review Progress */
#review-progress {
  text-align: center;
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
}

/* =============================================================================
 * Direction Selector
 * ============================================================================= */

.direction-selector {
  margin: 0;
  padding: 0;
  background: none;
  border-radius: 0;
  box-shadow: none;
}

.direction-selector > label:first-child {
  font-size: 0.95rem;
  font-weight: 600;
  color: #666;
  margin-bottom: 1rem;
  display: block;
}

.direction-selector > div {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.direction-selector label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(39, 76, 119, 0.05);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.direction-selector label:hover {
  background: rgba(39, 76, 119, 0.12);
  transform: none;
}

.direction-selector input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border: 2px solid #ccc;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.direction-selector input[type="radio"]:hover {
  border-color: #274c77;
}

.direction-selector input[type="radio"]:checked {
  background: var(--allah-blue-gradient);
  border-color: #274c77;
  box-shadow: var(--shadow-blue);
}

.direction-selector input[type="radio"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.direction-selector input[type="radio"]:checked ~ span {
  font-weight: 600;
  color: #274c77;
}

.direction-selector label:has(input[type="radio"]:checked) {
  background: rgba(39, 76, 119, 0.15);
  border-color: rgba(39, 76, 119, 0.3);
}

/* =============================================================================
 * Boutons
 * ============================================================================= */

/* Primary Button (Flip, Start Review) */
.btn-primary,
#flip-card-btn,
#activate-selected-btn {
  display: block;
  margin: 1.5rem auto;
  padding: 1rem 2.5rem;
  background: var(--allah-blue-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-blue);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Start Review Button - Enhanced Style with defensive CSS */
#start-review-btn {
  display: block !important;
  visibility: visible !important;
  margin: 2rem auto 0;
  padding: 1.25rem 3.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--allah-blue-gradient);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(39, 76, 119, 0.35);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

#start-review-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 32px rgba(39, 76, 119, 0.45);
}

#start-review-btn:active {
  transform: translateY(-2px) scale(1.02);
}

/* Glossy overlay effect */
.btn-primary::after,
#flip-card-btn::after,
#activate-selected-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: left 0.5s ease;
}

.btn-primary:hover,
#flip-card-btn:hover,
#activate-selected-btn:hover {
  background: var(--allah-blue-dark);
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--shadow-blue-lg), 0 0 40px rgba(39, 76, 119, 0.6);
}

.btn-primary:hover::after,
#flip-card-btn:hover::after,
#activate-selected-btn:hover::after {
  left: 100%;
}

.btn-primary:active,
#flip-card-btn:active,
#activate-selected-btn:active {
  transform: translateY(-2px) scale(1.02);
}

/* Rating Buttons */
#rating-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.rating-btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
  color: white;
  transition: all 0.2s ease;
  min-width: 120px;
}

.rating-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.rating-btn.strong {
  background: #4caf50;
}

.rating-btn.strong:hover {
  background: #45a049;
}

.rating-btn.good {
  background: #8bc34a;
}

.rating-btn.good:hover {
  background: #7cb342;
}

.rating-btn.moderate {
  background: #ffc107;
  color: #333;
}

.rating-btn.moderate:hover {
  background: #ffb300;
}

.rating-btn.weak {
  background: #f44336;
}

.rating-btn.weak:hover {
  background: #e53935;
}

/* =============================================================================
 * Statistiques (Chart.js)
 * ============================================================================= */

.allah-names-tab-content h3,
.statistics-heading {
  font-size: 2rem;
  font-weight: 700;
  background: var(--allah-blue-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 2rem;
  text-align: center;
  text-shadow: 0 4px 8px rgba(39, 76, 119, 0.3);
}

#stats-chart,
#review-stats-chart-container {
  max-width: 700px;
  max-height: 700px;
  margin: 2rem auto;
  padding: 3rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 249, 255, 0.95));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 40px rgba(39, 76, 119, 0.2);
  border: 2px solid rgba(39, 76, 119, 0.2);
}

/* Layout moderne data-oriented */
#start-review-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

#start-review-section > h2 {
  text-align: center;
  margin: 0 0 0.75rem 0;
  font-size: 1.75rem;
  color: #274c77;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Statistiques en bas après config */
#review-statistics-section {
  width: 100%;
  margin: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  padding: 1.5rem;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  order: 2;
}

#review-statistics-section h2 {
  font-size: 1.6rem;
  margin: 0 0 1.5rem 0;
  font-weight: 700;
  color: #274c77;
  text-align: center;
}

/* =============================================================================
 * Dashboard Grid Layout - Statistics Tab
 * ============================================================================= */

.allah-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.5rem;
  animation: slideUp 0.6s ease-out;
}

/* =============================================================================
 * KPI Cards Section
 * ============================================================================= */

.kpi-cards-section {
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(39, 76, 119, 0.1);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.kpi-cards-section h2,
.kpi-cards-section h3 {
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--allah-blue-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  flex-grow: 1;
}

.kpi-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(39, 76, 119, 0.1);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
  position: relative;
  overflow: visible; /* Changed from hidden to allow tooltips to display */
  cursor: pointer;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 1; /* Base z-index for cards */
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--allah-blue-radial);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.kpi-card:hover {
  /* Hover effects disabled for stability */
  border-color: rgba(39, 76, 119, 0.2);
  z-index: 10; /* Bring hovered card above siblings but below tooltip */
}

.kpi-card > * {
  position: relative;
  z-index: 2; /* Above card background but below tooltip */
}

.kpi-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  display: inline-block;
  color: #274c77;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--allah-blue-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

/* Skeleton loader for KPI cards */
.kpi-card.skeleton-loader {
  animation: pulse 1.5s ease-in-out infinite;
}

.kpi-card.skeleton-loader .kpi-value,
.kpi-card.skeleton-loader .kpi-label {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

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

/* =============================================================================
 * Dernière Révision Section
 * ============================================================================= */

.last-review-info {
  text-align: center;
  padding: 1rem 1.5rem;
  background: rgba(39, 76, 119, 0.08);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-size: 1rem;
  color: #666;
  border: 1px solid rgba(39, 76, 119, 0.15);
}

.last-review-info strong {
  color: #274c77;
  font-weight: 700;
  font-size: 1.05rem;
}

/* =============================================================================
 * Objectifs Section
 * ============================================================================= */

.objectives-section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(39, 76, 119, 0.1);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.objectives-section h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 1.25rem;
  text-align: center;
  background: var(--allah-blue-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}

.objectives-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex-grow: 1;
  justify-content: center;
}

.objective-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.objective-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.objective-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #555;
}

.objective-header strong {
  font-size: 1rem;
  font-weight: 700;
  color: #274c77;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: #e8e8e8;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #66bb6a);
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 5px;
}

/* Toujours vert, peu importe le pourcentage */
.progress-fill[data-percent="low"],
.progress-fill[data-percent="medium"],
.progress-fill[data-percent="high"] {
  background: linear-gradient(90deg, #4caf50, #66bb6a);
}

/* =============================================================================
 * Tooltips
 * ============================================================================= */

.tooltip-trigger {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 18px;
  height: 18px;
  background: #274c77;
  color: white;
  border-radius: 50%;
  cursor: help;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.tooltip-trigger:hover {
  background: #6096ba;
  transform: scale(1.1);
  z-index: 10001; /* Above everything including sibling cards */
}

.tooltip-content {
  position: absolute;
  top: 2.5rem;
  right: -50px; /* Shift left to prevent right edge cutoff */
  background: linear-gradient(135deg, #274c77 0%, #6096ba 100%);
  color: white;
  padding: 14px 18px; /* Slightly larger padding for better readability */
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.6; /* Increased line height for better readability */
  white-space: normal;
  max-width: 450px; /* Increased from 320px to accommodate long French text */
  min-width: 280px; /* Increased from 220px */
  z-index: 99999; /* Very high to appear above all cards and other elements */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  box-shadow: 0 6px 20px rgba(39, 76, 119, 0.4); /* Stronger shadow for better visibility */
  text-align: left;
}

.tooltip-content::after {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 50px; /* Adjusted to align with new tooltip position */
  border: 7px solid transparent; /* Slightly larger arrow */
  border-bottom-color: #274c77;
}

/* =============================================================================
 * Visual Grids Container (Heatmap + 99 Names Grid)
 * ============================================================================= */

.visual-grids-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  width: 100%;
}

/* =============================================================================
 * Heatmap Section
 * ============================================================================= */

.heatmap-section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(39, 76, 119, 0.1);
}

.heatmap-section h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 1.5rem;
  text-align: center;
}

.heatmap-container {
  display: flex;
  flex-direction: column;
  align-items: center; /* Center heatmap horizontally */
  gap: 1rem;
  overflow-x: auto; /* Enable horizontal scroll for large heatmaps */
  overflow-y: visible;
  padding: 10px;
  width: 100%;
  max-width: 100%;
  /* Firefox scrollbar styling (CSS standard) */
  scrollbar-width: thin;
  scrollbar-color: rgba(39, 76, 119, 0.3) rgba(39, 76, 119, 0.05);
}

/* WebKit/Blink browsers (Chrome, Safari, Edge) - wrapped in @supports to avoid Firefox warnings */
@supports selector(::-webkit-scrollbar) {
  .heatmap-container::-webkit-scrollbar {
    height: 8px;
  }

  .heatmap-container::-webkit-scrollbar-track {
    background: rgba(39, 76, 119, 0.05);
    border-radius: 4px;
  }

  .heatmap-container::-webkit-scrollbar-thumb {
    background: rgba(39, 76, 119, 0.3);
    border-radius: 4px;
  }

  .heatmap-container::-webkit-scrollbar-thumb:hover {
    background: rgba(39, 76, 119, 0.5);
  }
}

#heatmap-canvas {
  display: block;
  /* Width and height set dynamically via JavaScript to match canvas drawing dimensions */
  border-radius: var(--radius-md);
  border: 1px solid rgba(39, 76, 119, 0.2);
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  /* NO padding - canvas content drawn from (0,0) to (width,height) */
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #666;
  font-weight: 500;
  align-self: center; /* Center legend horizontally even though parent is flex-start */
  margin-top: 0.5rem;
}

.heatmap-legend-colors {
  display: flex;
  gap: 0.25rem;
}

.legend-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.legend-cell[data-level="0"] {
  background-color: #ebedf0;
}

.legend-cell[data-level="1"] {
  background-color: #c6e48b;
}

.legend-cell[data-level="2"] {
  background-color: #7bc96f;
}

.legend-cell[data-level="3"] {
  background-color: #239a3b;
}

.legend-cell[data-level="4"] {
  background-color: #196127;
}

/* Heatmap empty state */
.heatmap-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  gap: 1rem;
  min-height: 180px;
}

.empty-state-icon {
  color: #274c77;
  opacity: 0.5;
}

.empty-state-icon svg {
  width: 64px;
  height: 64px;
  stroke-width: 1.5;
}

.empty-state-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #666;
  margin: 0;
}

.empty-state-subtext {
  font-size: 0.95rem;
  color: #999;
  margin: 0;
}

/* =============================================================================
 * 99 Names Grid Section
 * ============================================================================= */

.names-grid-section {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(39, 76, 119, 0.1);
}

.names-grid-section h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 1.5rem;
  text-align: center;
}

.names-grid-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.names-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.65rem;
  padding: 1rem;
  background: rgba(39, 76, 119, 0.05);
  border-radius: var(--radius-md);
}

.name-grid-cell {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.55rem 0.6rem;
  overflow: hidden;
}

.name-grid-cell:hover {
  transform: scale(1.15);
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Cell content: number and arabic name */
.cell-number {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.5);
  margin-bottom: 0.05rem;
}

.cell-arabic {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a1a1a;
  text-align: center;
  line-height: 1.65;
  text-shadow: none;
  word-break: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  padding: 0.25rem 0 0.3rem;
}

/* Status colors for name grid cells - lighter backgrounds for better text readability */
.name-grid-cell.new {
  background-color: #e8e8e8;
}

.name-grid-cell.weak {
  background-color: #ffb3b3;
}

.name-grid-cell.moderate {
  background-color: #fff176;
}

.name-grid-cell.good {
  background-color: #a5d6a7;
}

.name-grid-cell.strong {
  background-color: #81c784;
}

/* Names grid legend */
.names-grid-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem;
  background: rgba(39, 76, 119, 0.05);
  border-radius: var(--radius-md);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #666;
}

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.color-dot.new {
  background-color: #e8e8e8;
}

.color-dot.weak {
  background-color: #ffb3b3;
}

.color-dot.moderate {
  background-color: #fff176;
}

.color-dot.good {
  background-color: #a5d6a7;
}

.color-dot.strong {
  background-color: #81c784;
}

/* =============================================================================
 * Timeline Chart Section
 * ============================================================================= */

.timeline-chart-section {
  display: none; /* Hidden until chart implementation */
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(39, 76, 119, 0.1);
  width: 100%;
}

.timeline-chart-section h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 1.5rem;
  text-align: center;
}

.chart-container {
  position: relative;
  width: 100%;
  min-height: 300px;
  padding: 1rem;
}

#timeline-chart {
  display: block;
  width: 100% !important;
  max-height: 400px;
}

/* =============================================================================
 * Animations
 * ============================================================================= */

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

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* =============================================================================
 * Responsive Design - Dashboard
 * ============================================================================= */

/* Large tablets and small desktops (1024px) */
@media (max-width: 1024px) {
  .kpi-cards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  .kpi-card {
    padding: 1.25rem;
  }

  .kpi-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
  }

  .kpi-value {
    font-size: 1.75rem;
  }

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

  .visual-grids-container {
    grid-template-columns: 1fr;
  }

  .names-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
  }
}

/* Tablets (768px) */
@media (max-width: 768px) {
  .allah-dashboard-grid {
    padding: 1rem;
    gap: 1.5rem;
  }

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

  .kpi-card {
    padding: 1.5rem 1rem;
  }

  .kpi-icon {
    font-size: 2rem;
  }

  .kpi-value {
    font-size: 2rem;
  }

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

  .heatmap-section,
  .names-grid-section,
  .timeline-chart-section {
    padding: 1.5rem;
  }

  .heatmap-section h3,
  .names-grid-section h3,
  .timeline-chart-section h3 {
    font-size: 1.2rem;
  }

  .names-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem;
    padding: 0.75rem;
  }

  .names-grid-legend {
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .legend-item {
    font-size: 0.75rem;
  }

  .chart-container {
    padding: 0.5rem;
  }
}

/* Mobile devices (480px) */
@media (max-width: 480px) {
  .allah-dashboard-grid {
    padding: 0.75rem;
    gap: 1rem;
  }

  .kpi-cards-section h2,
  .heatmap-section h3,
  .names-grid-section h3,
  .timeline-chart-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
  }

  .kpi-card {
    padding: 1.25rem 0.75rem;
  }

  .kpi-icon {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
  }

  .kpi-value {
    font-size: 1.75rem;
  }

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

  .heatmap-section,
  .names-grid-section,
  .timeline-chart-section {
    padding: 1rem;
  }

  .names-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.35rem;
    padding: 0.5rem;
  }

  .name-grid-cell:hover {
    transform: scale(1.1);
  }

  .heatmap-legend {
    font-size: 0.75rem;
    gap: 0.35rem;
  }

  .legend-cell {
    width: 12px;
    height: 12px;
  }

  .names-grid-legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.5rem;
  }

  .color-dot {
    width: 14px;
    height: 14px;
  }

  .chart-container {
    min-height: 250px;
    padding: 0.25rem;
  }

  #timeline-chart {
    max-height: 300px;
  }
}

/* Review Left Column - Configuration and Button */
.review-left-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  order: 1;
  overflow: visible;
}

.review-left-column .btn-primary {
  /* margin retiré - utilise la marge de #start-review-btn */
  padding: 1rem 3rem;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 16px;
  background: linear-gradient(135deg, #274c77 0%, #6096ba 100%);
  border: none;
  color: white;
  box-shadow: 0 8px 24px rgba(39, 76, 119, 0.4);
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.review-left-column .btn-primary:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(39, 76, 119, 0.5);
}

#review-stats-chart-container {
  padding: 0.75rem;
  max-width: 650px;
  height: 350px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

#review-stats-chart {
  max-height: 100%;
  max-width: 100%;
  width: 100% !important;
  height: 100% !important;
}

/* Responsive : 1 colonne sur petits écrans */
@media (max-width: 1024px) {
  #start-review-section {
    grid-template-columns: 1fr;
  }

  #review-statistics-section {
    margin-top: 2rem;
  }
}

/* =============================================================================
 * Session Limit Configuration Section
 * ============================================================================= */

.config-section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(39, 76, 119, 0.1);
}

.config-title {
  font-size: 1.2rem;
  font-weight: 600;
  background: linear-gradient(135deg, #274c77 0%, #6096ba 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.config-description {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.session-limit-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.session-limit-radio-option {
  flex: 1;
  min-width: 150px;
  padding: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.session-limit-radio-option:hover {
  border-color: #6096ba;
  box-shadow: 0 4px 12px rgba(96, 150, 186, 0.2);
}

.session-limit-radio-option.active {
  border-color: #274c77;
  background: linear-gradient(135deg, rgba(39, 76, 119, 0.1), rgba(96, 150, 186, 0.05));
  box-shadow: 0 4px 12px rgba(39, 76, 119, 0.3);
}

.session-limit-radio-option input[type="radio"] {
  display: none;
}

.radio-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: #274c77;
}

.radio-hint {
  font-size: 0.85rem;
  color: #666;
}

/* Custom session input wrapper (input + save button) */
.custom-input-wrapper {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}

/* Custom session input (for personalized card limit) */
.custom-session-input {
  width: 80px;
  padding: 0.5rem;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 1rem;
  text-align: center;
  transition: all 0.3s ease;
  font-family: inherit;
  background: transparent; /* Allow parent gradient to show through */
}

.custom-session-input:focus {
  border-color: #274c77;
  outline: none;
  box-shadow: 0 0 0 3px rgba(39, 76, 119, 0.1);
}

.custom-session-input.invalid {
  border-color: #e63946;
  background: #fee;
}

.custom-session-input::-webkit-inner-spin-button,
.custom-session-input::-webkit-outer-spin-button {
  opacity: 1;
}

/* Save custom limit button */
.save-custom-btn {
  padding: 0.5rem 1rem;
  background: #274c77;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.save-custom-btn:hover:not(:disabled) {
  background: #1a3a5c;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(39, 76, 119, 0.3);
}

.save-custom-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.5;
}

.save-custom-btn:active:not(:disabled) {
  transform: translateY(0);
}

/* =============================================================================
 * Responsive Design
 * ============================================================================= */

/* Tablet */
@media (max-width: 768px) {
  .flashcard-lang-selector {
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
  }

  .flashcard-text.arabic {
    font-size: 2rem;
    padding: 2rem;
  }

  .flashcard-text.translation {
    font-size: 1.5rem;
    padding: 2rem;
  }

  #rating-buttons {
    flex-direction: column;
  }

  .rating-btn {
    width: 100%;
  }
}

/* Mobile */
@media (max-width: 480px) {
  .allah-names-container {
    padding: 1rem;
  }

  .tabs-nav {
    flex-direction: column;
    gap: 0.5rem;
  }

  .allah-names-tab-btn {
    width: 100%;
    text-align: left;
  }

  .flashcard-text {
    padding: 1.5rem 1rem;
  }

  .flashcard-text.arabic {
    font-size: 1.5rem;
  }

  .flashcard-text.translation {
    font-size: 1.2rem;
  }

  .direction-selector {
    padding: 0.75rem;
  }

  .rating-btn {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }
}

/* =============================================================================
 * Success Modal (Festive Celebration)
 * ============================================================================= */

/* Overlay */
.success-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100003; /* Au-dessus de tabs-nav (100002) et dropdown (100000) */
  opacity: 0;
  animation: fadeIn 0.3s ease-out forwards;
}

/* Modal container */
.success-modal {
  background: var(--allah-blue-gradient);
  padding: 3rem 2.5rem;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
              var(--shadow-blue-lg);
  max-width: 500px;
  width: 90%;
  text-align: center;
  color: white;
  position: relative;
  z-index: 100004; /* Au-dessus de overlay (100003) */
  transform: rotateY(180deg) scale(0.8);
  opacity: 0;
  animation: flip3D 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.1s forwards; /* Réduit: 0.8s→0.6s, delay 0.2s→0.1s */
}

/* Modal header */
.success-modal h2 {
  font-size: 2.5rem;
  margin: 0 0 0.5rem 0;
  font-weight: 700;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  animation: bounceIn 0.6s ease-out 0.8s backwards;
}

.success-modal .celebration-emoji {
  font-size: 3.5rem;
  display: inline-block;
  margin-bottom: 1rem;
  animation: rotate-scale 1.2s ease-in-out 0.5s backwards; /* Réduit delay: 1s→0.5s */
}

.success-modal p {
  font-size: 1.1rem;
  margin: 0 0 2rem 0;
  opacity: 0.95;
  font-weight: 500;
}

/* Stats grid */
.success-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 2rem 0;
  animation: slideUp 0.5s ease-out 0.6s backwards; /* Réduit delay: 1.2s→0.6s */
}

.stat-badge {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  padding: 1rem;
  border-radius: 12px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-badge:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.stat-badge .stat-label {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: #ffffff !important;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.stat-badge .stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0;
  color: #ffffff !important;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Color-coded badges with enhanced visibility */
.stat-badge.strong {
  border-color: #66bb6a;
  background: rgba(76, 175, 80, 0.35);
  box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3);
}

.stat-badge.strong:hover {
  background: rgba(76, 175, 80, 0.45);
}

.stat-badge.good {
  border-color: #9ccc65;
  background: rgba(139, 195, 74, 0.35);
  box-shadow: 0 4px 16px rgba(139, 195, 74, 0.3);
}

.stat-badge.good:hover {
  background: rgba(139, 195, 74, 0.45);
}

.stat-badge.moderate {
  border-color: #ffca28;
  background: rgba(255, 193, 7, 0.35);
  box-shadow: 0 4px 16px rgba(255, 193, 7, 0.3);
}

.stat-badge.moderate:hover {
  background: rgba(255, 193, 7, 0.45);
}

.stat-badge.weak {
  border-color: #ef5350;
  background: rgba(244, 67, 54, 0.35);
  box-shadow: 0 4px 16px rgba(244, 67, 54, 0.3);
}

.stat-badge.weak:hover {
  background: rgba(244, 67, 54, 0.45);
}

/* =============================================================================
 * Remaining Cards Info Section (Success Modal)
 * ============================================================================= */

.remaining-cards-info {
  margin: 1.5rem 0 0 0;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: slideUp 0.5s ease-out 1.2s backwards;
}

.remaining-cards-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  margin-bottom: 0.5rem;
}

.remaining-icon {
  font-size: 1.3rem;
}

.remaining-text strong {
  font-weight: 700;
  color: #ffd54f; /* Gold highlight */
}

.remaining-cards-breakdown {
  font-size: 0.95rem; /* Improved from 0.9rem */
  color: rgba(255, 255, 255, 0.9); /* Improved contrast from 0.85 */
  font-weight: 600; /* More bold from 500 */
  margin-top: 0.5rem; /* Better spacing from 0.25rem */
  padding-left: 2.5rem; /* Better alignment from 2rem */
}

.remaining-cards-breakdown::before {
  content: '↳ ';
  opacity: 0.7; /* More visible from 0.6 */
  font-weight: bold;
}

/* Variant "Toutes à jour" (vert) */
.remaining-cards-info.all-up-to-date {
  background: rgba(76, 175, 80, 0.25);
  border-color: rgba(76, 175, 80, 0.4);
}

.remaining-cards-info.all-up-to-date .remaining-icon {
  animation: pulse 1s ease-in-out infinite;
}

/* Variant "Révisions à venir" (blue theme matching) */
.remaining-cards-info.upcoming-reviews {
  background: linear-gradient(135deg, rgba(39, 76, 119, 0.25), rgba(96, 150, 186, 0.15));
  border: 2px solid rgba(39, 76, 119, 0.4);
  box-shadow: 0 4px 12px rgba(39, 76, 119, 0.3);
}

.remaining-cards-info.upcoming-reviews .remaining-text strong {
  color: #ffd54f; /* Gold highlight matching */
  text-shadow: 0 2px 4px rgba(255, 213, 79, 0.4);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Action buttons */
.success-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 2rem;
  animation: slideUp 0.5s ease-out 0.7s backwards; /* Réduit delay: 1.4s→0.7s */
}

.success-modal-btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.success-modal-btn.primary {
  background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
  color: white;
}

.success-modal-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(76, 175, 80, 0.4);
}

.success-modal-btn.secondary {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.4);
}

.success-modal-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

/* Close button */
.success-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.success-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes flip3D {
  from {
    transform: rotateY(180deg) scale(0.8);
    opacity: 0;
  }
  to {
    transform: rotateY(0deg) scale(1);
    opacity: 1;
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

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

@keyframes rotate-scale {
  0% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(-10deg) scale(1.1);
  }
  50% {
    transform: rotate(10deg) scale(1.2);
  }
  75% {
    transform: rotate(-5deg) scale(1.1);
  }
  100% {
    transform: rotate(0deg) scale(1);
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .success-modal {
    padding: 2rem 1.5rem;
    width: 95%;
  }

  .success-modal h2 {
    font-size: 2rem;
  }

  .success-modal .celebration-emoji {
    font-size: 2.5rem;
  }

  .success-stats {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .stat-badge {
    padding: 0.75rem;
  }

  .stat-badge .stat-value {
    font-size: 1.5rem;
  }

  .success-modal-btn {
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
  }
}

/* =============================================================================
 * Système Accordéons - Dashboard Fusionné
 * ============================================================================= */

/* Accordéon Item */
.accordion-item {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(39, 76, 119, 0.1);
  overflow: hidden;
}

/* Accordéon Header (bouton) */
.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: rgba(39, 76, 119, 0.05);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.2rem;
  font-weight: 700;
  color: #333;
  text-align: left;
}

.accordion-header:hover {
  background: rgba(39, 76, 119, 0.1);
}

.accordion-icon {
  font-size: 1.5rem;
}

.accordion-title {
  flex: 1;
}

.accordion-chevron {
  font-size: 1.2rem;
  color: #274c77;
  display: flex;
  align-items: center;
}

/* Accordéon Body */
.accordion-body {
  padding: 2rem 1.5rem;
  transition: all 0.3s ease;
}

.accordion-item[data-state="closed"] .accordion-body {
  display: none;
}

.accordion-item[data-state="open"] .accordion-body {
  display: block;
}

/* Layout Métriques Grid (2 colonnes) - Toujours visible */
.metrics-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 2rem;
  align-items: stretch;
}

.metrics-col-left,
.metrics-col-right {
  display: flex;
  flex-direction: column;
}

/* Layout Charts (2 colonnes) */
.charts-two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.chart-col {
  min-width: 0;
}

/* Last Review Display (Premier élément en haut) */
.last-review-display {
  font-size: 1.1rem;
  color: #666;
  text-align: center;
  margin-bottom: 2rem;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(39, 76, 119, 0.1);
  border: 1px solid rgba(39, 76, 119, 0.1);
  transition: all 0.3s ease;
}

.last-review-display:hover {
  box-shadow: 0 6px 16px rgba(39, 76, 119, 0.15);
  transform: translateY(-2px);
}

.last-review-display strong {
  color: #274c77;
  font-weight: 700;
  font-size: 1.25rem;
  background: linear-gradient(135deg, #274c77 0%, #6096ba 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.names-to-review-separator {
  color: rgba(39, 76, 119, 0.3);
  font-weight: 300;
  font-size: 1.5rem;
  margin: 0 0.5rem;
}

#names-to-review-count {
  color: #274c77;
  font-weight: 700;
  font-size: 1.4rem;
  background: linear-gradient(135deg, #274c77 0%, #6096ba 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Start Review Button (Deuxième élément) */
.btn-start-review {
  display: block;
  margin: 0 auto 2rem auto;
  min-width: 300px;
  padding: 1.25rem 3rem;
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(39, 76, 119, 0.3);
  transition: all 0.3s ease;
}

.btn-start-review:hover {
  box-shadow: 0 6px 16px rgba(39, 76, 119, 0.4);
  transform: translateY(-2px);
}

/* Section Fixe Grille 99 Noms */
.names-grid-fixed-section {
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(39, 76, 119, 0.1);
}

.names-grid-fixed-section h3 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 1.5rem;
  text-align: center;
  background: var(--allah-blue-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========================================================================
   Search/Filter Container
   ======================================================================== */

.names-search-container {
  margin-bottom: 1.5rem;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 2px solid rgba(39, 76, 119, 0.2);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-input-wrapper:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(39, 76, 119, 0.1);
}

.search-input-wrapper i[data-feather="search"] {
  color: rgba(39, 76, 119, 0.5);
  width: 24px;
  height: 24px;
  margin-right: 0.75rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-input-wrapper i[data-feather="search"] svg {
  width: 100%;
  height: 100%;
  display: block;
}

.names-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text-color);
  background: transparent;
  line-height: 1.5;
  padding: 0.25rem 0;
}

.names-search-input::placeholder {
  color: rgba(39, 76, 119, 0.4);
}

.clear-search-btn {
  background: rgba(39, 76, 119, 0.1);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
  padding: 0;
  flex-shrink: 0;
}

.clear-search-btn:hover {
  background: rgba(39, 76, 119, 0.2);
}

.clear-search-btn i {
  width: 16px;
  height: 16px;
  color: rgba(39, 76, 119, 0.7);
}

.search-results-count {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: rgba(39, 76, 119, 0.7);
  text-align: center;
}

/* Filtered cells - dim non-matching */
.names-grid .name-grid-cell.filtered-out {
  opacity: 0.2;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.names-grid .name-grid-cell.filtered-match {
  opacity: 1;
  animation: pulse-match 0.5s ease;
}

@keyframes pulse-match {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Responsive Accordéons */
@media (max-width: 900px) {
  .metrics-grid,
  .charts-two-columns {
    grid-template-columns: 1fr;
  }

  .accordion-header {
    font-size: 1.1rem;
    padding: 1rem 1.25rem;
  }

  .accordion-icon {
    font-size: 1.3rem;
  }
}

@media (max-width: 768px) {
  .accordion-toggle-global {
    justify-content: center;
  }

  .accordion-header {
    font-size: 1rem;
    padding: 0.85rem 1rem;
  }

  .accordion-body {
    padding: 1.5rem 1rem;
  }
}

/* ============================================
   NAME STATISTICS MODAL
   ============================================ */

.name-stats-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.name-stats-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.name-stats-modal-content {
  position: relative;
  background: #e7ecef;
  border-radius: 16px;
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 10001;
  animation: modal-fade-in 0.3s ease;
}

@keyframes modal-fade-in {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.name-stats-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  color: var(--text-color);
}

.name-stats-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.name-stats-close-btn svg {
  width: 24px;
  height: 24px;
}

/* Header */
.name-stats-header {
  padding: 2rem 2rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.name-stats-header h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.5rem;
  color: var(--text-color);
}

.name-stats-subtitle {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.name-stats-subtitle span:first-child {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--accent-color);
}

.name-stats-subtitle span:last-child {
  font-size: 1rem;
  color: var(--text-color-muted);
  font-style: italic;
}

/* Body */
.name-stats-body {
  padding: 2rem;
}

/* Key Metrics Cards */
.name-stats-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.name-stat-card {
  background: var(--bg-color);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.name-stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--text-color-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.name-stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: bold;
  color: var(--text-color);
}

/* Sections */
.name-stats-section {
  margin-bottom: 2rem;
}

.name-stats-section h4 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  color: var(--text-color);
}

/* Rating Bars */
.rating-bars {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rating-bar-item {
  display: grid;
  grid-template-columns: 80px 1fr 50px;
  align-items: center;
  gap: 1rem;
}

.rating-bar-label {
  font-size: 0.9rem;
  color: var(--text-color);
  font-weight: 500;
}

.rating-bar-track {
  height: 28px;
  background: var(--bg-color);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.rating-bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.rating-bar-fill.strong {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.rating-bar-fill.good {
  background: linear-gradient(90deg, #84cc16, #65a30d);
}

.rating-bar-fill.moderate {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.rating-bar-fill.weak {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.rating-bar-count {
  text-align: right;
  font-size: 0.9rem;
  color: var(--text-color-muted);
  font-weight: 500;
}

/* Review History List */
.review-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.review-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: 10px;
  border-left: 4px solid;
  transition: transform 0.2s;
}

.review-history-item:hover {
  transform: translateX(4px);
}

.review-history-item.strong {
  border-color: #22c55e;
}

.review-history-item.good {
  border-color: #84cc16;
}

.review-history-item.moderate {
  border-color: #f59e0b;
}

.review-history-item.weak {
  border-color: #ef4444;
}

.review-item-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.review-item-date {
  font-size: 0.85rem;
  color: var(--text-color-muted);
}

.review-item-rating {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-color);
}

.review-item-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.review-item-duration {
  font-size: 0.85rem;
  color: var(--text-color-muted);
}

.review-item-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.review-item-badge.strong {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.review-item-badge.good {
  background: rgba(132, 204, 22, 0.2);
  color: #84cc16;
}

.review-item-badge.moderate {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.review-item-badge.weak {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.review-history-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-color-muted);
  font-style: italic;
}

/* Scrollbar styling for review history */
.review-history-list::-webkit-scrollbar {
  width: 6px;
}

.review-history-list::-webkit-scrollbar-track {
  background: var(--bg-color);
  border-radius: 3px;
}

.review-history-list::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 3px;
}

/* Modal Content Scrollbar */
.name-stats-modal-content::-webkit-scrollbar {
  width: 8px;
}

.name-stats-modal-content::-webkit-scrollbar-track {
  background: var(--bg-color);
}

.name-stats-modal-content::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .name-stats-modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .name-stats-header {
    padding: 1.5rem 1.5rem 0.75rem;
  }

  .name-stats-body {
    padding: 1.5rem;
  }

  .name-stats-metrics {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .rating-bar-item {
    grid-template-columns: 70px 1fr 40px;
    gap: 0.5rem;
  }

  .rating-bar-label {
    font-size: 0.8rem;
  }

  .rating-bar-track {
    height: 24px;
  }

  .review-history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .review-item-right {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .name-stats-subtitle span:first-child {
    font-size: 1.5rem;
  }

  .name-stat-card .stat-value {
    font-size: 1.5rem;
  }

  .rating-bar-item {
    grid-template-columns: 60px 1fr 35px;
  }
}
