/* ========== Footer Player ========== */

.wcp-footer-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
}

.wcp-player-inner {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    max-width: 1200px;
    margin: 0 auto;
    gap: 16px;
}

/* Cover Image - 16:9 */
.wcp-player-cover {
    flex-shrink: 0;
    width: 86px;
    border-radius: 8px;
    overflow: hidden;
    background: #2a2a4a;
    position: relative;
}

.wcp-player-cover img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.wcp-cover-placeholder {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
}

.wcp-cover-placeholder svg {
    width: 28px;
    height: 28px;
}

/* Track Info */
.wcp-player-info {
    flex: 1;
    min-width: 0;
}

.wcp-player-text {
    margin-bottom: 6px;
}

.wcp-track-title {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.wcp-track-artist-footer {
    display: none;
}

/* Progress Bar */
.wcp-progress-bar {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    margin-bottom: 4px;
    cursor: pointer;
}

.wcp-progress-bar:hover {
    height: 6px;
}

.wcp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e94560, #ff6b81);
    border-radius: 2px;
    width: 0;
    transition: width 0.1s linear;
    pointer-events: none;
}

.wcp-seek-slider {
    position: absolute;
    top: -6px;
    left: 0;
    width: 100%;
    height: 16px;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    -webkit-appearance: none;
    appearance: none;
}

/* Time Info */
.wcp-time-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

/* Controls */
.wcp-player-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.wcp-ctrl-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    line-height: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wcp-ctrl-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.wcp-ctrl-btn svg {
    display: block;
}

.wcp-play-pause-btn {
    width: 48px;
    height: 48px;
    background: #e94560;
    border-radius: 50%;
    color: #fff;
    box-shadow: 0 2px 12px rgba(233, 69, 96, 0.4);
    transition: all 0.2s;
}

.wcp-play-pause-btn:hover {
    background: #d63851;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(233, 69, 96, 0.5);
}

.wcp-play-pause-btn svg {
    width: 24px;
    height: 24px;
}

/* Volume */
.wcp-player-volume {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.wcp-volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.wcp-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e94560;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.wcp-volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e94560;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.wcp-volume-slider::-moz-range-track {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    height: 4px;
}

/* Close Button */
.wcp-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
    line-height: 0;
    border-radius: 50%;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wcp-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Body padding khi player active */
body.wcp-player-active {
    padding-bottom: 80px;
}

/* Play Button (shortcode playlist) */
.wcp-play-btn {
    width: 42px;
    height: 42px;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(233, 69, 96, 0.3);
    transition: all 0.3s;
    line-height: 0;
}

.wcp-play-btn:hover {
    background: #d63851;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(233, 69, 96, 0.4);
}

.wcp-play-btn .wcp-icon-play svg {
    width: 18px;
    height: 18px;
}

/* ========== Shortcode Playlist ========== */

.wcp-playlist-container {
    margin: 16px 0;
}

.wcp-playlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    border-radius: 12px;
    margin-bottom: 16px;
}

.wcp-playlist-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.wcp-play-playlist-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e94560;
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(233, 69, 96, 0.3);
    line-height: 1;
}

.wcp-play-playlist-btn:hover {
    background: #d63851;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(233, 69, 96, 0.4);
}

.wcp-play-playlist-btn .wcp-icon-play svg {
    width: 16px;
    height: 16px;
}

/* Playlist Tracks Grid */
.wcp-playlist-tracks {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Playlist Track Card */
.wcp-playlist-track {
    display: flex;
    align-items: stretch;
    gap: 14px;
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: all 0.3s ease;
}

.wcp-playlist-track:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Track Cover Image - 16:9 */
.wcp-track-img {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    flex-shrink: 0;
    width: 180px;
}

.wcp-track-img img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    transition: transform 0.4s ease;
}

.wcp-playlist-track:hover .wcp-track-img img {
    transform: scale(1.05);
}

/* Track No Cover */
.wcp-track-img .wcp-no-cover {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #f0f0f0, #e0e0e0);
    border-radius: 10px;
    position: relative;
}

