/* ========================================================================== */
/* ======================== 1. VARIABLES GLOBALES =========================== */
/* ========================================================================== */
:root {
    /* Variables de zone sécurisée (iOS) */
    --safe-area-inset-left: env(safe-area-inset-left);
    --safe-area-inset-right: env(safe-area-inset-right);

    /* Thème Sombre Principal */
    --bg-dark: #1A1A2E;          /* Fond principal très sombre, bleu nuit */
    --surface-dark: #2C2C3E;     /* Couleur pour les surfaces comme les boutons */
    --primary-color: #7A5AF5;    /* Un violet vibrant mais pas agressif */
    --primary-hover: #9176ff;    /* Violet un peu plus clair pour le survol */
    --text-color: #EAEAFB;       /* Texte clair, légèrement bleuté */
    --shadow-color: rgba(0, 0, 0, 0.3);
    --glow-color: rgba(122, 90, 245, 0.4); /* Lueur subtile pour les actions importantes */

    /* Thème des Modales (SweetAlert2) */
    --swal-primary-color: #7b5aff;
    --swal-secondary-color: #6c757d;
    --swal-text-color: #e2e2e2;
    --swal-bg-color: #2c2c3e;
    --swal-header-bg-color: #222230; 
    --swal-checkbox-bg: #4a4a61;

    /* Thème des Favoris */
    --swal-bg-favorite-color: #fff0f0;
    --swal-border-favorite-color: #f5a5a5;
    --swal-font-favorite-color: #bb0b0b;
}

/* ========================================================================== */
/* ======================== 2. CORPS ET LAYOUT DE BASE ====================== */
/* ========================================================================== */
html, body {
    touch-action: manipulation; /* empêche double-tap et pinch dans la plupart des cas */
    overflow-x: hidden;
    margin: 0 !important;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding-left: 0px;
    padding-right: 0px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* Structure principale de l'application */
.aedivControlsCanva {
    display: flex;
    flex-direction: column;
    height: 100vh; /* Prend toute la hauteur de l'écran */
    width: 100vw;  /* Prend toute la largeur */
}

/* ========================================================================== */
/* ======================== 3. PANNEAUX DE CONTRÔLES ======================== */
/* ========================================================================== */
#controls {
    flex-shrink: 0; 
    display: flex;           
    flex-direction: column;  
    gap: 10px;
    top: env(safe-area-inset-top, 2px);
    left: 2px;
    z-index: 2;
    width: 100%;
    padding-top: env(safe-area-inset-top, 10px);
    padding-left: 0px;
    padding-right: auto;
}

#controls .row1,
#controls .row2 {
    position: relative; 
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); 
    width: 100%;
    justify-content: center;
    align-items: center; 
    display: flex; 
    gap: 10px; 
}

#controls .row1 {
    flex-wrap: nowrap; /* plus de retour à la ligne */
}

#controls .row2 {
    flex-wrap: wrap;
    left: 0px;
}

/* Pseudo-éléments pour la couleur de fond et la bordure des contrôles */
#controls .row1::before,
#controls .row2::before {
    content: ''; 
    position: absolute;
    left: 0;
    right: 0;
    z-index: -1; 
    background-color: rgba(238, 245, 251, 0.6); 
    border: 1px solid rgba(255, 255, 255, 0.5); 
    border-radius: inherit;
}

#controls .row1::before {
    top: 15px;      
    bottom: 15px;   
}

#controls .row2::before {
    top: 0px;      
    bottom: 1px;   
}

#controls .leftspacer {
    width: env(safe-area-inset-left, 2px);
}

.row3 {
    flex: 1; 
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative; 
}

#sheetCanvas {
    display: block;
    left: env(safe-area-inset-left, 0px);
    width: calc(100% - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
    z-index: 0;
}

#portraitMessage {
    display: none;
    position: absolute;
    color: red;
    font-size: 20px;
    text-align: center;
}

/* ========================================================================== */
/* ======================== 4. BOUTONS GLOBAUX ============================== */
/* ========================================================================== */
.btn-text {
    display: none; /* Cache complètement le texte */
}

.material-icons {
    font-size: 24px; 
    vertical-align: middle; 
}

/* Boutons principaux - style classique */
button.normal {
    background-color: var(--surface-dark);
    display: inline-block;
    padding: 10px 30px; 
    margin: 0.3em 0.2em;
    border: none;
    border-radius: 8px; 
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
    font-weight: 500; 
    color: #FFFFFF;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    text-align: center;
    font-size: 16px; 
    cursor: pointer;
    transition: all 0.3s ease; 
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); 
    position: relative;
    overflow: hidden;
    transform: translateY(0);
}

