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

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

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================== */
/* HEADER */
/* ========================================== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: 25px 25px 0 0;
    text-align: center;
    position: relative;
    box-shadow: 0 -5px 30px rgba(0,0,0,0.2);
}

.header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    font-weight: 900;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.95;
}

.nouveau-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 1rem;
    animation: pulse 2s infinite;
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
}

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

/* ========================================== */
/* NAVIGATION TABS */
/* ========================================== */
.tabs-nav {
    background: white;
    display: flex;
    gap: 0;
    padding: 0 40px;
    border-bottom: 3px solid #f1f5f9;
}

.tab-btn {
    flex: 1;
    padding: 20px 30px;
    background: transparent;
    border: none;
    border-bottom: 4px solid transparent;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    color: #64748b;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.tab-btn:hover {
    color: #667eea;
    background: #f8fafc;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

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

/* ========================================== */
/* CONTENT WRAPPER */
/* ========================================== */
.content-wrapper {
    background: white;
    border-radius: 0 0 25px 25px;
    min-height: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.tab-content {
    display: none;
    padding: 40px;
    opacity: 0;
    animation: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s forwards;
}

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

/* ========================================== */
/* CARDS */
/* ========================================== */
.card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.card-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-subtitle {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
}

.icon {
    font-size: 1.5rem;
}

.badge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 700;
    margin-left: auto;
}

.badge-info {
    background: #e0e7ff;
    color: #667eea;
    padding: 5px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
}

/* ========================================== */
/* UPLOAD ZONE */
/* ========================================== */
.upload-zone {
    border: 3px dashed #cbd5e1;
    border-radius: 15px;
    padding: 50px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8fafc;
}

.upload-zone:hover {
    border-color: #667eea;
    background: #eff6ff;
}

.upload-zone.dragover {
    border-color: #667eea;
    background: #e0e7ff;
    border-style: solid;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.upload-zone h3 {
    color: #1e293b;
    margin-bottom: 10px;
}

.upload-zone p {
    color: #64748b;
}

/* ========================================== */
/* FORM ELEMENTS */
/* ========================================== */
.form-group {
    margin-bottom: 30px;
}

.form-label {
    display: block;
    font-weight: 700;
    color: #475569;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.small-label {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 5px;
    display: block;
}

.value-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 1.1rem;
    margin-left: 10px;
}

.form-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.form-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

/* ========================================== */
/* BOUTONS PIÈCES */
/* ========================================== */
.pieces-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-piece {
    min-width: 65px;
    padding: 15px 20px;
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 800;
    font-size: 1.1rem;
    color: #64748b;
}

.btn-piece small {
    font-size: 0.7rem;
    display: block;
    margin-top: 3px;
}

.btn-piece:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.btn-piece.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    transform: scale(1.1);
}

/* ========================================== */
/* DIFFICULTY SELECTOR */
/* ========================================== */
.difficulty-selector {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.difficulty-badge {
    padding: 15px 25px;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 700;
    font-size: 1rem;
    background: white;
}

.difficulty-badge:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.difficulty-badge.active {
    border-color: transparent;
    color: white;
}

.difficulty-badge.facile.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.difficulty-badge.moyen.active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.difficulty-badge.difficile.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.difficulty-badge.expert.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* ========================================== */
/* SUITE GRID (Composition) */
/* ========================================== */
.suite-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    padding: 30px;
    background: #f8fafc;
    border-radius: 15px;
    border: 3px dashed #cbd5e1;
    min-height: 180px;
}

.piece-slot {
    aspect-ratio: 1;
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    user-select: none;
}

.piece-slot:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.piece-slot.filled {
    border-color: #10b981;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.piece-slot.to-find {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-style: dashed;
}

.piece-slot.to-find::after {
    content: '?';
    font-size: 4rem;
    color: #f59e0b;
    font-weight: 900;
}

