/**
 * Spirit Music Player Styles
 */

/* Player Container */
.smp-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #202326;
    color: #fff;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: none;
}

.smp-player.smp-player-visible {
    display: block;
}

.smp-player-container {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    max-width: 1400px;
    margin: 0 auto;
    gap: 24px;
}

/* Track Info */
.smp-track-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
    flex-shrink: 0;
    font-family: 'Poppins', sans-serif;
}

.smp-track-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

.smp-track-cover {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    overflow: hidden;
    background: #2a2a4a;
}

.smp-track-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.smp-track-details {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.smp-track-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.smp-track-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

.smp-track-title-download {
    padding: 4px;
    border-radius: 6px;
    color: #a0a0b0;
    flex-shrink: 0;
}

.smp-track-download-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Keep title-side download hidden on desktop */
.smp-download-mobile {
    display: none !important;
}

.smp-track-artist {
    font-size: 12px;
    color: #a0a0b0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Controls */
.smp-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.smp-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smp-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.smp-btn svg {
    fill: currentColor;
}

.smp-btn-play {
    background: #3894D2;
    width: 48px;
    height: 48px;
}

.smp-btn-play:hover {
    background: #3894D2;
}

/* Progress Bar */
.smp-progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.smp-time-current,
.smp-time-total {
    font-size: 12px;
    color: #a0a0b0;
    min-width: 40px;
    text-align: center;
}

.smp-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.smp-progress {
    height: 100%;
    background: #3894d2;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.smp-progress-input {
    position: absolute;
    top: -6px;
    left: 0;
    width: 100%;
    height: 16px;
    opacity: 0;
    cursor: pointer;
}

.smp-progress-bar:hover .smp-progress {
    background: #ff6b6b;
}

/* Extras */
.smp-extras {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Volume popup */
.smp-volume-wrap {
    position: relative;
}

.smp-volume-popup {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 12px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.smp-volume-popup.smp-volume-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.smp-volume-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(255,255,255,0.1);
}

.smp-volume-range {
    -webkit-appearance: slider-vertical;
    writing-mode: vertical-lr;
    direction: rtl;
    width: 4px;
    height: 80px;
    cursor: pointer;
    accent-color: #e94560;
    background: transparent;
    outline: none;
}
/* Playlist Panel */
.smp-playlist-panel {
    position: absolute;
    bottom: 100%;
    right: 24px;
    width: 320px;
    max-height: 400px;
    background: #202326;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999999;
}

.smp-playlist-panel.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.smp-playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

.smp-playlist {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 340px;
    overflow-y: auto;
}

.smp-playlist-group-header {
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #e94560;
    background: rgba(233, 69, 96, 0.08);
    list-style: none;
    pointer-events: none;
    border-bottom: 1px solid rgba(233, 69, 96, 0.2);
}

.smp-playlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.smp-playlist-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.smp-playlist-item.active {
    background: #3894d21c;
}

.smp-playlist-item-cover {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background: #2a2a4a;
    overflow: hidden;
}

.smp-playlist-item-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.smp-playlist-item-info {
    flex: 1;
    overflow: hidden;
}

.smp-playlist-item-title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smp-playlist-item-artist {
    font-size: 11px;
    color: #a0a0b0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Scrollbar */
.smp-playlist::-webkit-scrollbar {
    width: 6px;
}

.smp-playlist::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.smp-playlist::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .smp-player-container {
        padding: 8px 12px;
        gap: 8px;
        flex-wrap: wrap;
        align-items: center;
    }
    
    .smp-track-info {
        order: 1;
        min-width: 0;
        flex: 1 1 100%;
        justify-content: center;
    }
    
    .smp-track-cover {
        width: 40px;
        height: 40px;
    }
    
    .smp-track-title {
        font-size: 12px;
    }
    
    .smp-track-artist {
        display: block;
        font-size: 10px;
    }
    
    .smp-controls {
        order: 2;
        gap: 6px;
        flex-shrink: 0;
    }
    
    .smp-btn-play {
        width: 40px;
        height: 40px;
    }
    
    .smp-progress-container {
        order: 3;
        min-width: 72px;
        flex: 1 1 90px;
        gap: 6px;
    }

    .smp-time-current,
    .smp-time-total {
        display: none;
    }
    
    .smp-extras {
        order: 4;
        gap: 6px;
        flex-shrink: 0;
    }

    /* On mobile: show title-side download, hide extras download */
    .smp-download-mobile {
        display: inline-flex !important;
    }
    #smp-download {
        display: none !important;
    }

    .smp-volume-popup {
        display: none !important;
    }
    
    .smp-playlist-panel {
        right: 0;
        left: 0;
        width: 100%;
        border-radius: 0;
        max-height: 55vh;
    }
}

/* Body padding for fixed player — only when player is visible */
body.spirit-music-player-enabled:has(.smp-player.smp-player-visible) {
    padding-bottom: 80px;
}

@media (max-width: 768px) {
    body.spirit-music-player-enabled:has(.smp-player.smp-player-visible) {
        padding-bottom: 112px;
    }
}

/* Download button in player bar */
.smp-btn-download {
    color: #a0a0b0;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.smp-btn-download:hover {
    color: #fff;
}

.smp-btn-download svg {
    fill: currentColor;
}

/* Shuffle & Repeat buttons */
.smp-btn-shuffle,
.smp-btn-repeat {
    color: #a0a0b0;
    position: relative;
    transition: color 0.2s ease, background 0.2s ease;
}

.smp-btn-shuffle:hover,
.smp-btn-repeat:hover {
    color: #fff;
}

.smp-btn-shuffle.smp-btn-active,
.smp-btn-repeat.smp-btn-active {
    color: #e94560;
}

.smp-btn-shuffle.smp-btn-active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #e94560;
    border-radius: 50%;
}

/* Repeat-one badge */
.smp-repeat-one-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 9px;
    font-weight: 700;
    color: #e94560;
    line-height: 1;
}