button.normal:hover {
    background: linear-gradient(95deg, #5A3FFF 60%, #6A4FFF 100%);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

button.normal:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Animation Ripple au clic */
button.normal::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 5px; height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

button.normal:focus:not(:active)::after {
    animation: ripple 0.6s ease-out;
}

@keyframes ripple {
    0% { transform: scale(0, 0); opacity: 0.5; }
    100% { transform: scale(20, 20); opacity: 0; }
}

/* --- Thème Sombre Pro (Nouvelle génération de boutons) --- */
.btn-pro {
    background-color: var(--surface-dark);
    color: var(--text-color);
    border: 1px solid transparent; 
    border-radius: 12px;           
    padding: 10px 10px;
    font-size: 16px;
    font-weight: 600;              
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px; 
    transition: all 0.2s ease-out;
    box-shadow: 0 4px 15px var(--shadow-color); 
    transform: translateY(0);
}

.btn-pro:hover {
    background-color: #3a3a52; 
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-color);
}

.btn-pro:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px var(--shadow-color);
}

.btn-pro.primary {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}

.btn-pro.primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 6px 20px var(--shadow-color), 0 0 25px var(--glow-color); 
}

.btn-pro.circular {
    bottom: -25px;      
    right: -25px;       
    width: 84px; height: 84px;
    padding: 20px;
    border-radius: 50%;
    font-size: 28px; 
}

/* Tiroir d'explorateur */
#openPartitionExplorer {
    position: relative; 
    border-radius: 0 12px 12px 0; 
    border: none;
    border-left: 10px solid var(--primary-color); 
    background: linear-gradient(145deg, #3a3a52, var(--surface-dark)); 
    color: var(--text-color);
    font-size: 16px; font-weight: 700; letter-spacing: 1px; 
    padding: 15px 25px 15px 20px;
    align-items: center; cursor: pointer;
    transform: translateX(0);
    box-shadow: 5px 0px 20px rgba(0,0,0,0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); 
}

#openPartitionExplorer::before {
    content: ''; display: inline-block;
    width: 38px; height: 30px;
    background-color: #FDD835; border-radius: 3px;
    margin-right: 15px; border-top: 5px solid rgba(0, 0, 0, 0.1);
    background-image: url('apple-touch-icon.png'); background-repeat: no-repeat;
    background-position: center; background-size: 30px; 
    overflow: hidden; 
}

#openPartitionExplorer:hover {
    transform: translateX(5px); 
    box-shadow: 8px 0px 25px rgba(0,0,0,0.5);
    border-left-color: var(--primary-hover);
}

#openPartitionExplorer:active {
    transform: translateX(2px);
    box-shadow: 3px 0px 15px rgba(0,0,0,0.4);
}

/* Bouton Copier URL */
#copyUrlButton {
    width: 48px; height: 48px; border-radius: 50%; 
    background: transparent; border: 2px solid var(--surface-dark); color: var(--text-color);
    display: inline-flex; align-items: center; justify-content: center; font-size: 20px;
    transition: all 0.2s ease-in-out;
}

#copyUrlButton:hover {
    background: var(--surface-dark); border-color: var(--primary-color); 
    color: var(--primary-hover); transform: scale(1.1); 
}

/* ========================================================================== */
/* ======================== 5. AUDIO, MIXAGE & ENREGISTREMENT =============== */
/* ========================================================================== */
.record-btn {
    /*background-color: #b71c1c; //pas rouge*/
    display: flex; align-items: center; gap: 4px;
}
.record-btn.recording {
    background-color: #d32f2f;
    box-shadow: 0 0 12px rgba(211, 47, 47, 0.6);
}
.record-btn.record-btn-unavailable,
.record-btn:disabled {
    background-color: #9e9e9e; cursor: not-allowed; box-shadow: none; color: rgba(255, 255, 255, 0.7);
}

.vu-meter {
    width: 120px; height: 12px; border-radius: 6px; background: rgba(0, 0, 0, 0.2);
    overflow: hidden; position: relative;
}
.vu-meter[aria-hidden="true"] { opacity: 0.4; }
.vu-meter[aria-hidden="false"] { opacity: 1; }

.vu-level {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, #4caf50 0%, #ffc107 60%, #f44336 100%);
    transition: width 0.1s ease-out;
}

