/* Persistent Audio Player Styles */

:root {
    --pap-color: #1db954;
    --pap-bg: #282828;
    --pap-text: #ffffff;
    --pap-text-secondary: #b3b3b3;
    --pap-hover: #333333;
}

#pap-player-container {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 99999;
    background: var(--pap-bg);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

#pap-player-container.pap-position-bottom {
    bottom: 0;
}

#pap-player-container.pap-position-top {
    top: 0;
}

.pap-player {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 20px;
    max-width: 100%;
}

/* Controls */
.pap-player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pap-btn {
    background: none;
    border: none;
    color: var(--pap-text);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pap-btn:hover {
    background: var(--pap-hover);
    transform: scale(1.05);
}

.pap-btn-play {
    background: var(--pap-color);
    width: 40px;
    height: 40px;
}

.pap-btn-play:hover {
    background: var(--pap-color);
    filter: brightness(1.1);
}

/* Track Info */
.pap-player-info {
    flex: 0 0 200px;
    min-width: 0;
}

.pap-track-title {
    color: var(--pap-text);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pap-track-artist {
    color: var(--pap-text-secondary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Progress */
.pap-player-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.pap-time {
    color: var(--pap-text-secondary);
    font-size: 12px;
    min-width: 40px;
    text-align: center;
}

.pap-progress-bar {
    flex: 1;
    position: relative;
    height: 4px;
    background: var(--pap-hover);
    border-radius: 2px;
    cursor: pointer;
}

.pap-progress-fill {
    position: absolute;
    height: 100%;
    background: var(--pap-color);
    border-radius: 2px;
    pointer-events: none;
    width: 0%;
    transition: width 0.1s linear;
}

.pap-progress-slider {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 20px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.pap-progress-bar:hover .pap-progress-fill {
    background: var(--pap-color);
    filter: brightness(1.2);
}

/* Volume */
.pap-player-volume {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pap-volume-slider {
    width: 100px;
    height: 4px;
    background: var(--pap-hover);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.pap-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--pap-text);
    border-radius: 50%;
    cursor: pointer;
}

.pap-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--pap-text);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

/* Playlist */
.pap-playlist {
    position: absolute;
    bottom: 100%;
    right: 0;
    width: 400px;
    max-height: 400px;
    background: var(--pap-bg);
    border: 1px solid var(--pap-hover);
    border-bottom: none;
    overflow-y: auto;
}

.pap-position-top .pap-playlist {
    bottom: auto;
    top: 100%;
    border-top: none;
    border-bottom: 1px solid var(--pap-hover);
}

.pap-playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--pap-hover);
    position: sticky;
    top: 0;
    background: var(--pap-bg);
    z-index: 1;
}

.pap-playlist-header h3 {
    margin: 0;
    color: var(--pap-text);
    font-size: 16px;
    font-weight: 600;
}

.pap-playlist-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pap-playlist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.pap-playlist-item:hover {
    background: var(--pap-hover);
}

.pap-playlist-item.active {
    background: var(--pap-hover);
}

.pap-playlist-item.active .pap-playlist-title {
    color: var(--pap-color);
}

.pap-playlist-number {
    color: var(--pap-text-secondary);
    font-size: 14px;
    min-width: 20px;
}

.pap-playlist-info {
    flex: 1;
    min-width: 0;
}

.pap-playlist-title {
    color: var(--pap-text);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pap-playlist-artist {
    color: var(--pap-text-secondary);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pap-playlist-duration {
    color: var(--pap-text-secondary);
    font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .pap-player {
        flex-wrap: wrap;
        padding: 10px;
        gap: 10px;
    }
    
    .pap-player-info {
        flex: 1 1 100%;
        order: -1;
    }
    
    .pap-player-progress {
        flex: 1 1 100%;
        order: 1;
    }
    
    .pap-player-volume {
        display: none;
    }
    
    .pap-playlist {
        width: 100%;
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .pap-time {
        font-size: 10px;
        min-width: 35px;
    }
    
    .pap-btn {
        padding: 6px;
    }
    
    .pap-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .pap-btn-play {
        width: 36px;
        height: 36px;
    }
}

/* Add to Playlist Button */
.pap-add-to-playlist-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--pap-color, #1db954);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.pap-add-to-playlist-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.pap-add-to-playlist-btn:active {
    transform: translateY(0);
}

.pap-add-to-playlist-btn svg {
    width: 16px;
    height: 16px;
}

.pap-add-to-playlist-btn.added {
    background: #4caf50;
}

.pap-add-to-playlist-btn.added svg {
    transform: rotate(45deg);
}

/* WooCommerce Integration */
.pap-product-audio-meta {
    margin: 10px 0;
    padding: 8px 12px;
    background: #f0f0f0;
    border-radius: 4px;
    display: inline-block;
}

.pap-audio-label {
    font-size: 13px;
    color: #666;
}

/* Visitor Tracks Section */
.pap-visitor-tracks-section {
    border-bottom: 1px solid var(--pap-hover);
}

.pap-playlist-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 13px;
    font-weight: 600;
    color: var(--pap-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pap-btn-clear-visitor-tracks {
    padding: 4px 8px;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.pap-btn-clear-visitor-tracks:hover {
    background: rgba(255, 255, 255, 0.15);
}

.pap-visitor-tracks-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pap-playlist-item {
    position: relative;
}

.pap-playlist-item.pap-visitor-track {
    padding-right: 60px;
}

.pap-btn-remove-track {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px;
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
}

.pap-playlist-item:hover .pap-btn-remove-track {
    opacity: 1;
}

.pap-btn-remove-track:hover {
    background: rgba(255, 59, 48, 0.2);
}

.pap-btn-remove-track svg {
    width: 16px;
    height: 16px;
}

/* Visitor track indicator */
.pap-visitor-track .pap-playlist-number::before {
    content: '★';
    margin-right: 4px;
    color: var(--pap-color);
}

/* AJAX Page Transition */
body.pap-ajax-loading {
    pointer-events: none;
}

#pap-ajax-content {
    transition: opacity 0.3s ease;
}

body.pap-ajax-loading #pap-ajax-content {
    opacity: 0.5;
}

/* Loading Indicator */
.pap-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 4px solid var(--pap-hover);
    border-top-color: var(--pap-color);
    border-radius: 50%;
    animation: pap-spin 1s linear infinite;
    z-index: 100000;
    display: none;
}

body.pap-ajax-loading .pap-loading {
    display: block;
}

@keyframes pap-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes pap-slide-in {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pap-fade-out {
    to {
        opacity: 0;
        transform: translateX(400px);
    }
}
