/**
 * Barre audio persistante KMP Comparator
 * Version nettoyée - Compatible système pistes multiples
 */

/* Barre principale */
.kmp-comparator-persistent-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.95), rgba(26, 26, 26, 0.35));
    color: white;
    padding: 12px 20px;
    z-index: 99999;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
    display: none;
}

.kmp-comparator-bar-content {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
    padding-left: 30px;
}

/* Zone cover avec animation CD */
.kmp-comparator-bar-cover {
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}

.kmp-comparator-bar-cover-img {
    width: 100px;
    height: 100px;
    border-radius: 6px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 2;
}

/* Zone centre */
.kmp-comparator-bar-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.kmp-comparator-bar-top-row {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.kmp-comparator-bar-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.kmp-comparator-bar-controls button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.kmp-comparator-bar-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
}

.kmp-comparator-bar-controls button:active {
    transform: scale(0.95);
}

/* Bouton play/pause avec Unicode Font Awesome */
.kmp-comparator-bar-play-pause {
    background: #0073aa !important;
    border-color: #005177 !important;
    position: relative;
}

.kmp-comparator-bar-play-pause:hover {
    background: #005177 !important;
}

.kmp-comparator-bar-play-pause .fa-play,
.kmp-comparator-bar-play-pause .fa-pause {
    display: none !important;
}

.kmp-comparator-bar-play-pause::before {
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    font-size: 18px;
    line-height: 1;
    display: inline-block;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

.kmp-comparator-bar-play-pause::before {
    content: "\f04b";
}

.kmp-comparator-bar-play-pause.playing::before {
    content: "\f04c";
}

.kmp-comparator-bar-play-pause.paused::before {
    content: "\f04b";
}


/* Bouton jump - même style que le bouton mute */
.kmp-comparator-bar-jump {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    width: 35px !important;
    height: 35px !important;
    border-radius: 50% !important;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kmp-comparator-bar-jump:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}


/* Info piste active */
.kmp-comparator-bar-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0px;
}

.kmp-comparator-bar-title {
    display: block;
    font-weight: bold;
    font-size: 22px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0;
    line-height: 1.1;
}

.kmp-comparator-bar-artist {
    display: block;
    font-size: 18px;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0;
    line-height: 1.1;
}

.kmp-comparator-bar-track-indicator {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
}

/* Barre de progression */
.kmp-comparator-bar-progress-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.kmp-comparator-bar-time-current,
.kmp-comparator-bar-time-total {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    min-width: 35px;
    text-align: center;
}

.kmp-comparator-bar-progress-wrapper {
    flex: 1;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.kmp-comparator-bar-progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    position: relative;
    cursor: pointer;
}

.kmp-comparator-bar-progress-bar {
    height: 100%;
    background: linear-gradient(to right, #0066cc, #0099ff);
    border-radius: 8px;
    width: 0%;
    transition: width 0.1s ease;
    position: relative;
}

.kmp-comparator-bar-progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.kmp-comparator-bar-progress-wrapper:hover .kmp-comparator-bar-progress-bar::after {
    opacity: 1;
}

/* Zone droite */
.kmp-comparator-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Volume */
.kmp-comparator-bar-volume {
    display: flex;
    align-items: center;
    gap: 10px;
}

.kmp-comparator-bar-mute {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    width: 35px !important;
    height: 35px !important;
    border-radius: 50% !important;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kmp-comparator-bar-mute:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

.kmp-comparator-bar-volume-slider {
    width: 80px;
    height: 6px;
    border-radius: 2px;
    background: #5d2727 !important;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.kmp-comparator-bar-volume-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 16px !important;
    height: 16px !important;
    border-radius: 50% !important;
    background: white !important;
    cursor: pointer;
    border: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.kmp-comparator-bar-volume-slider::-moz-range-thumb {
    width: 16px !important;
    height: 16px !important;
    border-radius: 50% !important;
    background: white !important;
    cursor: pointer;
    border: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Bouton fermer */
.kmp-comparator-bar-close {
    background: transparent !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 24px !important;
    cursor: pointer;
    padding: 5px 10px !important;
    line-height: 1;
    transition: color 0.3s ease;
}

.kmp-comparator-bar-close:hover {
    color: white !important;
}

/* Animation CD */
.kmp-comparator-bar-cd-animation {
    position: absolute;
    top: 50%;
    left: -30%;
    transform: translateY(-50%);
    z-index: 1;
    width: 80px;
    height: 80px;
}

.kmp-comparator-bar-cd-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-image: url('/wp-content/plugins/kmp-comparator/assets/images/vinyl-anm.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    animation: cdRotate 3s linear infinite;
    animation-play-state: paused;
    position: relative;
}

@keyframes cdRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.kmp-comparator-bar-cd-animation.playing .kmp-comparator-bar-cd-img {
    animation-play-state: running;
}

.kmp-comparator-bar-cd-animation.paused .kmp-comparator-bar-cd-img {
    animation-play-state: paused;
}

/* Animations d'apparition */
.kmp-comparator-persistent-bar.show {
    display: block !important;
    animation: slideDown 0.4s ease-out;
}

.kmp-comparator-persistent-bar.hide {
    animation: slideUp 0.3s ease-in;
}

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

@keyframes slideUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

body.kmp-comparator-bar-active {
    padding-top: 85px !important;
    transition: padding-top 0.4s ease;
}

.kmp-comparator-bar-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .kmp-comparator-bar-content {
        gap: 10px;
        padding-left: 20px;
    }
    
    .kmp-comparator-bar-top-row {
        gap: 10px;
    }
    
    .kmp-comparator-bar-title,
    .kmp-comparator-bar-artist {
        font-size: 14px;
    }
    
    .kmp-comparator-bar-volume-slider {
        width: 60px;
    }
    
    .kmp-comparator-bar-controls {
        gap: 5px;
    }
    
    .kmp-comparator-bar-controls button {
        width: 35px;
        height: 35px;
    }
    
    .kmp-comparator-bar-progress-container {
        gap: 6px;
    }
    
    .kmp-comparator-bar-time-current,
    .kmp-comparator-bar-time-total {
        font-size: 10px;
        min-width: 30px;
    }
    
    .kmp-comparator-bar-progress-wrapper {
        height: 16px;
    }
    
    .kmp-comparator-bar-cd-animation {
        width: 70px;
        height: 70px;
        left: -25%;
    }
}

@media (max-width: 480px) {
    .kmp-comparator-bar-content {
        padding-left: 15px;
    }
    
    .kmp-comparator-bar-cd-animation {
        width: 50px;
        height: 50px;
        left: 8px;
        top: 8px;
        transform: none;
    }
    
    .kmp-comparator-bar-title {
        font-size: 12px;
    }
    
    .kmp-comparator-bar-artist {
        font-size: 11px;
    }
}