/* Frontend Styles for Podcast Player Block - Custom Design */

.bmwp-podcast-player {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid #d1d1d1;
    border-radius: 0px;
    padding: var(--dian-spacing-16);
    margin: var(--dian-spacing-32) 0;
    box-shadow: 8px 9px 0 0 rgba(0, 156, 167, 0.09);
    transition: all 0.3s ease;
    gap: 16px;
    width: fit-content;
    min-width: 364px;
    max-width: 900px;
    width: 100%;
    min-height: 70px;
}

/* Thumbnail */
.bmwp-podcast-thumbnail {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border-radius: 4px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bmwp-podcast-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bmwp-podcast-placeholder {
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Content */
.bmwp-podcast-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bmwp-podcast-title {
    font-family: var(--dian-bague-medium);
    font-weight: 500;
    font-size: var(--dian-body-18);
    color: var(--surface-100);
    line-height: var(--dian-line-height-body);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Controls Container */
.bmwp-podcast-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* Play/Pause Button */
.bmwp-play-pause-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 156, 167, 1);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.bmwp-play-pause-btn:hover {
    background: var(--primary);
    transform: scale(1.05);
}

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

.bmwp-play-pause-btn.playing .bmwp-play-icon {
    display: none;
}

.bmwp-play-pause-btn.playing .bmwp-pause-icon {
    display: block !important;
}

/* Waveform Container */
.bmwp-waveform-container {
    flex: 1;
    position: relative;
    height: 32px;
    display: flex;
    align-items: center;
    cursor: pointer;
    min-width: 200px;
}

.bmwp-waveform {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    gap: 0.1px;
}

.bmwp-waveform-bar {
    background: rgba(125, 125, 125, 1);
    border-radius: 1px;
    width: 1.5px;
    min-height: 4px;
    transition: all 0.1s ease;
    opacity: 0.3;
}

.bmwp-waveform-bar.active {
    opacity: 1;
    background: var(--primary);
}

.bmwp-waveform-bar.played {
    opacity: 1;
    background: rgba(0, 156, 167, 1);
}

/* Playing state - change waveform bars background */
.bmwp-podcast-player.playing .bmwp-waveform-bar {
    background: rgba(125, 125, 125, 1);
    opacity: 0.5;
}

.bmwp-podcast-player.playing .bmwp-waveform-bar.active {
    background: rgba(0, 156, 167, 1);
    opacity: 1;
}

.bmwp-podcast-player.playing .bmwp-waveform-bar.played {
    background: var(--primary);
    opacity: 1;
}

/* Progress Bar Overlay */
.bmwp-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0.1) 100%);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s ease;
    pointer-events: none;
}

/* Time Display */
.bmwp-time-display {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--contrast);
    font-weight: 500;
    min-width: 35px;
    text-align: right;
}

/* Mute Button */
.bmwp-mute-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--contrast);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    margin-left: auto; /* Push to the right end */
}

.bmwp-mute-btn:hover {
    background: var(--surface-20);
    color: var(--contrast);
}

.bmwp-mute-btn.muted .bmwp-volume-icon {
    display: none;
}

.bmwp-mute-btn.muted .bmwp-mute-icon {
    display: block !important;
}

/* Loading State */
.bmwp-podcast-player.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Canvas waveform animation */
.bmwp-waveform canvas.bmwp-waveform-playing {
    animation: bmwp-pulse 2s ease-in-out infinite;
}

/* Error State */
.bmwp-podcast-player-error {
    background: #fed7d7;
    color: #c53030;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #feb2b2;
    margin: 20px 0;
    font-size: 14px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .bmwp-podcast-player {
        padding: 10px 12px;
        gap: 10px;
    }

    .bmwp-podcast-thumbnail {
        width: 40px;
        height: 40px;
    }

    .bmwp-waveform-container {
        min-width: 150px;
    }

    .bmwp-play-pause-btn {
        width: 28px;
        height: 28px;
    }

    .bmwp-play-pause-btn svg {
        width: 16px;
        height: 16px;
    }

    .bmwp-mute-btn {
        width: 24px;
        height: 24px;
    }

    .bmwp-mute-btn svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .bmwp-podcast-player {
        padding: 8px 10px;
        gap: 8px;
    }

    .bmwp-podcast-thumbnail {
        width: 36px;
        height: 36px;
    }

    .bmwp-podcast-title {
        font-size: 16px;
    }

    .bmwp-waveform-container {
        min-width: 120px;
    }

    .bmwp-time-display {
        font-size: 11px;
        min-width: 30px;
    }

    .bmwp-podcast-controls {
        gap: 8px;
    }
}

/* Dark Mode Support */
/* @media (prefers-color-scheme: dark) {
    .bmwp-podcast-player {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .bmwp-podcast-title {
        color: #f7fafc;
    }

    .bmwp-time-display {
        color: #a0aec0;
    }

    .bmwp-mute-btn {
        color: #a0aec0;
    }

    .bmwp-mute-btn:hover {
        background: #4a5568;
        color: #e2e8f0;
    }

    .bmwp-podcast-thumbnail {
        background: #4a5568;
    }

    .bmwp-podcast-placeholder {
        color: #718096;
    }
} */

/* Focus States for Accessibility */
.bmwp-play-pause-btn:focus,
.bmwp-mute-btn:focus {
    outline: 2px solid var(--primary) !important;
    outline-offset: 2px;
}

.bmwp-mute-btn:focus {
    background-color: var(--surface-20);
}

.bmwp-waveform-container:focus {
    outline: 2px solid rgba(0, 156, 167, 0);
    outline-offset: 2px;
    border-radius: 0px;
}

/* Print Styles */
@media print {
    .bmwp-podcast-player {
        box-shadow: none;
        border: 1px solid #000;
        break-inside: avoid;
    }

    .bmwp-podcast-controls {
        display: none;
    }

    .bmwp-podcast-player::after {
        content: "Audio player not available in print";
        font-style: italic;
        color: #666;
        font-size: 12px;
        margin-top: 8px;
        display: block;
    }
}
