/* ===============================================
   DRAG & DROP EXERCISE STYLES - VERSION 2.1
   Style moderne corrigé pour affichage horizontal
   Compatible RTL (arabe) + Navigation multi-exercices
   =============================================== */

/* VARIABLES CSS */
:root {
    --primary-color: #4ECDC4;
    --secondary-color: #FF6B6B;
    --success-color: #51CF66;
    --error-color: #FF6B6B;
    --warning-color: #FFD93D;
    --info-color: #74C0FC;
    
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F9FA;
    --bg-tertiary: #E9ECEF;
    
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6C757D;
    
    --border-color: #DEE2E6;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    
    --transition-normal: 0.3s ease;
}

/* RESET ET BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Cairo', 'Tahoma', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    direction: rtl;
}

/* CONTENEUR PRINCIPAL */
.exercise-container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 30px;
    animation: fadeIn 0.5s ease;
}

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

/* HEADER ET TITRES */
#exercise-title {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

#exercise-consigne {
    font-size: 1.2rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 30px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    border-right: 4px solid var(--primary-color);
}

/* ===============================================
   ZONE DE JEU (DRAG & DROP)
   =============================================== */

.drag-drop-area {
    display: flex;
    flex-direction: column; /* Banque en haut, Zones en bas */
    gap: 30px;
    margin-bottom: 30px;
}

/* BANQUE D'ITEMS (L'horizontale corrigée) */
.items-container {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 25px;
    min-height: 120px;
}

/* CARTES INDIVIDUELLES (Taille fixe pour éviter l'étirement) */
.drag-item {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 120px !important; /* Largeur fixe */
    height: 60px !important;  /* Hauteur fixe corrigée */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white !important;
    border-radius: var(--border-radius-sm);
    cursor: grab;
    user-select: none;
    box-shadow: var(--shadow-md);
    font-size: 1.2rem;
    font-weight: bold;
    transition: transform 0.2s, box-shadow 0.2s;
}

.drag-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.drag-item:active {
    cursor: grabbing;
}

/* ZONES DE DÉPÔT (Grille de questions) */
.zones-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.drop-zone {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.zone-label {
    font-weight: bold;
    color: white;
    background: var(--primary-color);
    padding: 8px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 10px;
}

.drop-area {
    min-height: 80px;
    background: white;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    transition: all 0.3s;
}

.drop-area.correct { border-color: var(--success-color); background: #ebfbee; }
.drop-area.incorrect { border-color: var(--error-color); background: #fff5f5; }

/* BOUTONS DE CONTRÔLE */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.controls button, .nav-btn {
    padding: 12px 25px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-normal);
}

#btn-verify { background: var(--success-color); color: white; }
#btn-reset { background: var(--secondary-color); color: white; }
.nav-btn { background: #2c3e50; color: white; }
.nav-btn:disabled { background: #bdc3c7; cursor: not-allowed; }

/* FEEDBACK GLOBAL */
.feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: var(--border-radius-sm);
    text-align: center;
    font-weight: bold;
}

.hidden { display: none; }