@media (max-width: 480px) {
    .smp-player-container {
        padding: 6px 8px;
        gap: 6px;
    }

    .smp-track-cover {
        width: 36px;
        height: 36px;
    }

    .smp-track-title {
        font-size: 11px;
    }

    .smp-btn {
        padding: 5px;
    }

    .smp-btn-play {
        width: 38px;
        height: 38px;
    }

    body.spirit-music-player-enabled:has(.smp-player.smp-player-visible) {
        padding-bottom: 108px;
    }
}

/* Video toggle button in player bar */
.smp-btn-video-toggle {
    color: #a0a0b0;
    transition: color 0.2s ease, background 0.2s ease;
}

.smp-btn-video-toggle:hover {
    color: #fff;
}

.smp-btn-video-toggle.smp-btn-active {
    color: #3894D2;
    background: #3894d24a;
}

.smp-btn-video-toggle.smp-btn-active:hover {
    background: #3894d24a;
}

/* Video Container */
.smp-video-container {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 400px;
    max-width: 90vw;
    background: #1a1a2e;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

.smp-video-container video {
    width: 100%;
    height: auto;
    display: block;
}

.smp-video-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    padding: 4px;
}

.smp-video-close:hover {
    background: rgba(233, 69, 96, 0.8);
}

/* Video indicator on track info */
.smp-track-info[data-video="true"] .smp-track-cover::after {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #3894D2;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.smp-track-cover {
    position: relative;
}

/* Mobile Video */
@media (max-width: 768px) {
    .smp-video-container {
        bottom: 105px;
        right: 10px;
        left: auto;
        width: 240px;
        max-width: 62vw;
    }
}

@media (max-width: 480px) {
    .smp-video-container {
        bottom: 105px;
        right: 8px;
        left: auto;
        width: 190px;
        max-width: 58vw;
    }
}

/* Loading Animation */
.smp-loading {
    animation: smp-pulse 1.5s ease-in-out infinite;
}

@keyframes smp-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ============================================================
   ARTIST GRID  —  [spirit_music_artists] shortcode
   ============================================================ */

