/**
 * WP Listen to Blog & Read Later - High-UX Player & Button Styles
 */

.wplrl-container {
    --wplrl-primary: #2563eb;
    --wplrl-accent: #3b82f6;
    --wplrl-bg: #ffffff;
    --wplrl-border: #e2e8f0;
    --wplrl-text-main: #0f172a;
    --wplrl-text-muted: #64748b;
    --wplrl-card-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
    margin: 32px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    clear: both;
}

.wplrl-widget-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: var(--wplrl-bg);
    border: 1px solid var(--wplrl-border);
    border-radius: 14px;
    padding: 18px 22px;
    box-shadow: var(--wplrl-card-shadow);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible;
}

.wplrl-widget-card:hover {
    box-shadow: 0 10px 28px -4px rgba(0, 0, 0, 0.1), 0 4px 10px -2px rgba(0, 0, 0, 0.06);
    border-color: #cbd5e1;
}

/* Audio Player Section */
.wplrl-audio-section {
    flex: 1 1 360px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wplrl-player-top {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Glowing Play/Pause Main Button */
.wplrl-play-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--wplrl-primary), var(--wplrl-accent));
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    position: relative;
}

.wplrl-play-btn:hover {
    transform: scale(1.08);
    filter: brightness(1.08);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.45);
}

.wplrl-play-btn:active {
    transform: scale(0.95);
}

.wplrl-play-btn svg {
    width: 24px;
    height: 24px;
}

/* Pulse animation when active */
.wplrl-play-btn.playing::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    border: 2px solid var(--wplrl-primary);
    animation: wplrl-pulse 1.8s infinite cubic-bezier(0.4, 0, 0.6, 1);
    opacity: 0.6;
}

@keyframes wplrl-pulse {
    0% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 0; }
    100% { transform: scale(1.15); opacity: 0; }
}

/* Player Info & Scrubber */
.wplrl-player-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wplrl-player-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.wplrl-title-badge-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wplrl-narrator-badge {
    font-size: 11px;
    font-weight: 700;
    background: #eff6ff;
    color: var(--wplrl-primary);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid #dbeafe;
}

.wplrl-title {
    font-weight: 700;
    color: var(--wplrl-text-main);
    letter-spacing: -0.01em;
}

.wplrl-duration-estimate {
    font-size: 11px;
    font-weight: 600;
    color: var(--wplrl-text-muted);
}

/* Interactive Progress Container with Hover Time Preview */
.wplrl-progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wplrl-progress-bar {
    flex: 1;
    height: 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    overflow: visible;
}

.wplrl-progress-filled {
    height: 100%;
    background: linear-gradient(90deg, var(--wplrl-primary), var(--wplrl-accent));
    border-radius: 6px;
    transition: width 0.08s linear;
    position: relative;
}

.wplrl-progress-handle {
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 12px;
    height: 12px;
    background: #ffffff;
    border: 2px solid var(--wplrl-primary);
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    transition: transform 0.15s ease;
}

.wplrl-progress-bar:hover .wplrl-progress-handle {
    transform: translateY(-50%) scale(1);
}

/* Tooltip Timestamp Preview on Hover */
.wplrl-progress-hover-preview {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    white-space: nowrap;
    z-index: 100;
}

.wplrl-progress-bar:hover .wplrl-progress-hover-preview {
    opacity: 1;
}

.wplrl-time-display {
    font-size: 11px;
    font-weight: 600;
    color: var(--wplrl-text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Controls Bar */
.wplrl-controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid #f1f5f9;
}

.wplrl-skip-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.wplrl-ctrl-btn {
    background: transparent;
    border: none;
    color: var(--wplrl-text-muted);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 5px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.wplrl-ctrl-btn:hover {
    color: var(--wplrl-text-main);
    background: #f1f5f9;
}

.wplrl-ctrl-btn svg {
    width: 15px;
    height: 15px;
}

.wplrl-right-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Volume Popover Slider */
.wplrl-volume-wrapper {
    position: relative;
}

.wplrl-volume-slider-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
    display: none;
    z-index: 50;
}

.wplrl-volume-wrapper:hover .wplrl-volume-slider-popup {
    display: block;
}

.wplrl-vol-range {
    width: 70px;
    height: 4px;
    cursor: pointer;
    accent-color: var(--wplrl-primary);
}

/* Speed Switcher */
.wplrl-speed-selector {
    position: relative;
}

.wplrl-speed-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: var(--wplrl-text-main);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.wplrl-speed-btn:hover {
    background: #e2e8f0;
}

.wplrl-speed-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    border-radius: 8px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    z-index: 99;
}

