/* Inline voice narration player (article + editor) */

.abad-voice-block .abad-voice-player__source {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.abad-voice-player {
    --avp-accent: var(--theme-color, #007bff);
    --avp-accent-soft: color-mix(in srgb, var(--avp-accent) 14%, white);
    --avp-track: #e2e8f0;
    --avp-fill: var(--avp-accent);
    --avp-text: #334155;
    --avp-muted: #64748b;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 2px 8px rgba(15, 23, 42, 0.05);
}

.abad-voice-player__btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(145deg, var(--avp-accent) 0%, color-mix(in srgb, var(--avp-accent) 78%, #1e3a8a) 100%);
    box-shadow:
        0 2px 6px color-mix(in srgb, var(--avp-accent) 35%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.abad-voice-player__btn:hover {
    transform: translateY(-1px);
    box-shadow:
        0 4px 12px color-mix(in srgb, var(--avp-accent) 40%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.abad-voice-player__btn:active {
    transform: translateY(0);
}

.abad-voice-player__btn i {
    font-size: 1.05rem;
    line-height: 1;
}

.abad-voice-player__btn--mute {
    width: 36px;
    height: 36px;
    color: var(--avp-text);
    background: #fff;
    border: 1px solid #dbe3ee;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.abad-voice-player__btn--mute:hover {
    color: var(--avp-accent);
    border-color: color-mix(in srgb, var(--avp-accent) 35%, #dbe3ee);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.abad-voice-player__volume {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.abad-voice-player__volume-popup {
    width: 72px;
    flex-shrink: 0;
}

.abad-voice-player__volume-track {
    position: relative;
    height: 6px;
    border-radius: 999px;
    background: var(--avp-track);
    cursor: pointer;
    overflow: hidden;
    touch-action: none;
}

.abad-voice-player__volume-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--avp-accent) 70%, white), var(--avp-fill));
    pointer-events: none;
}

.abad-voice-player__main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.abad-voice-player__progress {
    position: relative;
    height: 8px;
    border-radius: 999px;
    background: var(--avp-track);
    cursor: pointer;
    overflow: hidden;
    touch-action: none;
}

.abad-voice-player__progress-buffered,
.abad-voice-player__progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: 999px;
    pointer-events: none;
}

.abad-voice-player__progress-buffered {
    width: 0;
    background: #cbd5e1;
}

.abad-voice-player__progress-fill {
    width: 0;
    background: linear-gradient(90deg, color-mix(in srgb, var(--avp-accent) 80%, white), var(--avp-fill));
    box-shadow: 0 0 8px color-mix(in srgb, var(--avp-accent) 35%, transparent);
}

.abad-voice-player__meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--avp-muted);
    line-height: 1;
}

.abad-voice-player__time-current {
    color: var(--avp-text);
}

.abad-voice-player.is-playing .abad-voice-player__btn--play {
    animation: avp-pulse 1.6s ease-in-out infinite;
}

@keyframes avp-pulse {
    0%, 100% { box-shadow: 0 2px 6px color-mix(in srgb, var(--avp-accent) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
    50% { box-shadow: 0 4px 14px color-mix(in srgb, var(--avp-accent) 50%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
}

@media (max-width: 576px) {
    .abad-voice-player {
        gap: 10px;
        padding: 8px 10px;
    }

    .abad-voice-player__btn {
        width: 36px;
        height: 36px;
    }

    .abad-voice-player__btn--mute {
        width: 32px;
        height: 32px;
    }

    .abad-voice-player__volume-popup {
        width: 56px;
    }
}

html.dark-theme .abad-voice-player {
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    border-color: #374151;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html.dark-theme .abad-voice-player__btn--mute {
    background: #111827;
    border-color: #4b5563;
    color: #e2e8f0;
}

html.dark-theme .abad-voice-player__progress {
    background: #374151;
}

html.dark-theme .abad-voice-player__volume-track {
    background: #374151;
}

html.dark-theme .abad-voice-player__progress-buffered {
    background: #4b5563;
}

html.dark-theme .abad-voice-player__time-current {
    color: #e2e8f0;
}

html.dark-theme .abad-voice-player__meta {
    color: #94a3b8;
}
