@import url("responsive-global.css");
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;700;900&display=swap');

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

body {
    font-family: 'Cairo', Arial, sans-serif;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
}

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

.container {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
}

.header {
    text-align: center;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    /* animation: bounce 2s ease-in-out infinite; */ /* ❌ Désactivé - trop distrayant */
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.header::before {
    content: "📢";
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 40px;
    animation: spin 3s linear infinite;
}

.header::after {
    content: "📊";
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 40px;
    animation: spin 3s linear infinite reverse;
}

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

.header h1 {
    font-size: 28px;
    font-weight: 900;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
    position: relative;
    z-index: 2;
}

.subtitle {
    font-size: 16px;
    margin-top: 10px;
    opacity: 0.9;
}

.exercise {
    background: white;
    border-radius: 20px;
    margin: 25px 0;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    background-clip: padding-box;
}

.exercise:hover {
    transform: translateY(-3px) scale(1.01); /* ✅ Mouvement réduit */
    box-shadow: 0 15px 35px rgba(0,0,0,0.25);
}

.exercise:nth-child(even) {
    /* animation: wiggle 6s ease-in-out infinite; */ /* ❌ Désactivé - oscillation permanente */
}

.exercise:nth-child(odd) {
    /* animation: wiggle 6s ease-in-out infinite reverse; */ /* ❌ Désactivé - oscillation permanente */
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(1deg); }
    75% { transform: rotate(-1deg); }
}

.exercise-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
    font-weight: 700;
    font-size: 24px;
}

.exercise-header::before {
    content: "💯";
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 30px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.1); } /* ✅ Scale réduit de 1.2 à 1.1 */
}

.exercise-content {
    padding: 25px;
    position: relative;
}

.intro-text {
    background: linear-gradient(45deg, #ffeaa7, #fab1a0);
    color: #2d3436;
    padding: 15px;
    border-radius: 15px;
    margin: 15px 0;
    font-weight: bold;
    text-align: center;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.intro-text::before {
    content: "👀";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
}

.question {
    background: #f8f9fa;
    border-right: 5px solid #e74c3c;
    padding: 20px;
    margin: 15px 0;
    border-radius: 15px;
    font-weight: bold;
    color: #2c3e50;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.question:hover {
    transform: translateX(5px); /* ✅ Mouvement réduit de 10px à 5px */
    border-right-color: #ff6b6b;
}

.question::before {
    content: "🤔";
    position: absolute;
    left: -15px;
    top: 10px;
    font-size: 25px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); } /* ✅ Amplitude réduite de -10px à -5px */
}

.mcq {
    background: linear-gradient(45deg, #74b9ff, #0984e3);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin: 15px 20px;
    box-shadow: 0 8px 25px rgba(116, 185, 255, 0.4);
    position: relative;
}

.mcq::before {
    content: "✋";
    position: absolute;
    left: -10px;
    top: 10px;
    font-size: 25px;
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(10deg); } /* ✅ Rotation réduite de 20deg à 10deg */
    75% { transform: rotate(-10deg); } /* ✅ Rotation réduite de -20deg à -10deg */
}

.mcq-item {
    margin: 10px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    font-weight: bold;
}

.mcq-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(8px) scale(1.02); /* ✅ Mouvement réduit de 15px à 8px et scale de 1.05 à 1.02 */
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.mcq-item::before {
    content: "👆";
    opacity: 0;
    position: absolute;
    left: -25px;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s ease;
}

.mcq-item:hover::before {
    opacity: 1;
    left: -30px;
}

button {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin: 15px 5px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    position: relative;
    overflow: hidden;
}

button::before {
    content: "🔍";
    margin-right: 8px;
}

button:hover {
    transform: translateY(-2px) scale(1.02); /* ✅ Mouvement réduit de -3px à -2px et scale de 1.05 à 1.02 */
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    /* animation: rainbow 1s ease-in-out; */ /* ❌ Animation couleur désactivée */
}

