/* =============================================================================
   CALCUL UP - STYLES PERSONNALISÉS
   ============================================================================= */

/* Variables CSS */
:root {
    --primary-emerald: #10b981;
    --primary-sky: #0ea5e9;
    --accent-amber: #fbbf24;
    --accent-violet: #8b5cf6;
    --neutral-stone: #78716c;
    --success-emerald: #059669;
    --warning-amber: #d97706;
    --error-rose: #e11d48;
    --background-light: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--neutral-stone);
    background: linear-gradient(135deg, #f1f5f9 0%, #e0f2fe 100%);
    min-height: 100vh;
}

/* =============================================================================
   ÉCRAN DE CHARGEMENT
   ============================================================================= */

.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f3f4f6, #e0f2fe);
}

.loading-content {
    text-align: center;
    padding: 2rem;
}

.loading-spin {
    width: 48px;
    height: 48px;
    border: 3px solid var(--primary-emerald);
    border-top: 3px solid transparent;
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

.loading-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #374151;
    margin-bottom: 0.5rem;
}

.loading-text {
    color: #6b7280;
    font-size: 0.875rem;
}

/* =============================================================================
   ANIMATIONS
   ============================================================================= */

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes pulseSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Classes d'animation */
.slide-in {
    animation: slideIn 0.3s ease-out;
}

.pulse-success {
    animation: pulseSuccess 0.5s ease-out;
}

.shake-error {
    animation: shakeError 0.5s ease-out;
}

.timer-warning {
    animation: timerPulse 1s infinite;
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

/* =============================================================================
   COMPOSANTS UI
   ============================================================================= */

/* Barres de progression */
.progress-bar {
    transition: width 0.3s ease-out;
    border-radius: 9999px;
}

/* Effets glass/glassmorphism */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-soft);
}

/* Boutons avec effets */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-emerald), var(--primary-sky));
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -8px rgba(16, 185, 129, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--neutral-stone);
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 500;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* Switch toggle personnalisé */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-emerald);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* =============================================================================
   ÉCRANS SPÉCIFIQUES
   ============================================================================= */

/* Dashboard */
.dashboard-card {
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-soft);
    transition: var(--transition-smooth);
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -8px rgba(0, 0, 0, 0.1);
}

/* Stats cards */
.stat-card {
    text-align: center;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid;
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: scale(1.02);
}

.stat-card.emerald {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.stat-card.sky {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #0c4a6e;
}

.stat-card.amber {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.stat-card.violet {
    background: #f5f3ff;
    border-color: #c4b5fd;
    color: #5b21b6;
}

.stat-card.orange {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #c2410c;
}

/* =============================================================================
   JEU
   ============================================================================= */

/* Timer styles */
.timer-normal {
    color: var(--neutral-stone);
    font-weight: bold;
}

.timer-warning {
    color: var(--error-rose);
    font-weight: bold;
    animation: timerPulse 1s infinite;
}

/* Question cards */
.question-card {
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    padding: 2rem;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-soft);
}

/* Choix de réponse */
.choice-button {
    width: 100%;
    padding: 1rem;
    text-align: left;
    border-radius: 0.75rem;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.choice-button:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.choice-button.selected {
    border-color: var(--primary-emerald);
    background: #ecfdf5;
    color: #065f46;
}

.choice-button.correct {
    border-color: var(--success-emerald);
    background: #ecfdf5;
    color: #065f46;
}

.choice-button.incorrect {
    border-color: var(--error-rose);
    background: #fef2f2;
    color: #991b1b;
}

/* Clavier mathématique */
.math-keyboard {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 0.75rem;
    padding: 1rem;
}

.math-key {
    padding: 0.5rem;
    background: white;
    border: 1px solid #bae6fd;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.math-key:hover {
    background: #f0f9ff;
}

/* =============================================================================
   FORMS
   ============================================================================= */

.form-input {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    transition: var(--transition-smooth);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-emerald);
    background: white;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.75rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    transition: var(--transition-smooth);
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-emerald);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* =============================================================================
   NOTIFICATIONS & ALERTS
   ============================================================================= */

.alert {
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid;
}

.alert.success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.alert.warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

.alert.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert.info {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #0c4a6e;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
    .dashboard-card {
        padding: 1rem;
    }
    
    .question-card {
        padding: 1.5rem;
    }
    
    .loading-title {
        font-size: 1.25rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
}

@media (max-width: 640px) {
    .dashboard-card {
        padding: 0.75rem;
    }
    
    .question-card {
        padding: 1rem;
    }
    
    .choice-button {
        padding: 0.75rem;
    }
}

/* =============================================================================
   UTILS
   ============================================================================= */

.text-gradient {
    background: linear-gradient(135deg, var(--primary-emerald), var(--primary-sky));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-glow {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.border-gradient {
    border-image: linear-gradient(135deg, var(--primary-emerald), var(--primary-sky)) 1;
}

/* Classes utilitaires pour les états */
.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.loading {
    position: relative;
    color: transparent;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--primary-emerald);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}