.piece-slot.dragover {
    border-color: #667eea;
    background: #eff6ff;
    transform: scale(1.1);
}

.piece-number {
    position: absolute;
    top: 5px;
    left: 5px;
    background: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 800;
    border: 2px solid #667eea;
    color: #667eea;
    z-index: 5;
}

.piece-slot img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* ========================================== */
/* IMAGE LIBRARY */
/* ========================================== */
.compteur-images {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 18px;
    border-radius: 15px;
    font-weight: 800;
    font-size: 1.1rem;
    margin-left: auto;
}

.filtres {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filtre-btn {
    padding: 10px 20px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    color: #64748b;
}

.filtre-btn:hover {
    border-color: #667eea;
}

.filtre-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.image-library {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 15px;
    padding: 25px;
    background: #f8fafc;
    border-radius: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.image-item {
    aspect-ratio: 1;
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    cursor: grab;
    transition: all 0.3s;
    position: relative;
    user-select: none;
}

.image-item:hover {
    border-color: #667eea;
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
    z-index: 10;
}

.image-item:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.image-item.dragging {
    opacity: 0.3;
    transform: scale(0.8);
}

.image-item.hidden {
    display: none;
}

.image-item img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.delete-image {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
}

.image-item:hover .delete-image {
    display: flex;
}

/* ========================================== */
/* TEMPLATES */
/* ========================================== */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.template-card {
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #cbd5e1;
    cursor: pointer;
    transition: all 0.3s;
}

.template-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.template-card h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #1e293b;
}

.template-preview {
    font-size: 2.5rem;
    margin: 15px 0;
    text-align: center;
}

.template-infos {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 600;
}

/* ========================================== */
/* BOUTONS */
/* ========================================== */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn-primary {
    padding: 18px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    padding: 18px 40px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

/* ========================================== */
/* GAME HEADER (ÉLÈVE) */
/* ========================================== */
.game-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
}

.game-header h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.game-header p {
    font-size: 1.1rem;
    opacity: 0.95;
}

.game-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 25px;
    gap: 20px;
}

.stat-item {
    text-align: center;
    background: rgba(255,255,255,0.2);
    padding: 15px 25px;
    border-radius: 15px;
    flex: 1;
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 900;
    margin: 5px 0;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ========================================== */
/* PLAY GRID (ÉLÈVE) */
/* ========================================== */
.play-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    padding: 40px;
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
    border-radius: 20px;
}

.play-slot {
    aspect-ratio: 1;
    background: white;
    border: 4px solid #cbd5e1;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    position: relative;
    transition: all 0.3s;
}

.play-slot.empty {
    border-style: dashed;
    border-color: #f59e0b;
}

.play-slot.empty::before {
    content: '?';
    font-size: 5rem;
    color: #f59e0b;
    font-weight: 900;
    opacity: 0.3;
}

.play-slot.correct {
    border-color: #10b981;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    animation: success 0.5s;
}

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

.play-slot.dragover {
    border-color: #667eea;
    background: #eff6ff;
    transform: scale(1.05);
}

.play-slot img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.empty-message {
    grid-column: 1 / -1;
    text-align: center;
    color: #64748b;
    font-size: 1.2rem;
    padding: 40px;
}

/* ========================================== */
/* CHOICES GRID (ÉLÈVE) */
/* ========================================== */
.choices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    padding: 30px;
    background: #f8fafc;
    border-radius: 15px;
}

.choice-item {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 3px solid #cbd5e1;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    cursor: grab;
    transition: all 0.3s;
}

.choice-item:hover {
    border-color: #667eea;
    transform: scale(1.1);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

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

.choice-item.used {
    opacity: 0.3;
    cursor: not-allowed;
}

.choice-item img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* ========================================== */
/* GAME ACTIONS */
/* ========================================== */
.game-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

/* ========================================== */
/* ALERTS */
/* ========================================== */
.alert-container {
    margin: 20px 0;
}

.alert {
    padding: 20px 30px;
    border-radius: 15px;
    margin-bottom: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideIn 0.3s;
}

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

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 2px solid #10b981;
}

