.pm-bdv4-wrap {
    width: 100%;
    max-width: 960px;
    margin: 0 auto 40px;
}

.pm-bdv4-wrap * {
    box-sizing: border-box;
}


/* PLAYER */

.pm-bdv4-player {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    border-radius: 12px;
    background: #111;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    display: none;
    margin-bottom: 20px;
}


/* CERCA + TOTALE */

.pm-bdv4-search-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.pm-bdv4-search {
    flex: 1;
}

.pm-bdv4-search input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #d5d5d5;
    border-radius: 9px;
    background: #fff;
    color: #222;
    font-size: 16px;
    outline: none;
}

.pm-bdv4-search input:focus {
    border-color: #999;
}

.pm-bdv4-total {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 9px 13px;
    border-radius: 8px;
    background: #f2f2f2;
    color: #555;
    font-size: 14px;
    font-weight: 600;
}


/* MESSAGGIO */

.pm-bdv4-message {
    margin-bottom: 20px;
    padding: 11px 14px;
    border-radius: 8px;
    background: #f3f3f3;
    color: #333;
    font-size: 14px;
}


/* PLAYLIST */

.pm-bdv4-playlist {
    display: grid;
    gap: 12px;
}

.pm-bdv4-track {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 82px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,.10);
    cursor: pointer;
}

.pm-bdv4-track:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,.14);
}

.pm-bdv4-thumb {
    width: 120px;
    height: 68px;
    object-fit: cover;
    flex: 0 0 120px;
    margin: 7px;
    border-radius: 7px;
}

.pm-bdv4-info {
    flex: 1;
    min-width: 0;
    padding: 10px 8px 10px 4px;
}

.pm-bdv4-title {
    font-size: 15px;
    line-height: 1.35;
    color: #333;
    font-weight: 600;
    word-break: break-word;
}

.pm-bdv4-index {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #888;
}


/* CONTROLLI */

.pm-bdv4-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 8px 0 4px;
    flex-shrink: 0;
}

/* Maniglia per trascinare e riordinare (solo amministratori). */
.pm-bdv4-drag-handle {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 7px;
    background: #f7f7f7;
    color: #555;
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.pm-bdv4-drag-handle:active {
    cursor: grabbing;
}

.pm-bdv4-track.pm-bdv4-dragging {
    opacity: .55;
    outline: 2px dashed #ff8c00;
}

.pm-bdv4-sort-form {
    display: none !important;
}

.pm-bdv4-sort-hint {
    margin: 0 0 12px;
    color: #777;
    font-size: 12px;
    line-height: 1.4;
}

.pm-bdv4-form {
    margin: 0;
    padding: 0;
}

.pm-bdv4-mini,
.pm-bdv4-remove {
    border: none;
    cursor: pointer;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pm-bdv4-mini {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: #eee;
    color: #333;
    font-size: 15px;
}

.pm-bdv4-remove {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #d63384;
    color: #fff;
    font-size: 18px;
}


/* AGGIUNTA */

.pm-bdv4-add {
    margin-top: 22px;
    padding: 18px;
    border-radius: 10px;
    background: #f7f7f7;
    border: 1px solid #e5e5e5;
}

.pm-bdv4-add-title {
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 700;
    color: #222;
}

.pm-bdv4-add-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pm-bdv4-add input[type="text"] {
    flex: 1 1 240px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    color: #222;
    font-size: 14px;
}

.pm-bdv4-add-button {
    border: none;
    background: #ff8c00;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}

.pm-bdv4-empty,
.pm-bdv4-no-results {
    padding: 16px;
    text-align: center;
    color: #777;
    background: #f7f7f7;
    border-radius: 10px;
}

.pm-bdv4-no-results {
    display: none;
    background: transparent;
}


/* MOBILE */

@media (max-width: 700px) {

    .pm-bdv4-search-row {
        gap: 8px;
    }

    .pm-bdv4-total {
        font-size: 13px;
        padding: 9px 10px;
    }

    .pm-bdv4-thumb {
        width: 100px;
        height: 58px;
        flex-basis: 100px;
    }

    .pm-bdv4-title {
        font-size: 14px;
    }

    .pm-bdv4-controls {
        flex-direction: column;
    }

    .pm-bdv4-mini,
    .pm-bdv4-remove {
        width: 28px;
        height: 28px;
    }

    .pm-bdv4-add {
        padding: 14px;
    }

    .pm-bdv4-add-button {
        width: 100%;
    }
}
