/* ============================================
   STYLES POUR MENUS DÉROULANTS CHAPITRES/ITEMS
   ============================================ */

/* Section des chapitres */
#chapters-selection {
    margin-bottom: 25px;
}

#chapters-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.chapter-checkbox {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.chapter-checkbox:hover {
    border-color: #4CAF50;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15);
    transform: translateY(-1px);
}

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

.chapter-checkbox label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.chapter-checkbox input:checked + label {
    color: #4CAF50;
    font-weight: 600;
}

/* Section des items (déroulante) */
#items-selection {
    margin-top: 20px;
    margin-bottom: 20px;
}

#items-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Élément <details> pour chaque chapitre */
.chapter-items-dropdown {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chapter-items-dropdown[open] {
    border-color: #4CAF50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.1);
}

/* Titre du dropdown (élément <summary>) */
.chapter-items-dropdown summary {
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.chapter-items-dropdown summary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
}

.chapter-items-dropdown summary::marker {
    font-size: 1.2em;
}

.chapter-items-dropdown summary .items-count {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
}

/* Liste des items */
.items-list {
    padding: 15px 20px 20px 20px;
    background: #fafafa;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 10px;
}

.item-checkbox {
    display: flex;
    align-items: flex-start;
    padding: 10px 12px;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.item-checkbox:hover {
    border-color: #4CAF50;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

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

.item-checkbox label {
    flex: 1;
    font-size: 13px;
    line-height: 1.5;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.item-checkbox .item-name {
    flex: 1;
}

.item-checkbox .exercise-count {
    font-size: 11px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.item-checkbox input:checked + label .item-name {
    color: #4CAF50;
    font-weight: 500;
}

.item-checkbox input:checked + label .exercise-count {
    background: #e8f5e9;
    color: #4CAF50;
}

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

/* Responsive */
@media (max-width: 768px) {
    #chapters-checkboxes {
        grid-template-columns: 1fr;
    }
    
    .items-list {
        grid-template-columns: 1fr;
    }
    
    .chapter-items-dropdown summary {
        font-size: 14px;
        padding: 12px 15px;
    }
    
    .item-checkbox label {
        font-size: 12px;
    }
}

/* Animation d'ouverture du dropdown */
.chapter-items-dropdown[open] .items-list {
    animation: slideDown 0.3s ease-out;
}

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

/* Boutons Tous/Aucun */
.selection-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.selection-buttons button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.selection-buttons button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-select-all {
    background: #4CAF50;
    color: white;
}

.btn-select-all:hover {
    background: #45a049;
}

.btn-select-none {
    background: #f44336;
    color: white;
}

.btn-select-none:hover {
    background: #da190b;
}
