/* ==========================================================
   AUDIO SCREEN READER - RESPONSIVE ACCESSIBILITY WIDGET
   Standar Ditjen Badilum Mahkamah Agung RI & WCAG 2.0 AA
   ========================================================== */

/* 1. Highlight Visual untuk Elemen yang Sedang Dibaca (Karaoke Effect) */
.asr-highlight {
    background-color: #fef08a !important;
    color: #854d0e !important;
    outline: 3px solid #eab308 !important;
    outline-offset: 2px;
    border-radius: 4px;
    transition: background-color 0.25s ease, outline 0.25s ease;
    box-shadow: 0 0 12px rgba(234, 179, 8, 0.45);
}

body.high-contrast .asr-highlight {
    background-color: #ffff00 !important;
    color: #000000 !important;
    outline: 3px solid #ffffff !important;
}

/* 2. Floating Dock Audio Player di Bagian Bawah Layar */
#asr-player-dock {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    width: 95%;
    max-width: 920px;
    background: #ffffff;
    border-radius: 16px;
    border: 2px solid var(--skt-gold, #FF9900);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
    z-index: 99999;
    padding: 12px 18px;
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#asr-player-dock.active {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Header / Status Bar */
.asr-header-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f1f5f9;
}

.asr-badge-brand {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--skt-maroon, #9A2109);
    background: #fee2e2;
    padding: 3px 8px;
    border-radius: 20px;
}

.asr-status-text {
    font-size: 0.82rem;
    color: #475569;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

/* Animasi Equalizer Suara */
.asr-equalizer {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
    width: 16px;
}

.asr-equalizer span {
    width: 3px;
    background-color: var(--skt-maroon, #9A2109);
    border-radius: 2px;
    height: 3px;
    transition: height 0.2s ease;
}

.asr-equalizer.playing span:nth-child(1) {
    animation: asrWave 0.8s ease-in-out infinite alternate;
}
.asr-equalizer.playing span:nth-child(2) {
    animation: asrWave 0.5s ease-in-out 0.15s infinite alternate;
}
.asr-equalizer.playing span:nth-child(3) {
    animation: asrWave 0.7s ease-in-out 0.3s infinite alternate;
}
.asr-equalizer.playing span:nth-child(4) {
    animation: asrWave 0.6s ease-in-out 0.2s infinite alternate;
}

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

/* Kontrol Utama Player */
.asr-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.asr-playback-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.asr-btn {
    border: none;
    outline: none;
    cursor: pointer;
    background: #f1f5f9;
    color: #1e293b;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.asr-btn:hover {
    background: #e2e8f0;
    color: var(--skt-maroon, #9A2109);
    transform: scale(1.05);
}

.asr-btn-play {
    width: 46px;
    height: 46px;
    background: var(--skt-maroon, #9A2109);
    color: #ffffff;
    font-size: 1.25rem;
    box-shadow: 0 4px 10px rgba(154, 33, 9, 0.35);
}

.asr-btn-play:hover {
    background: var(--skt-maroon-dark, #7B201F);
    color: var(--skt-gold, #FF9900);
    transform: scale(1.08);
}

.asr-btn-stop {
    background: #fee2e2;
    color: #b91c1c;
}
.asr-btn-stop:hover {
    background: #fecaca;
    color: #991b1b;
}

/* Opsi Ekstra (Mode Hover, Kecepatan & Volume) */
.asr-options-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.asr-pill-btn {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.asr-pill-btn:hover {
    border-color: var(--skt-gold, #FF9900);
    color: var(--skt-maroon, #9A2109);
    background: #ffffff;
}

.asr-pill-btn.active {
    background: var(--skt-maroon, #9A2109);
    color: #ffffff;
    border-color: var(--skt-maroon, #9A2109);
    box-shadow: 0 2px 6px rgba(154, 33, 9, 0.25);
}

.asr-speed-badge {
    min-width: 44px;
    text-align: center;
}

.asr-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    border-radius: 6px;
}

.asr-close-btn:hover {
    color: #ef4444;
    background: #fee2e2;
}

/* 3. Floating Mini Tooltip untuk Seleksi Teks */
#asr-selection-tooltip {
    position: absolute;
    display: none;
    z-index: 100001;
    background: #1e293b;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 24px;
    font-size: 0.78rem;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transform: translate(-50%, -100%);
    margin-top: -10px;
    white-space: nowrap;
    align-items: center;
    gap: 6px;
    transition: transform 0.15s ease, opacity 0.15s ease;
    border: 1px solid var(--skt-gold, #FF9900);
}

#asr-selection-tooltip:hover {
    background: var(--skt-maroon, #9A2109);
    color: var(--skt-gold, #FF9900);
    transform: translate(-50%, -105%) scale(1.04);
}

/* 4. In-Article Audio Screen Reader Player Card */
.article-audio-player {
    background: linear-gradient(135deg, #fdfbf7 0%, #fff6ec 100%);
    border: 1.5px solid var(--skt-gold, #FF9900);
    border-radius: 12px;
    padding: 12px 18px;
    margin: 18px 0 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 3px 10px rgba(255, 153, 0, 0.08);
}

.article-audio-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.article-audio-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--skt-maroon, #9A2109);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(154, 33, 9, 0.25);
}

.article-audio-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 2px;
}

.article-audio-subtitle {
    font-size: 0.78rem;
    color: #64748b;
}

.article-audio-action {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 5. Indikator Mode Hover Aktif di Seluruh Halaman */
body.asr-hover-mode-active * {
    cursor: help !important;
}

body.asr-hover-mode-active .asr-hover-target {
    outline: 2px dashed #eab308 !important;
    outline-offset: 2px;
    background-color: rgba(254, 240, 138, 0.35) !important;
}

/* 6. Penyesuaian Responsif Layar Mobile */
@media (max-width: 768px) {
    #asr-player-dock {
        bottom: 8px;
        width: 96%;
        padding: 10px 14px;
        border-radius: 12px;
    }

    .asr-header-wrap {
        margin-bottom: 6px;
    }

    .asr-status-text {
        max-width: 50%;
        font-size: 0.75rem;
    }

    .asr-controls-row {
        gap: 6px;
    }

    .asr-btn {
        width: 34px;
        height: 34px;
        font-size: 0.88rem;
    }

    .asr-btn-play {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }

    .asr-pill-btn {
        padding: 4px 8px;
        font-size: 0.72rem;
    }

    .article-audio-player {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
    }

    .article-audio-action {
        justify-content: flex-end;
    }
}

/* Penyesuaian High Contrast untuk Seluruh Elemen Audio Reader */
body.high-contrast #asr-player-dock {
    background: #000000 !important;
    border-color: #ffff00 !important;
    box-shadow: 0 0 15px #ffff00 !important;
}

body.high-contrast .asr-status-text,
body.high-contrast .asr-badge-brand,
body.high-contrast .asr-pill-btn {
    color: #ffff00 !important;
    background: #111111 !important;
    border-color: #ffff00 !important;
}

body.high-contrast .asr-btn {
    background: #111111 !important;
    color: #ffff00 !important;
    border: 1px solid #ffff00 !important;
}

body.high-contrast .asr-btn-play {
    background: #ffff00 !important;
    color: #000000 !important;
}

body.high-contrast .article-audio-player {
    background: #000000 !important;
    border-color: #ffff00 !important;
}

body.high-contrast .article-audio-title,
body.high-contrast .article-audio-subtitle {
    color: #ffff00 !important;
}
