/* ============================================
   CART.CSS - Styles spécifiques au panier
   Contient : header panier, modes d'affichage,
   drag & drop, différenciation, plein écran
   ============================================ */

/* ============================================
   VARIABLES COULEUR DU PANIER (vert)
   ============================================ */
#panier-view {
    --couleur-panier-primaire: #059669;
    --couleur-panier-secondaire: #10b981;
}

/* ============================================
   HEADER DU PANIER — Layout panneau gauche
   ============================================ */
#panier-view .panneau-config {
    background: white;
    border-right: 1px solid var(--couleur-bordure);
}

#panier-view .panneau-config h2 {
    color: var(--couleur-panier-primaire);
}

#panier-view .panneau-config h2::before {
    color: var(--couleur-panier-secondaire);
}



#panier-view .btn-pdf-panier {
    background: #d1fae5;
    color: #047857;
    border-color: #059669;
}

#panier-view .btn-pdf-panier:hover {
    background: #059669;
    color: white;
}

#panier-view .btn-vider-panier {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fca5a5;
}

#panier-view .btn-vider-panier:hover {
    background: #fee2e2;
    border-color: #dc2626;
}

#panier-view .mode-btn {
    padding: 8px 12px;
    border: 2px solid #6ee7b7;
    border-radius: 8px;
    background: #f0fdf4;
    color: #065f46;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
}

#panier-view .mode-btn.active {
    background: #d1fae5;
    color: #047857;
    border-color: #059669;
    box-shadow: 0 2px 4px rgba(5,150,105,0.2), 0 1px 2px rgba(0,0,0,0.06);
}

/* Legacy header (supprimé mais gardé pour compatibilité) */
.header-panier {
    background: linear-gradient(135deg, var(--couleur-panier-primaire) 0%, var(--couleur-panier-secondaire) 100%);
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}


.titre-panier {
    color: white;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

/* Groupe de boutons d'action du panier */



/* Bouton "Vider" en rouge */
.btn-vider-panier {
    background: rgba(220, 38, 38, 0.2);
    border-color: rgba(220, 38, 38, 0.4);
}

.btn-vider-panier:hover {
    background: rgba(220, 38, 38, 0.3);
    border-color: rgba(220, 38, 38, 0.6);
}

/* ============================================
   BOUTONS DE MODE (Fichier / Compact)
   Toggle entre les deux modes d'affichage
   ============================================ */
.mode-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.mode-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: inherit;
}

.mode-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.mode-btn.active {
    background: white;
    color: var(--couleur-panier-primaire);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Indicateur de raccourci clavier */
.shortcut-hint {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-left: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ============================================
   CONTENEUR DU PANIER
   Zone centrale avec la feuille et les exercices
   ============================================ */
.panier-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    overflow-x: hidden;
}

@media (max-width: 700px) {
    .panier-container { padding: 0.5rem; }
    #feuille-panier { padding: 1.5rem !important; }
}

/* ============================================
   DRAG & DROP
   Réordonnement des exercices par glisser-déposer
   ============================================ */
.exercice-panier-item {
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    cursor: grab;
    position: relative;
}

.exercice-panier-item:active { cursor: grabbing; }

/* État pendant le drag */
.exercice-panier-item.dragging {
    opacity: 0.5;
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

/* Indicateur de zone de drop */
.exercice-panier-item.drag-over {
    border-top: 3px solid var(--couleur-panier-primaire);
}

/* Poignée de drag (points ⋮⋮) */
.drag-handle {
    position: absolute;
    left: -25px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    cursor: grab;
    font-size: 1.2rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.exercice-panier-item:hover .drag-handle { opacity: 1; }

/* ============================================
   MODE COMPACT
   Grille flexible avec exercices côte à côte
   ============================================ */
.exercices-grid-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-start;
}

.exercices-grid-compact .exercice-panier-item { margin-bottom: 0 !important; }
.exercices-grid-compact .exercice-panier-item.half-width { width: calc(50% - 8px); flex-shrink: 0; }
.exercices-grid-compact .exercice-panier-item.full-width { width: 100%; }

/* ============================================
   PLEIN ÉCRAN
   Overlay pour aperçu grand format
   ============================================ */
.fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    overflow: auto;
    padding: 2rem;
}

.fullscreen-overlay.active { display: block; }

.fullscreen-content {
    background: white;
    max-width: 21cm;
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 2cm;
    min-height: 29.7cm;
}

.fullscreen-close {
    position: fixed;
    top: 1rem; right: 1rem;
    background: white;
    border: none;
    width: 50px; height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transition: transform 0.2s;
}

.fullscreen-close:hover { transform: scale(1.1); }

/* ============================================
   DIFFÉRENCIATION PAR GROUPES
   Configuration et badges des groupes
   ============================================ */
.diff-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.diff-toggle input[type="checkbox"] { width: 18px; height: 18px; accent-color: #059669; }
.diff-toggle label { font-weight: 600; cursor: pointer; }
.diff-groupes-config { margin-top: 12px; display: none; }
.diff-groupes-config.active { display: block; }
.diff-groupe-ligne { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.diff-groupe-ligne input { padding: 6px 10px; border: 2px solid #cbd5e0; border-radius: 6px; font-size: 14px; width: 120px; }
.diff-groupe-ligne .couleur-groupe { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }

/* Sélecteur de groupe sur chaque exercice */
.groupe-selector { display: flex; align-items: center; gap: 6px; margin-left: 8px; flex-shrink: 0; }
.groupe-selector select { padding: 2px 6px; border: 1px solid #cbd5e0; border-radius: 4px; font-size: 11px; background: white; }

/* Badge coloré du groupe */
.groupe-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; color: white; }