/* Mixage et Sliders */
.swal2-mixing-controls {
    display: grid;
    grid-template-columns: minmax(150px, 220px) 1fr 50px; 
    align-items: center; gap: 15px; margin-bottom: 12px; 
}

.mixing-track-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; flex-wrap: wrap; row-gap: 4px; width: 100%;
}

.mixing-track-header .mixing-slider-label { flex: 1; }

.mixing-slider-label {
    flex-basis: 100px; flex-shrink: 0; text-align: right;
    font-size: 0.9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
}

.mixing-slider {
    flex-grow: 1; accent-color: var(--swal-primary-color); background: var(--swal-header-bg-color);
}

.mixing-slider-output {
    font-family: monospace; background-color: var(--swal-header-bg-color);
    padding: 4px 8px; border-radius: 4px; min-width: 25px; text-align: center;
    font-size: 1em; font-weight: bold; color: var(--primary-color);
}

.mixing-slider-output input[type="range"] {
    -webkit-appearance: none; appearance: none; width: 150px; height: 8px;
    background: var(--swal-header-bg-color); border-radius: 5px; outline: none;
}

.recording-actions { display: inline-flex; gap: 6px; }

.recording-action-btn {
    background: transparent; border: none; color: var(--text-color, #fff);
    cursor: pointer; padding: 4px; line-height: 1; border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.recording-action-btn:hover, .recording-action-btn:focus {
    background-color: rgba(255, 255, 255, 0.1); color: var(--primary-color, #00d8ff);
    outline: none; transform: scale(1.05);
}
.recording-action-btn .material-icons { font-size: 18px; }

/* Halo lumineux du slider personnalisé */
.slider-wrapper {
    position: relative; display: flex; align-items: center; height: 30px; 
}
.slider-wrapper::before {
    content: ''; position: absolute; top: 5px; left: -8px; right: -8px; bottom: 5px;
    border-radius: 50px; border: 2px solid var(--primary-color);
    box-shadow: 0 0 8px var(--primary-color), inset 0 0 5px rgba(0, 216, 255, 0.5);
    opacity: 0.7; transition: all 0.3s ease-in-out; pointer-events: none; 
}
.slider-wrapper:hover::before {
    opacity: 1; box-shadow: 0 0 15px var(--primary-color), 0 0 25px var(--primary-color), inset 0 0 5px rgba(0, 216, 255, 0.5);
    transform: scale(1.02);
}
.slider-wrapper input[type="range"] {
    -webkit-appearance: none; appearance: none; width: 100%; height: 12px; 
    background: transparent; outline: none; padding: 0; margin: 0;
}
.slider-wrapper input[type="range"]::-webkit-slider-runnable-track {
    width: 100%; height: 12px; cursor: pointer;
    background: linear-gradient(to right, #0055ff var(--slider-value, 50%), #00c8ff var(--slider-value, 50%), #1a1a1a var(--slider-value, 50%));
    border-radius: 20px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.6); 
}
.slider-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 34px; /* 🌟 Plus gros (était 24px) */
    width: 34px;  /* 🌟 Plus gros */
    border-radius: 50%;
    background: radial-gradient(circle at 65% 35%, white, #b8b8b8);
    box-shadow: 0 0 4px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.4);
    cursor: pointer;
    margin-top: -11px; /* 🌟 Centrage vertical : (12 piste - 34 bille)/2 = -11 */
    transition: transform 0.2s ease;
}
.slider-wrapper input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
.slider-wrapper input[type="range"]::-moz-range-thumb {
    height: 34px;
    width: 34px;
    border-radius: 50%;
    background: radial-gradient(circle at 65% 35%, white, #b8b8b8);
    box-shadow: 0 0 4px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.4);
    cursor: pointer;
}
/* ================================================================== */
/* STYLES COMPLÉMENTAIRES POUR LE SLIDER BPM                 */
/* ================================================================== */

/* 1. Conteneur principal dans la barre du haut */
/* ================================================================== */
/* STYLES COMPLÉMENTAIRES POUR LE SLIDER BPM                 */
/* ================================================================== */

/* 1. Le grand conteneur qui englobe le texte et le slider */
.bpm-container {
    display: block; /* On n'utilise PAS flex ici pour ne pas séparer les spans */
    text-align: center; /* Centre le texte et le slider */
    background: rgba(255, 255, 255, 0.5); /* Jolie bulle de protection */
    padding: 6px 12px;
    margin: 0 10px;
    border-radius: 12px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    border: none;
}

/* 2. Label "Pulsation :" */
.bpm-label {
    display: inline-block;
    vertical-align: middle;
    font-size: 1em;
    font-weight: 700;
    color: var(--bg-dark);
    margin: 0;
}

/* 3. Valeur "140 BPM" */
.bpm-value {
    display: inline-block;
    vertical-align: middle;
    font-family: monospace;
    font-size: 1.05em;
    font-weight: bold;
    color: var(--primary-color);
    background-color: #ffffff;
    padding: 2px 8px;
    border-radius: 6px;
    min-width: 70px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* 4. Conteneur du Slider (qui va se placer en dessous automatiquement) */
.bpm-slider-wrap {
    display: flex;
    justify-content: center;
    margin-top: 6px; /* L'espace vertical vital entre le texte et le slider ! */
}

/* 5. Taille stricte de la piste pour qu'elle ne s'écrase pas */
.bpm-slider-wrap .slider-wrapper {
    width: 130px; 
}

/* ========================================================================== */
/* ======================== 6. EXPLORATEUR DE PARTITIONS ==================== */
/* ========================================================================== */
#partitionModal {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5);
    z-index: 1003; overflow: hidden; 
}

#partitionModal .modal-content {
    position: absolute;
    top: calc(50% + env(safe-area-inset-top, 0px));
    left: calc(50% + env(safe-area-inset-left, 0px));
    transform: translate(-50%, -50%);
    background-color: white; border-radius: 5px;
    width: calc(95% - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));;
    max-width: 1200px; max-height: 95%;
    height: calc(95% - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    display: flex; flex-direction: column; overflow: hidden; min-height: 0; 
}

#partitionModal .modal-header {
    padding: 1px 20px; border-bottom: 1px solid #eee; flex-shrink: 0; 
}

