/**
 * grille-progression-selector.css
 * 🎨 Styles pour le sélecteur de progression dans la bannière nom d'accord
 * Dropdown cliquable affichant les progressions enregistrées
 */

/* ============================================
   BANNIÈRE NOM D'ACCORD EN MODE GRILLE
   Transformée en sélecteur de progression
   ============================================ */

body[data-mode="custom-grid"] .chord-name-banner {
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    user-select: none;
}

body[data-mode="custom-grid"] .chord-name-banner:hover {
    background: #FFF5D6;
    border-color: #6b6b00;
}

/* Contenu cliquable avec icône dropdown */
body[data-mode="custom-grid"] .chord-name-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: normal;
    overflow: visible;
}

/* Icône dropdown (chevron) */
.progression-dropdown-icon {
    display: none; /* Masqué par défaut */
    font-size: 0.875rem;
    transition: transform 0.3s ease;
}

/* Afficher l'icône en mode grille */
body[data-mode="custom-grid"] .progression-dropdown-icon {
    display: inline-block;
}

/* Rotation de l'icône quand le dropdown est ouvert */
body[data-mode="custom-grid"] .chord-name-banner.open .progression-dropdown-icon {
    transform: rotate(180deg);
}

/* ============================================
   DROPDOWN - LISTE DES PROGRESSIONS
   ============================================ */

.progression-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    min-width: 100%;
    max-width: 20rem;
    max-height: 20rem;
    overflow-y: auto;
    background: white;
    border: 2px solid var(--couleur-primaire);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

/* Dropdown ouvert */
.progression-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Header du dropdown */
.progression-dropdown-header {
    padding: 0.75rem 1rem;
    background: var(--couleur-primaire);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 2px solid #6b6b00;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Liste des progressions */
.progression-dropdown-list {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
}

/* Item de progression */
.progression-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.progression-item:hover {
    background: #f8f8f8;
}

/* Progression active */
.progression-item.active {
    background: #FFFAEB;
    border-left: 3px solid var(--couleur-primaire);
    padding-left: calc(1rem - 3px);
}

/* Info de la progression */
.progression-item-info {
    flex: 1;
}

.progression-item-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.progression-item-meta {
    font-size: 0.75rem;
    color: #666;
}

/* Icône checkmark pour la progression active */
.progression-item-check {
    color: var(--couleur-primaire);
    font-size: 1rem;
    display: none;
}

.progression-item.active .progression-item-check {
    display: block;
}

/* Message quand aucune progression */
.progression-dropdown-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #666;
    font-style: italic;
    font-size: 0.875rem;
}

.progression-dropdown-empty i {
    font-size: 2rem;
    color: var(--couleur-primaire);
    opacity: 0.3;
    margin-bottom: 0.5rem;
    display: block;
}

/* Footer avec bouton "Gérer" */
.progression-dropdown-footer {
    padding: 0.75rem 1rem;
    border-top: 2px solid #f0f0f0;
    background: #fafafa;
    position: sticky;
    bottom: 0;
}

.progression-manage-btn {
    width: 100%;
    padding: 0.5rem;
    background: var(--couleur-primaire);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.progression-manage-btn:hover {
    background: #6b6b00;
}

/* ============================================
   SCROLLBAR CUSTOM
   ============================================ */

.progression-dropdown-list {
    scrollbar-width: thin;
    scrollbar-color: var(--couleur-primaire) #f0f0f0;
}

.progression-dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.progression-dropdown-list::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.progression-dropdown-list::-webkit-scrollbar-thumb {
    background: var(--couleur-primaire);
    border-radius: 3px;
}

.progression-dropdown-list::-webkit-scrollbar-thumb:hover {
    background: #6b6b00;
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */

@media (max-width: 47.9375rem) {
    .progression-dropdown {
        max-width: 90vw;
        max-height: 60vh;
        left: 0;
        right: 0;
        margin: 0 auto;
        transform: translateX(0) translateY(-10px);
    }
    
    .progression-dropdown.open {
        transform: translateX(0) translateY(0);
    }
    
    .progression-item {
        padding: 0.625rem 0.875rem;
    }
    
    .progression-item-name {
        font-size: 0.875rem;
    }
    
    .progression-item-meta {
        font-size: 0.6875rem;
    }
    
    .progression-dropdown-header {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }
}

/* ============================================
   RESPONSIVE - TABLETTE
   ============================================ */

@media (min-width: 48rem) and (max-width: 63.9375rem) {
    .progression-dropdown {
        min-width: 16rem;
    }
}

/* ============================================
   ACCESSIBILITÉ
   ============================================ */

body[data-mode="custom-grid"] .chord-name-banner:focus-visible {
    outline: 3px solid var(--couleur-primaire);
    outline-offset: 2px;
}

.progression-item:focus-visible {
    outline: 2px solid var(--couleur-primaire);
    outline-offset: -2px;
}

/* Support clavier */
.progression-item:focus {
    background: #f8f8f8;
}

/* ============================================
   PRÉFÉRENCE MOUVEMENT RÉDUIT
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    body[data-mode="custom-grid"] .chord-name-banner,
    .progression-dropdown,
    .progression-dropdown-icon,
    .progression-item,
    .progression-manage-btn {
        transition: none;
    }
    
    body[data-mode="custom-grid"] .chord-name-banner.open .progression-dropdown-icon {
        transform: none;
    }
}

/* ============================================
   PRINT
   ============================================ */

@media print {
    .progression-dropdown,
    .progression-dropdown-icon {
        display: none !important;
    }
    
    body[data-mode="custom-grid"] .chord-name-banner {
        cursor: default;
    }
}
