/**
 * YesStreaming Universal Floating Player
 * Version: 2.1.0 - Full theme preset support
 * Works across all themes using CSS variables
 */

/* Player Container - Fixed at bottom */
#yes-player-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--color-player-bg, rgba(0, 0, 0, 0.95));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
}

#yes-player-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Play/Pause Button */
#yes-play-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary, #ec4899), var(--color-secondary, #8b5cf6));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px color-mix(in srgb, var(--color-primary, #ec4899) 30%, transparent);
}

#yes-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--color-primary, #ec4899) 40%, transparent);
}

#yes-play-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Album Art */
#yes-album-container {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(135deg, 
        color-mix(in srgb, var(--color-secondary, #8b5cf6) 30%, transparent), 
        color-mix(in srgb, var(--color-primary, #ec4899) 30%, transparent));
    display: flex;
    align-items: center;
    justify-content: center;
}

#yes-album-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

#yes-album-placeholder svg {
    width: 24px;
    height: 24px;
    fill: rgba(255, 255, 255, 0.6);
}

#yes-album-art {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

#yes-album-art.visible {
    display: block;
}

/* Track Info */
#yes-track-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-family: var(--font-player, var(--font-body, 'Poppins', sans-serif));
}

#yes-track-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-player-title, var(--color-primary, #f472b6));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    line-height: 1.3;
    font-family: inherit;
}

#yes-track-artist {
    font-size: 12px;
    color: var(--color-player-artist, var(--color-text-light, #9ca3af));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    line-height: 1.3;
    font-family: inherit;
}

/* Stream Selector */
#yes-stream-selector {
    position: relative;
    display: none;
}

@media (min-width: 640px) {
    #yes-stream-selector {
        display: block;
    }
}

#yes-stream-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: linear-gradient(135deg, 
        color-mix(in srgb, var(--color-secondary, #8b5cf6) 30%, transparent), 
        color-mix(in srgb, var(--color-primary, #ec4899) 30%, transparent));
    border: 1px solid var(--color-border, rgba(255, 255, 255, 0.2));
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

#yes-stream-btn:hover {
    background: linear-gradient(135deg, 
        color-mix(in srgb, var(--color-secondary, #8b5cf6) 50%, transparent), 
        color-mix(in srgb, var(--color-primary, #ec4899) 50%, transparent));
    border-color: var(--color-primary, rgba(255, 255, 255, 0.3));
}

#yes-stream-btn svg {
    width: 14px;
    height: 14px;
    fill: var(--color-secondary, #c084fc);
}

#yes-stream-btn svg.arrow {
    width: 12px;
    height: 12px;
    fill: none;
    stroke: var(--color-text-light, rgba(255, 255, 255, 0.6));
}

#yes-current-stream {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-player-controls, white);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Stream Dropdown */
#yes-stream-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 10px;
    background: var(--color-player-bg, rgba(17, 24, 39, 0.98));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid color-mix(in srgb, var(--color-primary, #8b5cf6) 30%, transparent);
    border-radius: 16px;
    padding: 10px;
    min-width: 240px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

#yes-stream-dropdown.open,
#yes-stream-dropdown.show {
    display: block;
}

#yes-stream-dropdown-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-light, rgba(255, 255, 255, 0.5));
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.yes-stream-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    border-radius: 10px;
}

.yes-stream-item:hover {
    background: color-mix(in srgb, var(--color-primary, #8b5cf6) 20%, transparent);
}

.yes-stream-item.active {
    background: color-mix(in srgb, var(--color-primary, #8b5cf6) 15%, transparent);
}

.yes-stream-item img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.yes-stream-item .stream-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary, #ec4899), var(--color-secondary, #8b5cf6));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    font-weight: bold;
    color: white;
}

.yes-stream-item .stream-info {
    flex: 1;
    min-width: 0;
}

.yes-stream-item .stream-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-player-controls, white);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.yes-stream-item .stream-genre {
    font-size: 11px;
    color: var(--color-text-light, rgba(255, 255, 255, 0.5));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.yes-stream-item .stream-check {
    width: 14px;
    height: 14px;
    fill: var(--color-success, #10b981);
    margin-left: auto;
    display: none;
}

.yes-stream-item.active .stream-check {
    display: block;
}

/* Volume Control */
#yes-volume-control {
    display: none;
    align-items: center;
    gap: 8px;
}

@media (min-width: 768px) {
    #yes-volume-control {
        display: flex;
    }
}

#yes-volume-control svg {
    width: 16px;
    height: 16px;
    fill: var(--color-text-light, #9ca3af);
}

#yes-volume-slider {
    width: 80px;
    height: 4px;
    background: var(--color-border, #374151);
    border-radius: 2px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

#yes-volume-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--color-primary, #ec4899);
    border-radius: 50%;
    cursor: pointer;
}

#yes-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--color-primary, #ec4899);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Live Indicator */
#yes-live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    background: color-mix(in srgb, var(--color-error, #ef4444) 15%, transparent);
    padding: 6px 12px;
    border-radius: 50px;
}

#yes-live-dot {
    width: 6px;
    height: 6px;
    background: var(--color-error, #ef4444);
    border-radius: 50%;
    animation: yes-pulse 2s infinite;
}

@keyframes yes-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#yes-live-text {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-error, #ef4444);
    text-transform: uppercase;
}