#partitionModal .modal-list {
    overflow-y: auto; flex-grow: 1; padding: 10px 20px;
}

#partitionModal .partition-item {
    padding: 10px 0; border-bottom: 1px solid #f0f0f0;
}

#partitionModal ul {
    list-style: none; padding: 0; overflow-y: auto;
}

#partitionModal button { margin-top: 0px; }

/* Container de la liste (pour centrer les 98%) */
#partitionModal .accordion-content {
    padding-left: 0; 
    margin-top: 0; 
    width: 100%; 
    max-width: 100%; 
    box-sizing: border-box; 
    display: flex;
    flex-direction: column;
    align-items: center; /* Centre les éléments enfants */
}

/* Boutons de Dossiers (Collections / Instruments) */
button.folder-button {
    width: 100%; padding: 8px; margin: 2px 0;
    background-color: #e7f1ff; border: 2px solid #007bff; border-radius: 6px; color: #007bff;
    font-style: italic; font-weight: bold; font-size: 14px; text-align: left;
    cursor: pointer; transition: background-color 0.3s, transform 0.1s, box-shadow 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
button.folder-button:hover {
    background-color: #d0e4ff; transform: translateY(-1px); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
button.folder-button:active {
    transform: translateY(0); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button.folder-button-favorite {
    width: 100%; padding: 8px; margin: 2px 0; border-radius: 6px; text-align: left;
    font-style: italic; font-weight: bold; font-size: 14px;
    cursor: pointer; transition: background-color 0.3s, transform 0.1s, box-shadow 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: var(--swal-bg-favorite-color); color: var(--swal-font-favorite-color); border: 1px solid var(--swal-border-favorite-color);
}

button.folder-button::before, button.folder-button-favorite::before {
    content: '▶'; display: inline-block; margin-right: 8px; transition: transform 0.2s ease;
}
button.folder-button.active::before, button.folder-button-favorite.active::before {
    transform: rotate(90deg);
}

.collection-add, .collection-remove, .info-btn, .favorite-heart {
    flex-shrink: 0; padding: 4px; 
}

/* Icônes Menu et Sous-dossiers */
.collection-menu { cursor: pointer; font-size: 20px; margin-right: 6px; opacity: 0.7; }
.collection-menu:hover { opacity: 1; }
.collection-row { display: flex; justify-content: space-between; padding: 6px 0; }

.chooseVariantBtn {
    width: 40px !important; height: 30px !important; background-color: var(--surface-dark) !important;
    color: var(--text-color) !important; border: 1px solid transparent !important; border-radius: 4px !important;
    padding: 0px 0px !important; font-size: 10px !important; font-weight: 600 !important;
    cursor: pointer !important; text-decoration: none !important; align-items: center !important;
    justify-content: center !important; gap: 0px !important; transition: all 0.2s ease-out !important;
    box-shadow: 0 4px 15px var(--shadow-color) !important; transform: translateY(0) !important;
}
.btn-variant-icon { font-size: 10px; }

/* Animation du coeur */
.favorite-heart { margin-left: 0; margin-right: 10px; cursor: pointer; transition: all 0.2s; position: relative; }
.favorite-heart:hover svg { transform: scale(1.1); }
.favorite-heart.outline path { fill: #000000; stroke: #000000; stroke-width: 2; }
.favorite-heart.filled path { fill: rgb(241, 0, 0) !important; stroke: none; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }
.favorite-heart.pulsing svg { animation: pulse 0.5s ease-in-out; }
.favorite-heart.filled:hover::after, .favorite-heart.filled:hover::before {
    content: ''; position: absolute; width: 15px; height: 2px; background: rgb(241, 0, 0);
    top: 50%; left: 50%; margin-top: -1px; margin-left: -7.5px; animation: crossFade 0.3s ease-in-out forwards;
}
.favorite-heart.filled:hover::after { transform: rotate(45deg); }
.favorite-heart.filled:hover::before { transform: rotate(-45deg); }
@keyframes crossFade { 0% { transform: rotate(45deg) scale(0); opacity: 0; } 100% { transform: rotate(45deg) scale(1); opacity: 1; } }

.partition-button.invalid .favorite-heart path { fill: #888; cursor: not-allowed; }

/* Divers explorateur */
.search-icon { color: #00008B; fill: #00008B; }

#StartSignalBox {
    border: 2px solid #411FFF; border-radius: 8px; padding: 10px; background-color: #f9f9f9; 
    margin-bottom: 10px; display: flex; flex-direction: column; gap: 5px; 
}
#StartSignalBox div { display: flex; align-items: center; gap: 5px; }
#StartSignalBox label { margin: 0; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.currentPartitionQuestion, .currentPath {
	color: var(--swal-header-bg-color); text-align: left; font-size: 0.9em; white-space: nowrap;
}


/* ========================================================================== */
/* ======================== 7. POPUPS SWEETALERT2 =========================== */
/* ========================================================================== */
.swal2-container { z-index: 99999 !important; }
.swal-custom-icon-no-border { border: none !important; color: #666; }

/* Layout V2 */
.swal-popup-settings.swal2-popup {
    min-width: 600px !important; padding: 0 !important; 
    background: var(--swal-bg-color); color: var(--swal-text-color);
    display: flex; flex-direction: column; gap: 0px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
    border-radius: 0.5em; overflow: hidden;
}
.swal-custom-header {
    display: flex; align-items: center; gap: 20px;
    background-color: var(--swal-header-bg-color);
    padding: 2px 25px; width: 100%; box-sizing: border-box; 
}
.swal-custom-header h3 { margin-right: auto; font-size: 1.5em; font-weight: 600; white-space: nowrap; }

.swal-header-actions button {
    display: flex; align-items: center; gap: 6px; font-size: 0.9em; border: none; padding: 8px 15px; border-radius: 6px; white-space: nowrap; 
}
.swal-header-actions .swal2-confirm { background-color: var(--swal-primary-color); }
.swal-header-actions .swal2-cancel { background-color: var(--swal-secondary-color); }

.swal-custom-body { padding: 20px 25px; display: flex; flex-direction: column; gap: 12px; }
.swal2-html-container { padding: 0px !important; }
.swal-setting-row { display: flex; justify-content: space-between; align-items: center; gap: 15px; }

.swal-radio-group-inline label { white-space: nowrap; }
.swal-checkbox-group { display: flex; flex-direction: column; gap: 10px; margin-top: 5px; }
.swal-checkbox-inline-group { display: flex; justify-content: space-between; align-items: center; }

.swal-checkbox-item { position: relative; display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.swal-checkbox-item input[type="checkbox"] { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.custom-checkbox { display: inline-block; min-width: 20px; width: 20px; height: 20px; background-color: var(--swal-checkbox-bg); border-radius: 5px; transition: background-color 0.2s ease; }
.swal-checkbox-item input[type="checkbox"]:checked ~ .custom-checkbox {
    background-color: var(--swal-primary-color);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-size: 80%; background-position: center; background-repeat: no-repeat;
}

/* Modales Standard (v1) */
.popup-pro {
    background: rgba(44, 44, 62, 0.85) !important; border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important; color: var(--text-color) !important;
    width: clamp(320px, 90vw, 500px) !important;
}
.popup-header, .popup-actions { padding: 15px 20px; display: flex; align-items: center; flex-shrink: 0; }
.popup-header { justify-content: space-between; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.popup-header h3 { margin: 0; font-size: 1.2em; font-weight: 600; }
.popup-body { padding: 20px; overflow-y: auto; flex-grow: 1; }
.popup-actions { justify-content: flex-end; gap: 10px; background-color: rgba(0,0,0,0.1); border-top: 1px solid rgba(255, 255, 255, 0.1); }
.popup-close-btn { background: transparent; border: none; color: var(--text-color); font-size: 24px; cursor: pointer; padding: 5px; line-height: 1; opacity: 0.7; transition: opacity 0.2s ease, transform 0.2s ease; }
.popup-close-btn:hover { opacity: 1; transform: rotate(90deg); }

#mixingControls, #settingsControls { display: flex; flex-direction: column; gap: 15px; }
#mixingControls label, #settingsControls label { display: flex; justify-content: space-between; align-items: center; font-size: 1em; }
.swal2-title-pro { color: #EAEAFB !important; font-weight: 600; }

.swal2-actions { gap: 12px !important; justify-content: center !important; }
.swal2-styled { padding: 10px 20px !important; font-size: 16px !important; }

.swal2-cancel, .swal-btn-cancel { background-color: #e0e0e0 !important; color: #444 !important; }
.swal2-deny, .swal-btn-download { background-color: var(--primary-color) !important; color: white !important; }
.swal2-confirm, .swal-btn-print { background-color: #4caf50 !important; color: white !important; }

/* Swal Responsive QR */
.swal-popup-pro.responsive-qr {
  box-sizing: border-box; max-width: calc(100vw - 24px) !important; max-height: calc(100vh - 40px) !important;
  overflow: auto; padding: 12px !important;
}
.swal-popup-pro.responsive-qr #qrWrap {
  display: flex; justify-content: center; align-items: center; width: 100%;
  max-height: calc(100vh * 0.6); padding: 8px 0; box-sizing: border-box;
}
.swal-popup-pro.responsive-qr #qrCode {
  width: 100%; height: auto; max-width: 420px; max-height: calc(min(80vw, 60vh));
  display: flex; justify-content: center; align-items: center;
}
.swal-popup-pro.responsive-qr #qrCode img, .swal-popup-pro.responsive-qr #qrCode canvas { width: 100%; height: auto; display: block; }


/* ========================================================================== */
/* ======================== 8. STATUS RESEAU & UTILISATEUR ================== */
/* ========================================================================== */
#roomCodeInline { transition: border-color 0.25s ease, box-shadow 0.25s ease; }
.room-master { border: 2px solid #4CAF50 !important; box-shadow: 0 0 8px rgba(76, 175, 80, 0.7); }
.room-slave { border: 2px solid #7A5AF5 !important; box-shadow: 0 0 8px rgba(122, 90, 245, 0.7); }
.room-disconnected { border: 2px solid #FF4444 !important; box-shadow: 0 0 8px rgba(255, 68, 68, 0.7); }
.roomInlineWrapper { display: flex; flex-direction: column; align-items: center; gap: 1px; }

.user-info { display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding-right: 16px; height: 48px; }
.user-name-container { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.user-name-container i.material-icons { font-size: 24px; margin-bottom: 2px; }
#username-text { font-size: 14px; margin: 0; }
.user-info a.btn-pro { display: inline-flex; align-items: center; justify-content: center; font-size: 24px; color: inherit; text-decoration: none; }


/* ========================================================================== */
/* ======================== 9. ANIMATIONS & CHARGEMENT ====================== */
/* ========================================================================== */
@keyframes beat { 0% { transform: scale(1); } 50% { transform: scale(1.5); } 100% { transform: scale(1); } }
.cursor { position: absolute; width: 4px; height: 100%; background-color: red; animation: beat 0.5s infinite; transform-origin: bottom; }
.z-index-max { z-index: 99999 !important; }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.loading-spinner {
    width: 50px; height: 50px; border: 5px solid #f3f3f3; border-top: 5px solid #3498db; border-radius: 50%;
    animation: spin 1s linear infinite; position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 9998; 
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.notification { font-family: 'Montserrat', sans-serif; font-size: 14px; font-weight: 500; animation: fadeIn 0.3s ease-out; max-width: 350px; word-wrap: break-word; }

.progress-container { position: fixed; top: 80%; left: 50%; transform: translateX(-50%); width: 60%; max-width: 500px; z-index: 1001; text-align: center; }
.progress-bar { width: 100%; height: 20px; background-color: #e0e0e0; border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background-color: #3498db; transition: width 0.3s; border-radius: 10px; }
.progress-text { color: var(--text-color); font-size: 12px; line-height: 20px; position: absolute; width: 100%; text-align: center; pointer-events: none; }
.progress-info { color: var(--text-color, #ffffff); background-color: rgba(44, 44, 62, 0.95); font-size: 14px; margin-top: 15px; margin-bottom: 10px; padding: 8px 16px; border-radius: 8px; display: inline-block; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3); }


/* ========================================================================== */
/* ======================== 10. MEDIA QUERIES (MOBILE) ====================== */
/* ========================================================================== */

@media (max-width: 900px), (max-width: 768px) and (orientation: landscape) {
    #username-text { display: none; }
    
    #controls .row1 {
        height: 70px;
        justify-content: left;
    }

    /* Animation yoyo (va-et-vient) pour textes longs */
    @keyframes yoyoScroll {
        0% { transform: translateX(0); }
        50% { transform: translateX(-100%); } 
        100% { transform: translateX(0); }     
    }
    .scrolling-yoyo {
        animation: yoyoScroll 8s linear infinite; 
    }
    .partition-button:hover .scrolling-yoyo {
        animation-play-state: paused;
    }

    /* Boutons principaux */
    button.normal {
        padding: 10px 10px; 
        margin: 0.1em 0.1em;
    }

    /* Boutons plus compacts */
    .btn-pro,
    #openPartitionExplorer,
    #copyUrlButton,
    .record-btn {
        padding: 6px 10px;
        font-size: 13px;
        min-width: auto;
    }

    /* On supprime uniquement les textes longs pour gagner de la place (On garde Mix !) */
	  #recordBtn .btn-text,
	  #printBtn .btn-text,
	  #settingsBtn .btn-text {
		display: none !important;
	  }
	  
	  /* Sécurité pour garantir que Mix reste affiché */
	  #mixBtn .btn-text {
		  display: inline !important;
	  }

    /* Play rond un peu plus petit */
    .btn-pro.circular {
        width: 64px;
        height: 64px;
        padding: 12px;
        font-size: 24px;
    }

    /* Amélioration de la lisibilité des partitions via "rem" */
    button.folder-button, 
    button.folder-button-favorite {
        font-size: 1rem !important; 
        padding: 0.875rem 0.75rem !important; 
        margin-bottom: 0.5rem; 
    }

    /* Bouton de Tri */
    #sortMenuBtn {
        padding: 0.5rem 0.75rem; 
        min-height: 2.5rem; 
    }
    
    #activeSortLabel {
        font-size: 1rem !important; 
    }
}

/* ================================================================== */
/* BOUTON D'UNE PISTE (PARTITIONS)                   */
/* ================================================================== */

/* Container de la liste (pour centrer les 98%) */
#partitionModal .accordion-content {
    padding-left: 0; 
    margin-top: 0; 
    width: 100%; 
    max-width: 100%; 
    box-sizing: border-box; 
    display: flex;
    flex-direction: column;
    align-items: center; /* Centre les éléments enfants */
}

/* Bouton principal de la partition */
button.partition-button {
    display: flex;
    align-items: center;
    width: 98%; /* 98% de la largeur totale */
    margin: 4px auto; 
    box-sizing: border-box; 
    gap: 8px; 
    overflow: hidden; 
    
    background-color: #ffffff; /* Blanc pur */
    border: 1px solid #ced4da;
    border-radius: 6px;
    color: #000;
    font-size: 16px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

button.partition-button:hover {
    background-color: var(--swal-header-bg-color);
    color: var(--text-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button.partition-button:active { 
    transform: translateY(0); 
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Le texte de la partition */
.partition-label,
button.partition-button > span:not([class]) {
    flex: 1; /* Pousse les icônes (➖, ➕) à droite ! */
    overflow: hidden; 
    white-space: nowrap !important; 
    text-overflow: ellipsis; 
    text-align: left;
    padding-left: 5px;
    display: block; 
}

/* Les petits boutons d'action (Info, Favoris, Ajouter, Retirer) */
.collection-add, 
.collection-remove, 
.info-btn, 
.favorite-heart {
    flex-shrink: 0; /* Processus technique : Interdit au texte d'écraser les icônes */
    padding: 4px; 
    cursor: pointer;
}
#fullscreen-btn {
      position: fixed;
      top: 15px;
      right: 20px;
      width: 50px;
      height: 50px;
      border-radius: 50%;
      background: linear-gradient(45deg, #ffd700, #ffed4e);
      border: 3px solid rgba(255, 255, 255, 0.5);
      color: #333;
      font-size: 1.3rem;
      cursor: grab;
      z-index: 9999;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
      display: flex; /* <-- C'est pour ça qu'on utilise 'flex' dans le JS ! */
      align-items: center;
      justify-content: center;
      transition: transform 0.2s, box-shadow 0.2s;
      user-select: none;
      
      /* 🌟 NOUVEAU : Empêche l'écran de scroller quand on glisse le bouton sur mobile */
      touch-action: none; 
    }

    #fullscreen-btn:hover {
      transform: scale(1.1);
      box-shadow: 0 6px 30px rgba(255, 215, 0, 0.6);
    }

    #fullscreen-btn:active {
      cursor: grabbing;
      transform: scale(0.95);
    }

    #fullscreen-btn.dragging {
      opacity: 0.8;
      transition: none;
    }

    @media (max-width: 768px) {
      #fullscreen-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
      }
    }
	
/* =========================================================
   STYLE DE LA POPUP ACCORDEUR
   ========================================================= */
/* =========================================================
   STYLE DE LA POPUP ACCORDEUR (Mise à jour)
   ========================================================= */
.swal-tuner-app {
    --blue: #4285F4;
    --green: #00c853;
    --red: #ff5252;
    --panel: #1a1a1a;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 10px;
    color: #fff;
    font-family: 'Segoe UI', Roboto, sans-serif;
}

/* Header avec Toggle RefHz */
.swal-tuner-app .tuner-header { background: var(--panel); padding: 10px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; }
.swal-tuner-app .ref-container { display: flex; align-items: center; gap: 8px; }
.swal-tuner-app #tuner-btn-ref-toggle { background: #333; border: 1px solid var(--blue); color: white; padding: 5px 10px; border-radius: 6px; cursor: pointer; font-weight: bold; min-width: 80px; }
.swal-tuner-app #tuner-refHz { width: 55px; background: #222; border: 1px solid #444; color: white; text-align: center; border-radius: 5px; padding: 4px; transition: all 0.3s; }
.swal-tuner-app #tuner-refHz:disabled { opacity: 0.5; border-color: transparent; }

/* Zone d'affichage et Animation */
.swal-tuner-app .tuner-main-display { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 20px 0; transition: all 0.2s; }
.swal-tuner-app #tuner-note-fr { font-size: 6rem; font-weight: 900; color: var(--blue); margin: 0; line-height: 1; z-index: 2; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.swal-tuner-app #tuner-note-us { font-size: 2rem; color: #f4b400; font-weight: bold; z-index: 2; }
.swal-tuner-app #tuner-freq { color: #888; font-family: monospace; margin-top: 10px; font-size: 1.2rem; z-index: 2; }

/* Particules de stabilité */
.swal-tuner-app #tuner-stability-fx { position: absolute; width: 300px; height: 300px; pointer-events: none; z-index: 1; }
.swal-tuner-app .tuner-main-display.success #tuner-note-fr { color: var(--green); transform: scale(1.1); text-shadow: 0 0 50px rgba(0,200,83,0.6); }

/* Panneau droit et Jauge */
.swal-tuner-app .tuner-right-panel { display: flex; flex-direction: column; gap: 15px; }
.swal-tuner-app .tuner-stability-container { width: 100%; height: 8px; background: #222; border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.swal-tuner-app #tuner-stability-bar { width: 0%; height: 100%; background: var(--green); transition: width 0.1s; }
.swal-tuner-app #tuner-gauge { width: 100%; height: 60px; background: #111; border-radius: 8px; }

/* Contrôles */
.swal-tuner-app .tuner-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.swal-tuner-app .tuner-btn { border: none; padding: 12px 5px; border-radius: 8px; font-weight: bold; color: white; background: #222; font-size: 0.9rem; cursor: pointer;}
.swal-tuner-app .tuner-btn-start { background: var(--blue); grid-column: span 2; font-size: 1.1rem; padding: 15px; }
.swal-tuner-app .tuner-btn-transpo.active { background: #f4b400; color: #000; }
.tuner-border-violet {
    border: 3px solid #9933ff !important;
    box-shadow: 0 0 20px rgba(153, 51, 255, 0.4);
}