/* ==========================================================================
   NusaVoice Audio Narrator & Accessibility Styles
   Platform: Posnusa Pro (NusaMedia Ecosystem v4.0)
   Standard: WCAG 2.1 AA / AAA Compliant (High Contrast, Clear Focus Ring)
   ========================================================================== */

/* 1. Sorotan Teks Naskah yang Sedang Disuarakan (Reading Spotlight) */
.nusa-tts-reading-active {
    background-color: #FEF3C7 !important; /* Amber lembut 50 */
    color: #0F172A !important;             /* Slate 900 kontras tinggi */
    border-left: 5px solid #B30000 !important;
    padding-left: 14px !important;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
    transition: all 220ms ease;
}

/* 2. Audio Player Bar Desktop (NusaVoice Audio Deck) */
.nusa-audio-deck {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    color: #FFFFFF;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.12);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.nusa-audio-deck.is-playing {
    border-color: rgba(179, 0, 0, 0.45);
    box-shadow: 0 10px 28px rgba(179, 0, 0, 0.15), 0 4px 12px rgba(15, 23, 42, 0.3);
}

/* Baris 1: Header Meta & Pengaturan (Voice & Speed) */
.nusa-audio-deck-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
}

.nusa-audio-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-shrink: 1;
}

.nusa-audio-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nusa-audio-title-brand {
    font-weight: 800;
    letter-spacing: 0.3px;
    color: #F8FAFC;
}

.nusa-audio-separator {
    color: #64748B;
    font-size: 11px;
}

.nusa-audio-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748B;
    display: inline-block;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}

.nusa-audio-deck.is-playing .nusa-audio-status-dot {
    background: #10B981;
    box-shadow: 0 0 8px #10B981;
    animation: nusaPulse 1.5s infinite;
}

.nusa-audio-deck.is-paused .nusa-audio-status-dot {
    background: #F59E0B;
}

@keyframes nusaPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.nusa-audio-substatus {
    font-size: 12px;
    color: #94A3B8;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Controls di Kanan Header */
.nusa-audio-controls-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.nusa-control-label {
    font-size: 11.5px;
    font-weight: 600;
    color: #94A3B8;
    white-space: nowrap;
}

.nusa-audio-voice-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nusa-audio-voice-select {
    background: #0B1120;
    color: #F8FAFC;
    border: 1px solid #334155;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all 0.15s ease;
}

.nusa-audio-voice-select:hover,
.nusa-audio-voice-select:focus {
    border-color: #64748B;
    background: #1E293B;
}

.nusa-audio-speed-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nusa-audio-speed-group {
    display: inline-flex;
    background: #0B1120;
    padding: 2px;
    border-radius: 6px;
    border: 1px solid #334155;
    gap: 2px;
}

.nusa-btn-spd,
.nusa-spd-btn {
    background: transparent;
    color: #94A3B8;
    border: none;
    padding: 5px 9px;
    border-radius: 4px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 140ms ease;
    line-height: 1;
}

.nusa-btn-spd:hover,
.nusa-spd-btn:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.08);
}

.nusa-btn-spd.active,
.nusa-spd-btn.active {
    background: #B30000 !important;
    color: #FFFFFF !important;
    font-weight: 800 !important;
    box-shadow: 0 1px 6px rgba(179, 0, 0, 0.45);
}

/* Baris 2: Pemutaran & Scrubber Utama */
.nusa-audio-deck-body {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.nusa-audio-playback-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nusa-audio-play-btn {
    background: #B30000;
    color: #FFFFFF;
    border: none;
    padding: 9px 18px;
    border-radius: 30px;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.02em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(179, 0, 0, 0.35);
    transition: all 180ms cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.nusa-audio-play-btn:hover {
    background: #DC2626;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.45);
}

.nusa-audio-play-btn:active {
    transform: translateY(1px);
}

.nusa-audio-play-btn:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* Equalizer Bars Animasi */
.nusa-eq-wave {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
    width: 14px;
}

.nusa-eq-bar {
    width: 2.5px;
    background: #FFFFFF;
    border-radius: 1px;
    height: 4px;
    transition: height 0.15s ease;
}

.nusa-audio-deck.is-playing .nusa-eq-bar:nth-child(1) {
    animation: nusaEq 0.7s infinite alternate ease-in-out;
}
.nusa-audio-deck.is-playing .nusa-eq-bar:nth-child(2) {
    animation: nusaEq 0.5s 0.2s infinite alternate ease-in-out;
}
.nusa-audio-deck.is-playing .nusa-eq-bar:nth-child(3) {
    animation: nusaEq 0.9s 0.1s infinite alternate ease-in-out;
}

@keyframes nusaEq {
    0% { height: 3px; }
    100% { height: 14px; }
}

.nusa-audio-jump-btn {
    background: #1E293B;
    color: #CBD5E1;
    border: 1px solid #334155;
    padding: 7px 11px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 150ms ease;
    flex-shrink: 0;
}

.nusa-audio-jump-btn:hover {
    background: #334155;
    color: #FFFFFF;
    border-color: #475569;
}

/* Timeline & Scrubber Progress */
.nusa-audio-timeline {
    flex: 1;
    min-width: 240px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.nusa-audio-time-label {
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
    color: #94A3B8;
    min-width: 34px;
    font-weight: 600;
}

.nusa-audio-progress-track {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.nusa-audio-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, #B30000 0%, #EF4444 100%);
    border-radius: 3px;
    transition: width 0.2s linear;
}

/* Segmen Indikator */
.nusa-audio-segment-badge {
    font-size: 10.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #CBD5E1;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* 3. Floating Audio Bar (Dock di Footer saat Scroll ke Bawah) */
.nusa-voice-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    width: 90%;
    max-width: 680px;
    background-color: #0F172A;
    color: #FFFFFF;
    border-radius: 12px;
    padding: 12px 20px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1), opacity 240ms ease, visibility 240ms ease;
}

.nusa-voice-bar.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.nusa-voice-inner {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nusa-voice-play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #B30000;
    color: #FFFFFF;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 120ms ease, background-color 150ms ease;
}

.nusa-voice-play-btn:hover {
    background-color: #DC2626;
    transform: scale(1.05);
}

.nusa-voice-skip-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #E2E8F0;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    flex-shrink: 0;
}

.nusa-voice-skip-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nusa-voice-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.nusa-voice-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #F8FAFC;
    letter-spacing: 0.02em;
}

.nusa-voice-status {
    font-size: 0.75rem;
    color: #94A3B8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nusa-voice-controls select {
    background-color: #1E293B;
    color: #F1F5F9;
    border: 1px solid #334155;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    cursor: pointer;
    outline: none;
}

.nusa-voice-close-btn {
    background: transparent;
    border: none;
    color: #94A3B8;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
}

.nusa-voice-close-btn:hover {
    color: #FFFFFF;
}

/* Responsif Tablet & Mobile */
@media (max-width: 860px) {
    .nusa-audio-deck-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .nusa-audio-controls-right {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 640px) {
    .nusa-audio-deck {
        padding: 12px 14px;
        gap: 10px;
    }
    .nusa-audio-deck-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding-bottom: 8px;
    }
    .nusa-audio-controls-right {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }
    .nusa-audio-deck-body {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .nusa-audio-playback-actions {
        width: 100%;
        justify-content: space-between;
    }
    .nusa-audio-timeline {
        width: 100%;
    }
    .nusa-voice-bar {
        bottom: 12px;
        width: calc(100vw - 24px);
        padding: 10px 14px;
    }
}