/* Track Content */
.wcp-track-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.wcp-track-name {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 4px 0;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wcp-track-artist {
    font-size: 13px;
    color: #888;
    margin-bottom: 6px;
}

/* Track Bottom */
.wcp-track-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #f0f0f0;
    margin-top: 8px;
    padding-top: 8px;
}

.wcp-track-info {
    color: #999;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wcp-track-info .wcp-icon-music svg {
    width: 14px;
    height: 14px;
    color: #e94560;
}

/* Track Play Button */
.wcp-track-play .wcp-play-btn {
    width: 38px;
    height: 38px;
}

.wcp-track-play .wcp-play-btn .wcp-icon-play svg {
    width: 16px;
    height: 16px;
}

/* ========== SVG Icon Global Styles ========== */

.wcp-icon-play,
.wcp-icon-music {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

/* ========== AJAX Loading ========== */

.wcp-loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* ========== Responsive ========== */

@media (max-width: 991px) {
    .wcp-playlist-tracks {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    /* Playlist Track: layout dọc */
    .wcp-playlist-track {
        flex-direction: column;
        align-items: stretch;
    }

    .wcp-track-img {
        width: 100%;
    }

    .wcp-track-img img {
        width: 100%;
    }
}

@media (max-width: 600px) {

    /* ===== MINI BAR (mặc định trên mobile) ===== */

    .wcp-player-inner {
        display: grid;
        grid-template-columns: 40px 1fr auto auto;
        grid-template-rows: 3px auto;
        grid-template-areas:
            "progress progress progress progress"
            "cover    title    controls close";
        align-items: center;
        padding: 0 8px 8px 8px;
        gap: 0 8px;
    }

    /* Player info: dissolve wrapper để con tham gia grid */
    .wcp-player-info {
        display: contents;
    }

    /* Progress bar: thanh mỏng full-width trên cùng */
    .wcp-progress-bar {
        grid-area: progress;
        height: 3px;
        margin: 0;
        border-radius: 0;
    }

    .wcp-progress-bar:hover {
        height: 5px;
    }

    /* Mini bar: seek slider chỉ nằm trong row progress, không tràn xuống row cover/title */
    .wcp-footer-player:not(.wcp-expanded) .wcp-seek-slider {
        top: 0;
        height: 3px;
        pointer-events: none;
    }

    /* Title */
    .wcp-player-text {
        grid-area: title;
        margin: 0;
        min-width: 0;
        cursor: pointer;
    }

    .wcp-track-title {
        font-size: 13px;
    }

    .wcp-track-artist-footer {
        display: none;
    }

    /* Cover: 40x40 vuông */
    .wcp-player-cover {
        grid-area: cover;
        width: 40px;
        height: 40px;
        border-radius: 6px;
        cursor: pointer;
    }

    .wcp-player-cover img {
        aspect-ratio: 1 / 1;
        height: 100%;
    }

    .wcp-cover-placeholder {
        aspect-ratio: 1 / 1;
        height: 100%;
    }

    .wcp-cover-placeholder svg {
        width: 20px;
        height: 20px;
    }

    /* Controls */
    .wcp-player-controls {
        grid-area: controls;
        gap: 2px;
    }

    .wcp-play-pause-btn {
        width: 36px;
        height: 36px;
        box-shadow: none;
    }

    .wcp-play-pause-btn svg {
        width: 18px;
        height: 18px;
    }

    /* Mini: luôn ẩn prev */
    .wcp-footer-player:not(.wcp-expanded) #wcp-prev {
        display: none !important;
    }

    /* Close */
    .wcp-close-btn {
        grid-area: close;
    }

    /* Ẩn: time, volume */
    .wcp-time-info {
        display: none;
    }

    .wcp-player-volume {
        display: none;
    }

    body.wcp-player-active {
        padding-bottom: 55px;
    }

    /* ===== EXPANDED STATE ===== */

    .wcp-footer-player.wcp-expanded {
        height: 100vh;
        height: 100dvh;
        background: linear-gradient(180deg, #0d0d1a 0%, #1a1a2e 40%, #16213e 100%);
    }

    .wcp-footer-player.wcp-expanded .wcp-player-inner {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 60px 24px 32px 24px;
        gap: 0;
        /*height: 100%;*/
    }

    /* Expanded: cover lớn, 16:9 — reset grid-area từ mini bar */
    .wcp-footer-player.wcp-expanded .wcp-player-cover {
        grid-area: unset;
        width: 80%;
        max-width: 320px;
        height: auto;
        border-radius: 12px;
        cursor: default;
        margin-bottom: 24px;
        order: 1;
    }

    .wcp-footer-player.wcp-expanded .wcp-player-cover img {
        aspect-ratio: 16 / 9;
        height: auto;
    }

    .wcp-footer-player.wcp-expanded .wcp-cover-placeholder {
        aspect-ratio: 16 / 9;
        height: auto;
    }

    .wcp-footer-player.wcp-expanded .wcp-cover-placeholder svg {
        width: 48px;
        height: 48px;
    }

    /* Expanded: player-info trở lại flex bình thường — không còn display:contents */
    .wcp-footer-player.wcp-expanded .wcp-player-info {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        order: 2;
    }

    .wcp-footer-player.wcp-expanded .wcp-player-text,
    .wcp-footer-player.wcp-expanded .wcp-progress-bar {
        grid-area: unset;
    }

    /* Expanded: title lớn, hiện artist */
    .wcp-footer-player.wcp-expanded .wcp-player-text {
        text-align: center;
        margin-bottom: 24px;
        width: 100%;
        cursor: default;
    }

    .wcp-footer-player.wcp-expanded .wcp-track-title {
        font-size: 20px;
        font-weight: 700;
        white-space: normal;
        overflow: visible;
        text-overflow: initial;
        line-height: 1.4;
    }

    .wcp-footer-player.wcp-expanded .wcp-track-artist-footer {
        display: block;
        font-size: 14px;
        color: rgba(255, 255, 255, 0.6);
        margin-top: 4px;
    }

    /* Expanded: progress bar + seek slider hoạt động bình thường */
    .wcp-footer-player.wcp-expanded .wcp-progress-bar {
        height: 4px;
        border-radius: 2px;
        margin-bottom: 6px;
        width: 100%;
    }

    .wcp-footer-player.wcp-expanded .wcp-progress-bar:hover {
        height: 6px;
    }

    .wcp-footer-player.wcp-expanded .wcp-seek-slider {
        top: -6px;
        height: 16px;
        pointer-events: auto;
    }

    /* Expanded: hiện time info */
    .wcp-footer-player.wcp-expanded .wcp-time-info {
        display: flex;
        width: 100%;
        justify-content: space-between;
        font-size: 12px;
        color: rgba(255, 255, 255, 0.5);
        margin-bottom: 24px;
    }

    /* Expanded: controls đầy đủ — reset grid-area từ mini bar */
    .wcp-footer-player.wcp-expanded .wcp-player-controls {
        display: flex;
        grid-area: unset;
        order: 3;
        gap: 20px;
    }

    .wcp-footer-player.wcp-expanded .wcp-play-pause-btn {
        width: 56px;
        height: 56px;
        box-shadow: 0 2px 12px rgba(233, 69, 96, 0.4);
    }

    .wcp-footer-player.wcp-expanded .wcp-play-pause-btn svg {
        width: 28px;
        height: 28px;
    }

    .wcp-footer-player.wcp-expanded .wcp-ctrl-btn svg {
        width: 24px;
        height: 24px;
    }

    /* Expanded: hiện volume */
    .wcp-footer-player.wcp-expanded .wcp-player-volume {
        display: flex;
        order: 4;
        margin-top: 24px;
        gap: 8px;
    }

    .wcp-footer-player.wcp-expanded .wcp-volume-slider {
        width: 120px;
    }

    /* Expanded: nút X = collapse (thu nhỏ), đặt góc trên phải */
    .wcp-footer-player.wcp-expanded .wcp-close-btn {
        position: absolute;
        grid-area: unset;
        top: 16px;
        right: 16px;
    }

    /* Body khi expanded */
    body.wcp-player-expanded {
        padding-bottom: 0;
        overflow: hidden;
    }

    /* ===== Shortcode responsive ===== */

    .wcp-track-name {
        font-size: 15px;
    }

    .wcp-playlist-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}
