/* ============================================
   AUTOMATISMES 5ÈME - STYLE (inspiré flashcards)
   ============================================ */

/* ============================================
   VARIABLES CSS - CHARTE GRAPHIQUE
   ============================================ */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --flashcard-color: #667eea;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-bg: #ecf0f1;
    --card-shadow: 0 4px 6px rgba(0,0,0,0.1);
    --gradient-purple: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ============================================
   MENU DÉROULANT "NOTIONS À TRAVAILLER"
   ============================================ */
.notions-toggle-btn {
    width: 100%;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.notions-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.notions-toggle-btn:active {
    transform: translateY(0);
}

.notions-toggle-btn .toggle-icon {
    font-size: 0.8em;
    transition: transform 0.3s ease;
}

.notions-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.3s ease;
    opacity: 0;
}

.notions-content.open {
    max-height: 3000px;
    opacity: 1;
}

/* ============================================
   SÉLECTION CHAPITRES & ITEMS (comme flashcards)
   ============================================ */
.selection-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--card-shadow);
}

.section-title {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.selection-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.selection-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
    font-weight: 600;
}

.select-all-btn {
    background: var(--success-color);
    color: white;
}

.select-all-btn:hover {
    background: #229954;
    transform: translateY(-2px);
}

.unselect-all-btn {
    background: var(--danger-color);
    color: white;
}

.unselect-all-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* GRILLE CHAPITRES */
.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.chapter-checkbox {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 10px;
    transition: all 0.3s;
    cursor: pointer;
}

.chapter-checkbox:hover {
    background: #dfe6e9;
    transform: translateX(5px);
}

.chapter-checkbox input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.chapter-checkbox label {
    cursor: pointer;
    font-weight: 500;
}

.chapter-checkbox input:checked + label {
    color: var(--flashcard-color);
    font-weight: 600;
}

/* BOUTON TOGGLE ITEMS */
.toggle-items-btn {
    display: block;
    width: 100%;
    margin: 20px 0;
    padding: 12px;
    background: #e9ecef;
    color: #495057;
    border: 2px dashed #ced4da;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.3s;
}

.toggle-items-btn:hover {
    background: #dee2e6;
    border-color: #adb5bd;
    transform: scale(1.02);
}

/* SECTION ITEMS */
.items-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.3s ease;
    opacity: 0;
}

.items-section.expanded {
    max-height: 2000px;  /* Grande valeur pour permettre l'expansion */
    opacity: 1;
    overflow-y: visible;
    padding-top: 20px;
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.item-checkbox {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--flashcard-color);
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
}

.item-checkbox:hover {
    background: #e9ecef;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.item-checkbox input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 3px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.item-checkbox label {
    cursor: pointer;
    font-size: 0.9em;
    line-height: 1.4;
    flex: 1;
}

.item-checkbox input:checked + label {
    color: var(--success-color);
    font-weight: 500;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .chapters-grid,
    .items-grid {
        grid-template-columns: 1fr;
    }
    
    .selection-actions {
        flex-direction: column;
    }
    
    .selection-actions button {
        width: 100%;
    }
}

/* ============================================
   STYLES ADDITIONNELS POUR AUTOMATISMES
   ============================================ */

/* Message quand aucun chapitre sélectionné */
#items-checkboxes > p {
    margin: 0;
    padding: 30px 20px;
    text-align: center;
    color: #999;
    font-style: italic;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

/* Container principal */
#chapters-checkboxes,
#items-checkboxes {
    min-height: 50px;
}

/* Animation d'apparition items */
.items-section.expanded .items-grid {
    animation: slideIn 0.4s ease-out;
}

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