.alert-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 2px solid #ef4444;
}

.alert-icon {
    font-size: 1.8rem;
}

/* ========================================== */
/* PUZZLE */
/* ========================================== */
.images-puzzle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    padding: 20px;
}

.puzzle-image-card {
    aspect-ratio: 1;
    border: 3px solid #e2e8f0;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.puzzle-image-card:hover {
    border-color: #667eea;
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.puzzle-image-card.selected {
    border-color: #10b981;
    border-width: 4px;
}

.puzzle-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.puzzle-container {
    display: grid;
    gap: 2px;
    background: #e2e8f0;
    padding: 2px;
    border-radius: 15px;
    width: fit-content;
    margin: 0 auto;
}

.puzzle-piece {
    background-size: cover;
    background-position: center;
    cursor: grab;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.puzzle-piece:hover {
    border-color: #667eea;
    transform: scale(1.05);
    z-index: 10;
}

.puzzle-piece:active {
    cursor: grabbing;
}

.puzzle-piece.dragging {
    opacity: 0.5;
}

/* ========================================== */
/* RECORDS */
/* ========================================== */
.records-list {
    padding: 20px;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8fafc;
    border-radius: 10px;
    margin-bottom: 10px;
}

.record-rank {
    font-size: 1.5rem;
    font-weight: 900;
    width: 40px;
}

.record-time {
    font-size: 1.2rem;
    font-weight: 700;
    color: #667eea;
}

/* ========================================== */
/* SUITES LIST */
/* ========================================== */
.suites-list {
    display: grid;
    gap: 20px;
}

.suite-card {
    background: #f8fafc;
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
}

.suite-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.suite-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1e293b;
}

.suite-infos {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.suite-info-item {
    color: #64748b;
    font-size: 0.95rem;
}

.suite-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.suite-preview-piece {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.suite-preview-piece.visible {
    background: #d1fae5;
    border: 2px solid #10b981;
}

.suite-preview-piece.hidden {
    background: #fef3c7;
    border: 2px solid #f59e0b;
}

/* ========================================== */
/* RESPONSIVE */
/* ========================================== */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .tabs-nav {
        padding: 0 20px;
    }
    
    .tab-btn {
        font-size: 0.9rem;
        padding: 15px 10px;
    }
    
    .tab-content {
        padding: 20px;
    }
    
    .card {
        padding: 20px;
    }
    
    .pieces-buttons {
        gap: 8px;
    }
    
    .btn-piece {
        min-width: 55px;
        padding: 12px 15px;
        font-size: 1rem;
    }
}

/* ========================================== */
/* V3 - NOUVEAUX STYLES */
/* ========================================== */

/* LOGIN SCREEN */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    background: white;
    padding: 50px;
    border-radius: 25px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 450px;
    width: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-header h1 {
    font-size: 2.5rem;
    color: #1e293b;
    margin-bottom: 10px;
}

.login-header p {
    color: #64748b;
    font-size: 1.1rem;
}

.login-form {
    margin-top: 30px;
}

.login-error {
    margin-top: 15px;
    padding: 15px;
    background: #fee2e2;
    border: 2px solid #ef4444;
    border-radius: 10px;
    color: #991b1b;
    font-weight: 600;
    display: none;
}

.login-error.show {
    display: block;
}

.login-help {
    margin-top: 30px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 15px;
    font-size: 0.95rem;
    color: #64748b;
}

.login-help p {
    margin: 5px 0;
}

/* HEADER CONTENT */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-logout {
    padding: 12px 25px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

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

/* PROFILE SELECTOR */
.profile-selector {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.profile-badge {
    padding: 15px 25px;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 700;
    font-size: 1rem;
    background: white;
}

.profile-badge:hover {
    border-color: #667eea;
    transform: scale(1.05);
}

.profile-badge.active {
    border-color: transparent;
    color: white;
}

.profile-badge.baby.active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.profile-badge.enfant.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.profile-badge.ado.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.profile-badge.adulte.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.profile-badge.all.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* UPLOAD CATEGORIES */
.upload-categories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.upload-category h3 {
    font-size: 1.3rem;
    color: #1e293b;
    margin-bottom: 15px;
}

.uploads-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

/* SUITES SELECTION GRID */
.suites-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.suite-selection-card {
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
    padding: 25px;
    border-radius: 20px;
    border: 3px solid #cbd5e1;
    cursor: pointer;
    transition: all 0.3s;
}

.suite-selection-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.suite-selection-card.hidden {
    display: none;
}

.suite-selection-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.suite-selection-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1e293b;
}

.suite-selection-profile {
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
}

.suite-selection-infos {
    display: flex;
    gap: 15px;
    margin: 15px 0;
    flex-wrap: wrap;
    font-size: 0.95rem;
    color: #64748b;
}

.suite-selection-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.suite-selection-piece {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: white;
    border: 2px solid #cbd5e1;
}

/* PUZZLE GAME CONTAINER */
.puzzle-game-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.puzzle-sidebar {
    min-width: 250px;
}

.puzzle-container-large {
    display: grid;
    gap: 3px;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    flex: 1;
}

.puzzle-modele {
    background: #f8fafc;
    padding: 15px;
    border-radius: 15px;
    border: 2px solid #cbd5e1;
    margin-top: 15px;
}

.puzzle-modele h4 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: #1e293b;
}

.puzzle-modele img {
    width: 100%;
    border-radius: 10px;
}

/* RESPONSIVE V3 */
@media (max-width: 1024px) {
    .upload-categories {
        grid-template-columns: 1fr;
    }
    
    .puzzle-game-container {
        flex-direction: column;
    }
    
    .puzzle-sidebar {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .login-container {
        padding: 30px;
        margin: 20px;
    }
    
    .profile-selector {
        gap: 10px;
    }
    
    .profile-badge {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

/* ========================================== */
/* V4 - GAMIFICATION + MULTI-USERS + BUGFIXES */
/* ========================================== */

/* USERS LIST */
.users-list {
    display: grid;
    gap: 15px;
}

.user-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.user-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.user-card.expired {
    opacity: 0.6;
    border-color: #ef4444;
    background: #fee2e2;
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
}

.user-details {
    display: flex;
    gap: 15px;
    margin-top: 8px;
    font-size: 0.9rem;
    color: #64748b;
}

.user-actions {
    display: flex;
    gap: 10px;
}

/* GAMIFICATION PROFILE */
.gamification-profile {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 30px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.profile-info h2 {
    font-size: 2rem;
    margin: 0;
}

.profile-info p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin: 5px 0 0 0;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: rgba(255,255,255,0.2);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 5px;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* XP BAR */
.xp-container {
    margin-top: 20px;
}

.xp-label {
    font-size: 0.95rem;
    margin-bottom: 8px;
    text-align: center;
    font-weight: 600;
}

.xp-bar {
    width: 100%;
    height: 25px;
    background: rgba(255,255,255,0.2);
    border-radius: 15px;
    overflow: hidden;
}

.xp-progress {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

/* BADGES */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.badge-item {
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    border: 3px solid #cbd5e1;
    transition: all 0.3s;
}

.badge-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.badge-item.locked {
    opacity: 0.4;
    filter: grayscale(1);
}

.badge-item.unlocked {
    border-color: #10b981;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

.badge-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.badge-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 5px;
}

.badge-desc {
    font-size: 0.85rem;
    color: #64748b;
}

/* LEADERBOARD */
.leaderboard {
    background: white;
    border-radius: 15px;
    overflow: hidden;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #f1f5f9;
    transition: background 0.3s;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leaderboard-item:hover {
    background: #f8fafc;
}

.leaderboard-item.current-user {
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
}

.leaderboard-rank {
    width: 60px;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 800;
}

.leaderboard-rank.gold { color: #f59e0b; }
.leaderboard-rank.silver { color: #94a3b8; }
.leaderboard-rank.bronze { color: #d97706; }

.leaderboard-info {
    flex: 1;
    margin-left: 20px;
}

.leaderboard-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
}

.leaderboard-level {
    font-size: 0.9rem;
    color: #64748b;
}

.leaderboard-score {
    font-size: 1.5rem;
    font-weight: 800;
    color: #667eea;
}

/* USER BADGE HEADER */
#userBadge {
    padding: 10px 20px;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 15px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

#userBadge .level-icon {
    font-size: 1.5rem;
}

/* PUZZLE CONTAINER IMPROVED */
.puzzle-piece {
    cursor: grab;
    transition: transform 0.2s, opacity 0.2s;
    border: 2px solid #fff;
}

.puzzle-piece:active {
    cursor: grabbing;
    opacity: 0.7;
}

.puzzle-piece.dragging {
    opacity: 0.5;
    transform: scale(0.9);
}

/* AMÉLIORATIONS PUZZLES */
.puzzle-image-card {
    transition: all 0.3s ease;
    position: relative;
}

.puzzle-image-card:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    z-index: 10;
}

.puzzle-image-card.selected {
    border: 4px solid #667eea !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.3);
}

.puzzle-image-card.selected::after {
    content: '✓ SÉLECTIONNÉ';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #667eea;
    color: white;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ================================================================
   PLAYGROUND V5 - ANIMATIONS FEEDBACK
   ================================================================ */

@keyframes success-glow {
    0%, 100% { box-shadow: 0 0 10px #10b981; }
    50% { box-shadow: 0 0 25px #10b981, 0 0 40px rgba(16, 185, 129, 0.5); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

@keyframes pop-in {
    0% { transform: scale(0); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes star-fall {
    0% { transform: translateY(-50px) rotate(0) scale(0); opacity: 0; }
    15% { opacity: 1; transform: translateY(0) rotate(90deg) scale(1); }
    100% { transform: translateY(100vh) rotate(720deg) scale(0.3); opacity: 0; }
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-12px); }
}

.piece-correct {
    animation: success-glow 0.8s ease-in-out 3 !important;
    border-color: #10b981 !important;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0) !important;
}

.error-shake {
    animation: shake 0.4s ease-in-out !important;
}

.piece-incorrect {
    animation: shake 0.4s ease-in-out !important;
    background: #fef2f2 !important;
    border-color: #fca5a5 !important;
}

#choicesGrid > div {
    animation: pop-in 0.3s ease-out backwards;
}
#choicesGrid > div:nth-child(1) { animation-delay: 0.05s; }
#choicesGrid > div:nth-child(2) { animation-delay: 0.1s; }
#choicesGrid > div:nth-child(3) { animation-delay: 0.15s; }
#choicesGrid > div:nth-child(4) { animation-delay: 0.2s; }
#choicesGrid > div:nth-child(5) { animation-delay: 0.25s; }

#choicesGrid > div:hover {
    transform: scale(1.08) !important;
    transition: transform 0.15s ease !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15) !important;
}

.falling-star {
    position: fixed;
    font-size: 2rem;
    animation: star-fall 3s ease-out forwards;
    pointer-events: none;
    z-index: 9999;
}

/* ================================================================
   PLAYGROUND V5 - TAILLES TACTILES ENFANTS
   ================================================================ */

#playGrid > div, .piece-slot {
    min-width: 100px !important;
    min-height: 100px !important;
    font-size: 3rem !important;
}

#choicesGrid > div {
    min-width: 90px !important;
    min-height: 90px !important;
    font-size: 2.8rem !important;
}

.btn-primary, .btn-secondary {
    min-height: 55px !important;
    padding: 15px 30px !important;
    font-size: 1.2rem !important;
}

@media (max-width: 768px) {
    #playGrid > div, .piece-slot { min-width: 70px !important; min-height: 70px !important; }
    #choicesGrid > div { min-width: 65px !important; min-height: 65px !important; }
    .btn-primary, .btn-secondary { width: 100% !important; margin-bottom: 10px !important; }
}

/* ================================================================
   PLAYGROUND V5 - MODALS ENFANT-FRIENDLY
   ================================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: modal-fade-in 0.3s ease-out;
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: white;
    border-radius: 25px;
    padding: 35px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    animation: pop-in 0.35s ease-out;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}

.modal-box.victory {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 4px solid #f59e0b;
}

.modal-icon { font-size: 4.5rem; margin-bottom: 15px; }
.modal-title { font-size: 1.8rem; font-weight: 800; color: #1e293b; margin-bottom: 10px; }
.modal-message { font-size: 1.15rem; color: #64748b; margin-bottom: 25px; }

.victory-emoji { font-size: 5rem; animation: bounce 0.5s ease infinite alternate; }
.victory-title { font-size: 2.5rem; color: #b45309; text-shadow: 2px 2px 0 #fbbf24; margin-bottom: 10px; }
.victory-stars { font-size: 2.5rem; margin: 15px 0; }
.victory-stats { display: flex; justify-content: center; gap: 25px; margin: 20px 0; font-size: 1.2rem; font-weight: 600; color: #92400e; }
.victory-buttons { display: flex; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

#muteBtn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: all 0.2s;
}
#muteBtn:hover { background: rgba(255,255,255,0.2); }

/* ================================================================
   STYLES TACTILES (TABLETTE/MOBILE)
   ================================================================ */

/* Empêcher la sélection de texte sur les éléments interactifs */
.touch-item,
[draggable="true"] {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

/* CRITIQUE: Bloquer le menu natif sur les images dans les draggables */
[draggable="true"] img,
[draggable="true"] * {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

/* Zone de drop active sur tactile */
.drop-zone-active {
    background: #d1fae5 !important;
    border-color: #10b981 !important;
    transform: scale(1.02);
}

/* Tailles tactiles minimales (44px recommandé par Apple) */
@media (pointer: coarse) {
    .btn-primary,
    .btn-secondary,
    .tab-btn,
    button {
        min-height: 48px;
        min-width: 48px;
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .form-input,
    input,
    select {
        min-height: 48px;
        font-size: 16px; /* Empêche le zoom sur iOS */
        padding: 12px 15px;
    }
    
    /* Cartes de jeu plus grandes */
    #babyAlgoGameGrid > div {
        min-width: 120px;
        min-height: 100px;
    }
    
    /* Espacement tactile */
    .card {
        padding: 20px;
    }
    
    /* Navigation tactile */
    .tabs {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .tab-btn {
        flex: 1 1 auto;
        margin: 5px;
    }
}

/* Amélioration du drag visuel */
.dragging {
    opacity: 0.5;
    transform: scale(1.05);
}

/* Clone visuel pendant le drag tactile */
.touch-drag-clone {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
    opacity: 0.9;
    transform: scale(1.1);
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    border-radius: 15px;
}

/* Améliorer la visibilité des zones de drop */
#babyAlgoOrdreEleve {
    transition: all 0.2s ease;
}

#babyAlgoOrdreEleve.hover {
    background: #d1fae5 !important;
    border-color: #10b981 !important;
    transform: scale(1.01);
}

/* Feedback visuel au toucher */
@media (hover: none) {
    [draggable="true"]:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

/* Scrollbar tactile */
@media (max-width: 768px) {
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    /* Grilles adaptatives */
    #babyAlgoGameGrid {
        gap: 10px !important;
        justify-content: center !important;
    }
}
