/* Persistent Audio Player Styles */

:root {
    --pap-bg: #282828;
    --pap-text: #ffffff;
    --pap-hover: rgba(255, 255, 255, 0.1);
    --pap-border: rgba(255, 255, 255, 0.1);
}

/* Player Container */
#pap-player-container {
    position: fixed;
    left: 0;
    right: 0;
    background: var(--pap-bg);
    color: var(--pap-text);
    z-index: 99999;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

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

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

/* Main Player */
.pap-player {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    gap: 15px;
    position: relative;
    z-index: 2;
    background: var(--pap-bg);
    width: 100%;
    box-sizing: border-box;
}

/* Buttons */
.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);
    color: var(--pap-color);
}

.pap-btn-play {
    width: 40px;
    height: 40px;
}

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

/* Artwork */
.pap-artwork-container {
    width: 56px;
    height: 56px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#pap-artwork {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pap-artwork-placeholder {
    color: rgba(255, 255, 255, 0.3);
}

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

.pap-track-title {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pap-track-artist {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Progress Bar */
.pap-progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pap-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    min-width: 40px;
}

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

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

.pap-progress-bar:hover .pap-progress-fill {
    background: var(--pap-color);
    opacity: 0.8;
}

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

.pap-volume-slider {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
}

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

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

/* Playlist Drawer */
.pap-playlist-drawer {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--pap-bg);
    max-height: 400px;
    overflow-y: auto;
    border-top: 1px solid var(--pap-border);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.pap-playlist-drawer.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.pap-position-top .pap-playlist-drawer {
    bottom: auto;
    top: 100%;
    transform: translateY(-100%);
}

.pap-position-top .pap-playlist-drawer.active {
    transform: translateY(0);
}

.pap-playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--pap-border);
}

.pap-playlist-header h3 {
    margin: 0;
    font-size: 16px;
}

.pap-playlist-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* Playlist Items */
.pap-playlist-items {
    padding: 0;
}

.pap-playlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 20px;
    border-bottom: 1px solid var(--pap-border);
    cursor: pointer;
    transition: background 0.2s;
}

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

.pap-playlist-item.active {
    background: rgba(29, 185, 84, 0.1);
}

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

.pap-playlist-track-info {
    display: flex;
    gap: 15px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.pap-playlist-number {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    min-width: 25px;
}

.pap-playlist-artwork {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pap-playlist-artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pap-playlist-artwork-placeholder {
    color: rgba(255, 255, 255, 0.3);
}

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

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

.pap-playlist-artist {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Playlist Actions */
.pap-playlist-actions {
    display: flex;
    gap: 8px;
}

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

.pap-btn-add-to-cart {
    color: var(--pap-color);
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.pap-playlist-item:hover .pap-btn-add-to-cart {
    opacity: 1;
}

.pap-btn-add-to-cart:hover {
    background: var(--pap-hover);
}

.pap-btn-add-to-cart.loading svg {
    animation: spin 1s linear infinite;
}

.pap-btn-add-to-cart.success {
    color: #4caf50;
}

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

.pap-btn-remove {
    color: rgba(255, 255, 255, 0.5);
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}

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

.pap-btn-remove:hover {
    color: #f44336;
}

/* WordPress Playlist Integration */
.pap-playlist-add-all {
    margin-bottom: 10px;
}

.pap-btn-add-all-tracks,
.pap-btn-add-single-track {
    cursor: pointer;
    transition: all 0.2s;
}

.pap-btn-add-all-tracks:hover,
.pap-btn-add-single-track:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .pap-player {
        flex-wrap: wrap;
        padding: 10px;
        gap: 10px;
    }
    
    .pap-track-info {
        flex: 0 0 150px;
    }
    
    .pap-volume-container {
        display: none;
    }
    
    .pap-progress-container {
        order: 10;
        width: 100%;
    }
}

/* Scrollbar Styling */
.pap-playlist-drawer::-webkit-scrollbar {
    width: 8px;
}

.pap-playlist-drawer::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.pap-playlist-drawer::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.pap-playlist-drawer::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Variation Selector Modal */
.pap-variation-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.pap-variation-content {
    background: var(--pap-bg);
    border-radius: 8px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

.pap-variation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--pap-border);
}

.pap-variation-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--pap-text);
}

.pap-variation-close {
    background: none;
    border: none;
    color: var(--pap-text);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.pap-variation-close:hover {
    background: var(--pap-hover);
}

.pap-variation-body {
    margin-bottom: 20px;
}

.pap-variation-option {
    padding: 12px 16px;
    margin-bottom: 8px;
    border: 2px solid var(--pap-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pap-variation-option:hover {
    border-color: var(--pap-color);
    background: var(--pap-hover);
}

.pap-variation-option.selected {
    border-color: var(--pap-color);
    background: rgba(29, 185, 84, 0.1);
}

.pap-variation-name {
    font-size: 14px;
    font-weight: 500;
}

.pap-variation-price {
    font-size: 14px;
    color: var(--pap-color);
    font-weight: 600;
}

.pap-variation-footer {
    display: flex;
    gap: 12px;
}

.pap-variation-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pap-variation-btn-primary {
    background: var(--pap-color);
    color: white;
}

.pap-variation-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.pap-variation-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pap-variation-btn-secondary {
    background: transparent;
    color: var(--pap-text);
    border: 1px solid var(--pap-border);
}

.pap-variation-btn-secondary:hover {
    background: var(--pap-hover);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}
