/**
 * Exercises System - Styles CSS
 * Version 1.0
 * Pour pages d'exercices de mathématiques
 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&display=swap');

/* Reset et base */
.exercises-page * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.exercises-page {
  font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.8;
  background: linear-gradient(135deg, #ff6b6b 0%, #feca57 50%, #48dbfb 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  min-height: 100vh;
  padding: 20px;
  font-size: 16px;
  direction: rtl;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Container principal */
.exercises-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Navigation principale */
.main-nav {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  margin-bottom: 30px;
}

.nav-tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-tab {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 15px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
  font-family: 'Cairo', sans-serif;
}

.nav-tab:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.nav-tab.active {
  background: linear-gradient(135deg, #ff6b6b, #feca57);
  box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

/* Sections de contenu */
.content-container {
  display: none;
}

.content-container.active {
  display: block;
  animation: fadeInUp 0.5s ease-out;
}

/* En-tête des exercices */
.exercises-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 40px 30px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.exercises-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
  border-radius: 25px 25px 0 0;
}

.exercises-header h1 {
  color: white;
  font-size: 2.5em;
  font-weight: 700;
  margin-bottom: 15px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.exercises-header .subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.2em;
  font-weight: 300;
}

/* Informations de la série */
.series-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.info-card {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(15px);
  padding: 25px;
  border-radius: 20px;
  text-align: center;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.info-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.info-number {
  font-size: 2.5em;
  font-weight: 700;
  margin-bottom: 10px;
  background: linear-gradient(45deg, #ff6b6b, #feca57);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.info-label {
  font-size: 1em;
  opacity: 0.9;
  font-weight: 500;
}

/* Grille des exercices */
.exercises-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(550px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

/* Cartes d'exercices */
.exercise-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(25px);
  border-radius: 25px;
  padding: 30px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  animation: slideInUp 0.8s ease-out;
}

.exercise-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb);
}

.exercise-card:hover {
  transform: translateY(-10px) scale(1.01);
  box-shadow: 0 35px 80px rgba(0, 0, 0, 0.15);
}

/* En-tête de l'exercice */
.exercise-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
}

.exercise-title {
  color: #2c3e50;
  font-size: 1.4em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 15px;
}

.exercise-number {
  background: linear-gradient(135deg, #ff6b6b, #feca57);
  color: white;
  width: 45px;
  height: 45px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1em;
  box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

.exercise-type {
  background: linear-gradient(135deg, #48dbfb, #0abde3);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85em;
  font-weight: 600;
  animation: pulse 2s infinite;
  box-shadow: 0 5px 15px rgba(72, 219, 251, 0.3);
}

/* Contenu de l'exercice */
.exercise-content {
  color: #34495e;
  line-height: 1.8;
  margin-bottom: 25px;
}

.exercise-content p {
  margin-bottom: 15px;
  text-align: justify;
  font-size: 1.05em;
}

.exercise-content ol {
  padding-right: 25px;
  margin-bottom: 20px;
}

.exercise-content li {
  margin-bottom: 12px;
  padding: 12px;
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.05), rgba(254, 202, 87, 0.05));
  border-radius: 10px;
  border-right: 3px solid #ff6b6b;
  transition: all 0.3s ease;
  font-weight: 500;
}

.exercise-content li:hover {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(254, 202, 87, 0.1));
  transform: translateX(-5px);
  box-shadow: 0 5px 20px rgba(255, 107, 107, 0.15);
}

/* Bouton de basculement */
.toggle-button {
  background: linear-gradient(135deg, #ff6b6b, #feca57);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
  position: relative;
  overflow: hidden;
  font-family: 'Cairo', sans-serif;
}

.toggle-button::before {
  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.6s;
}

.toggle-button:hover::before {
  left: 100%;
}

.toggle-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(255, 107, 107, 0.4);
}

.toggle-button:active {
  transform: translateY(-1px);
}

/* Section de correction */
.correction-section {
  max-height: 0;
  overflow: hidden;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.05), rgba(254, 202, 87, 0.05));
  border-radius: 15px;
  margin-top: 20px;
}

.correction-section.show {
  max-height: 2000px;
  padding: 25px;
  border: 1px solid rgba(255, 107, 107, 0.2);
}

.correction-title {
  color: #ff6b6b;
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.correction-title::before {
  content: '✓';
  background: linear-gradient(135deg, #ff6b6b, #feca57);
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1em;
}

.correction-section ul {
  list-style: none;
  padding-right: 20px;
}

.correction-section li {
  background: rgba(255, 255, 255, 0.8);
  margin-bottom: 10px;
  padding: 12px 15px;
  border-radius: 10px;
  border-right: 3px solid #28a745;
  transition: all 0.3s ease;
  font-weight: 500;
}

.correction-section li:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateX(-5px);
  box-shadow: 0 5px 20px rgba(40, 167, 69, 0.15);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

/* Sections futures (placeholder) */
.placeholder-section {
  text-align: center;
  padding: 50px;
  color: white;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.placeholder-section h2 {
  font-size: 2em;
  margin-bottom: 15px;
}

.placeholder-section p {
  font-size: 1.2em;
  opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
  .exercises-page {
    padding: 15px;
  }
  
  .exercises-grid {
    grid-template-columns: 1fr;
  }
  
  .exercises-header h1 {
    font-size: 2em;
  }
  
  .exercise-card {
    padding: 20px;
  }
  
  .exercise-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .info-card {
    padding: 20px;
  }

  .nav-tabs {
    flex-direction: column;
  }

  .nav-tab {
    padding: 12px 20px;
  }
}

@media (max-width: 480px) {
  .exercises-header {
    padding: 25px 20px;
  }
  
  .exercises-header h1 {
    font-size: 1.8em;
  }
  
  .exercise-card {
    padding: 15px;
  }
  
  .exercise-title {
    font-size: 1.2em;
  }
  
  .exercise-number {
    width: 35px;
    height: 35px;
    font-size: 1em;
  }
}

/* Mode sombre (optionnel) */
@media (prefers-color-scheme: dark) {
  .exercise-card {
    background: rgba(44, 62, 80, 0.95);
    color: #ecf0f1;
  }
  
  .exercise-content {
    color: #bdc3c7;
  }
  
  .exercise-title {
    color: #ecf0f1;
  }
  
  .correction-section {
    background: linear-gradient(135deg, rgba(44, 62, 80, 0.3), rgba(52, 73, 94, 0.3));
  }
  
  .correction-section li {
    background: rgba(52, 73, 94, 0.8);
    color: #ecf0f1;
  }
}