.smp-artist-grid {
    display: grid;
    gap: 24px;
    margin: 0 0 40px;
    grid-template-columns: repeat(var(--smp-artist-cols, 4), minmax(0, 1fr));
}

/* Column variants */
.smp-artist-grid-cols-1 { --smp-artist-cols: 1; }
.smp-artist-grid-cols-2 { --smp-artist-cols: 2; }
.smp-artist-grid-cols-3 { --smp-artist-cols: 3; }
.smp-artist-grid-cols-4 { --smp-artist-cols: 4; }
.smp-artist-grid-cols-5 { --smp-artist-cols: 5; }
.smp-artist-grid-cols-6 { --smp-artist-cols: 6; }

/* Desktop polish: when a 4-col grid ends with 3 items (e.g., 11 total),
   shift the final 3 items by half a column so the row is centered. */
@media (min-width: 769px) {
    .smp-artist-grid-cols-4 > *:nth-last-child(3):nth-child(4n + 1),
    .smp-artist-grid-cols-4 > *:nth-last-child(2):nth-child(4n + 2),
    .smp-artist-grid-cols-4 > *:last-child:nth-child(4n + 3) {
        transform: translateX(calc(50% + 12px));
    }
}


/* Card */
.smp-artist-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    padding:10px;
    background: transparent;
    /* border-radius: 16px; */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Linked artist card (clickable to single page) */
a.smp-artist-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

a.smp-artist-card-link:hover .smp-artist-card,
a.smp-artist-card-link:focus .smp-artist-card {
    transform: translateY(-6px);
}

a.smp-artist-card-link:hover .smp-artist-card,
a.smp-artist-card-link:focus .smp-artist-card {
    transform: translateY(-6px);
}

.smp-artist-card:hover {
    transform: translateY(-4px);
}

/* Photo wrapper */
.smp-artist-photo-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    overflow: hidden;
    /* border-radius: 50%; */
    position: relative;
}

/* Skeleton shimmer — shown while image is loading, removed by onload */
.smp-artist-photo-wrap.smp-artist-photo-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(90deg, #e8e8e8 25%, #f5f5f5 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    animation: smp-shimmer 1.2s infinite linear;
    z-index: 1;
}

.smp-artist-photo-wrap.smp-artist-photo-loading img {
    opacity: 0;
}

.smp-artist-photo-wrap:not(.smp-artist-photo-loading) img {
    opacity: 1;
    transition: opacity 0.2s ease;
}

@keyframes smp-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Actual image */
img.smp-artist-photo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 3px solid #f0f0f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Placeholder (no image) */
span.smp-artist-photo.smp-artist-photo-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.smp-artist-photo-placeholder svg {
    fill: rgba(255, 255, 255, 0.7);
    width: 50px;
    height: 50px;
}

/* Info block */
.smp-artist-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: 'Poppins';
}

.smp-artist-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #3894D4;
    line-height: 1.3;
}
.smp-artist-single-header {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 20px;
    border-radius: 12px 12px 0px 0px;
}   
.smp-artist-track-count {
    font-size: 0.9rem;
    color: #fff;
    letter-spacing: 0.02em;
    font-family: 'Poppins';
}
.smp-artist-single-title {
    font-family: 'Poppins';
    color: #3894D4 !important;
    font-weight: 700;
}

/* Empty state */
.smp-artists-empty {
    color: #fff;
    font-style: italic;
}

/* Responsive */
@media (max-width: 1024px) {
    .smp-artist-grid-cols-5,
    .smp-artist-grid-cols-6 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .smp-artist-grid-cols-4,
    .smp-artist-grid-cols-5,
    .smp-artist-grid-cols-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 560px) {
    .smp-artist-grid,
    .smp-artist-grid-cols-2,
    .smp-artist-grid-cols-3,
    .smp-artist-grid-cols-4,
    .smp-artist-grid-cols-5,
    .smp-artist-grid-cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }
    .smp-artist-grid-cols-1 {
        grid-template-columns: 1fr;
    }
}