.wplrl-speed-menu span {
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
}

.wplrl-speed-menu span:hover, .wplrl-speed-menu span.active {
    background: var(--wplrl-primary);
    color: #ffffff;
}

/* Visualizer Equalizer */
.wplrl-equalizer {
    display: flex;
    align-items: flex-end;
    gap: 2.5px;
    height: 16px;
    padding: 0 4px;
}

.wplrl-equalizer span {
    width: 3px;
    height: 4px;
    background: var(--wplrl-primary);
    border-radius: 2px;
    transition: height 0.15s ease;
}

.wplrl-equalizer.playing span:nth-child(1) { animation: wplrl-eq 0.7s infinite alternate ease-in-out; }
.wplrl-equalizer.playing span:nth-child(2) { animation: wplrl-eq 0.5s infinite alternate ease-in-out 0.2s; }
.wplrl-equalizer.playing span:nth-child(3) { animation: wplrl-eq 0.8s infinite alternate ease-in-out 0.4s; }
.wplrl-equalizer.playing span:nth-child(4) { animation: wplrl-eq 0.6s infinite alternate ease-in-out 0.1s; }
.wplrl-equalizer.playing span:nth-child(5) { animation: wplrl-eq 0.75s infinite alternate ease-in-out 0.3s; }

@keyframes wplrl-eq {
    0% { height: 3px; }
    100% { height: 16px; }
}

/* Download / Read Later Button */
.wplrl-read-later-section {
    display: flex;
    align-items: center;
}

.wplrl-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    color: var(--wplrl-text-main);
    border: 1px solid var(--wplrl-border);
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.wplrl-download-btn:hover {
    background: var(--wplrl-primary);
    color: #ffffff;
    border-color: var(--wplrl-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}

.wplrl-download-btn .wplrl-btn-icon {
    width: 17px;
    height: 17px;
    stroke-width: 2.2;
}

/* ----------------------------------------------------
 * Sticky Mini Player on Scroll (Enhanced UX)
 * ---------------------------------------------------- */
.wplrl-sticky-player {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 680px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    border-radius: 35px;
    padding: 8px 16px 8px 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    animation: wplrl-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes wplrl-slide-up {
    from { transform: translate(-50%, 100px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.wplrl-sticky-inner {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wplrl-sticky-play-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--wplrl-primary);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.wplrl-sticky-play-btn:hover {
    transform: scale(1.08);
}

.wplrl-sticky-play-btn svg {
    width: 18px;
    height: 18px;
}

.wplrl-sticky-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.wplrl-sticky-title {
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wplrl-sticky-progress-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wplrl-sticky-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.wplrl-sticky-progress-filled {
    height: 100%;
    background: var(--wplrl-accent);
    border-radius: 2px;
}

.wplrl-sticky-time {
    font-size: 10px;
    color: #94a3b8;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.wplrl-sticky-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.wplrl-sticky-btn-scroll, .wplrl-sticky-btn-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
    font-size: 16px;
    line-height: 1;
}

.wplrl-sticky-btn-scroll:hover, .wplrl-sticky-btn-close:hover {
    color: #ffffff;
}

/* Responsive */
@media (max-width: 640px) {
    .wplrl-widget-card {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 16px;
    }
    .wplrl-read-later-section {
        width: 100%;
    }
    .wplrl-download-btn {
        width: 100%;
        justify-content: center;
    }
    .wplrl-sticky-player {
        width: calc(100% - 20px);
        bottom: 10px;
    }
}