@keyframes rainbow {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

.solution {
    display: none;
    background: linear-gradient(45deg, #a8edea, #fed6e3);
    padding: 25px;
    margin: 20px 0;
    border-radius: 15px;
    border-right: 5px solid #27ae60;
    position: relative;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateY(-20px) scale(0.8); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

.solution::before {
    content: "💡";
    position: absolute;
    left: -15px;
    top: 10px;
    font-size: 30px;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { 
        filter: brightness(1) drop-shadow(0 0 5px #ffeaa7); 
    }
    50% { 
        filter: brightness(1.5) drop-shadow(0 0 15px #fdcb6e); 
    }
}

.solution p:first-child {
    font-weight: bold;
    font-size: 18px;
    color: #27ae60;
    border-bottom: 2px dashed #27ae60;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.solution p:first-child::before {
    content: "✅ ";
    color: #27ae60;
}

.math-text {
    background: #ecf0f1;
    padding: 5px 10px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    color: #8e44ad;
    font-weight: bold;
    display: inline-block;
    margin: 2px;
    transition: all 0.3s ease;
}

.math-text:hover {
    background: #8e44ad;
    color: white;
    transform: scale(1.1);
}

.calculation {
    background: #f1f2f6;
    padding: 15px;
    border-radius: 10px;
    margin: 10px 0;
    border-left: 4px solid #00b894;
    font-family: 'Courier New', monospace;
    color: #2d3436;
    position: relative;
}

.calculation::before {
    content: "🧮";
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 20px;
}

.highlight {
    background: linear-gradient(45deg, #ffeaa7, #fab1a0);
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: bold;
    display: inline-block;
    margin: 2px;
    animation: highlight-pulse 3s ease-in-out infinite;
}

@keyframes highlight-pulse {
    0%, 100% { box-shadow: 0 0 0 rgba(255, 234, 167, 0.7); }
    50% { box-shadow: 0 0 20px rgba(255, 234, 167, 0.7); }
}

.floating-emoji {
    position: fixed;
    font-size: 30px;
    pointer-events: none;
    z-index: 1000;
    animation: float-away 4s ease-out forwards;
}

@keyframes float-away {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-200px) rotate(360deg);
    }
}

.party-mode {
    animation: party 0.5s ease-in-out;
}

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

/* Fun cursor effects */
.exercise:hover {
    cursor: pointer;
}

/* ✅ OPTION : Désactiver complètement les animations des icônes pour interface plus calme */
/*
.exercise::before,
.question::before,
.mcq::before,
.exercise-header::before,
.intro-text::before {
    animation: none !important;
}
*/

/* Mobile responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 16px;
        line-height: 1.8;
    }
    
    .container {
        padding: 5px;
    }
    
    .header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    .header h1 {
        font-size: 20px;
        line-height: 1.4;
    }
    
    .subtitle {
        font-size: 14px;
        margin-top: 8px;
    }
    
    .exercise {
        margin: 15px 0;
        border-radius: 15px;
    }
    
    .exercise-header {
        font-size: 18px;
        padding: 15px 10px;
        line-height: 1.4;
    }
    
    .exercise-content {
        padding: 15px;
    }
    
    .intro-text {
        font-size: 16px;
        padding: 12px;
        margin: 12px 0;
        line-height: 1.6;
    }
    
    .question {
        margin: 15px 0;
        padding: 15px;
        font-size: 16px;
        line-height: 1.8;
        border-radius: 12px;
    }
    
    .question::before {
        left: -10px;
        top: 8px;
        font-size: 20px;
    }
    
    .mcq {
        margin: 15px 10px;
        padding: 15px;
        font-size: 16px;
    }
    
    .mcq::before {
        left: -8px;
        top: 8px;
        font-size: 20px;
    }
    
    .mcq-item {
        margin: 12px 0;
        padding: 12px;
        font-size: 16px;
        line-height: 1.6;
        border-radius: 8px;
    }
    
    .mcq-item:hover {
        transform: translateX(10px) scale(1.02);
    }
    
    .mcq-item::before {
        left: -20px;
        font-size: 18px;
    }
    
    .mcq-item:hover::before {
        left: -25px;
    }
    
    button {
        padding: 12px 20px;
        font-size: 14px;
        margin: 10px 2px;
        border-radius: 20px;
    }
    
    .solution {
        margin: 15px 0;
        padding: 15px;
        font-size: 15px;
        line-height: 1.7;
        border-radius: 12px;
    }
    
    .solution::before {
        left: -12px;
        top: 8px;
        font-size: 25px;
    }
    
    .solution p {
        margin: 12px 0;
        line-height: 1.7;
    }
    
    .solution p:first-child {
        font-size: 16px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    .math-text {
        padding: 4px 8px;
        margin: 1px;
        font-size: 14px;
        display: inline-block;
        line-height: 1.4;
    }
    
    .calculation {
        padding: 12px;
        margin: 12px 0;
        font-size: 14px;
        line-height: 1.8;
        border-radius: 8px;
    }
    
    .calculation::before {
        right: 8px;
        top: 8px;
        font-size: 18px;
    }
    
    .highlight {
        padding: 3px 6px;
        margin: 1px;
        font-size: 15px;
        line-height: 1.6;
        display: inline-block;
    }
    
    /* Disable hover animations on mobile for better performance */
    .exercise:hover {
        transform: none;
    }
    
    .question:hover {
        transform: none;
    }
    
    /* Reduce floating emoji size on mobile */
    .floating-emoji {
        font-size: 20px;
    }
    
    /* Adjust exercise animations for mobile - ✅ Déjà désactivées */
    .exercise:nth-child(even),
    .exercise:nth-child(odd) {
        animation: none;
    }
    
    /* Better spacing for Arabic text on mobile */
    [dir="rtl"] .question,
    [dir="rtl"] .solution,
    [dir="rtl"] .mcq-item {
        text-align: right;
        direction: rtl;
    }
    
    /* Ensure proper text wrapping */
    .math-text {
        word-break: keep-all;
        white-space: nowrap;
    }
    
    /* Better button positioning */
    button {
        display: block;
        width: 100%;
        max-width: 300px;
        margin: 15px auto;
    }
}

/* ✅ Support pour les utilisateurs sensibles au mouvement */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}