/* ==========================================================================
   Vinegret Article Audio Reader v2.0 - Professional Interactive Player UI
   Без зовнішньої підкладки/рамки, сучасна капсула з інтерактивним прогрес-баром
   ========================================================================== */

.vng-tts-player {
    margin: 14px 0 22px 0;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
    box-sizing: border-box;
    width: 100%;
    position: relative;
    z-index: 5;
}

/* Основна кнопка (Play / Pause) */
.vng-tts-main-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: linear-gradient(135deg, #e02424 0%, #c81e1e 100%);
    color: #ffffff !important;
    border: none;
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    line-height: 1.2;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: 0 3px 10px rgba(224, 36, 36, 0.28);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.vng-tts-main-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(224, 36, 36, 0.38);
    background: linear-gradient(135deg, #ef2b2b 0%, #d11f1f 100%);
}

.vng-tts-main-btn:active {
    transform: translateY(0) scale(0.98);
}

.vng-tts-main-btn.is-playing {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.25);
}

.vng-tts-main-btn.is-paused {
    background: linear-gradient(135deg, #e02424 0%, #b91c1c 100%);
}

.vng-tts-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.vng-tts-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    display: block;
}

/* Анімований еквалайзер під час читання */
.vng-tts-wave {
    display: none;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
    margin-left: 2px;
}

.vng-tts-main-btn.is-playing .vng-tts-wave {
    display: inline-flex;
}

.vng-tts-wave span {
    display: block;
    width: 2.5px;
    background: #ef4444;
    border-radius: 2px;
    animation: vngWaveAnim 0.9s ease-in-out infinite;
}

.vng-tts-wave span:nth-child(1) { height: 6px; animation-delay: 0s; }
.vng-tts-wave span:nth-child(2) { height: 13px; animation-delay: 0.2s; }
.vng-tts-wave span:nth-child(3) { height: 9px; animation-delay: 0.4s; }

@keyframes vngWaveAnim {
    0%, 100% { transform: scaleY(0.45); opacity: 0.75; }
    50% { transform: scaleY(1); opacity: 1; }
}

/* Панель керування та смуга прокрутки (з'являється при старті або збереженому прогресі) */
.vng-tts-controls {
    display: none;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 240px;
    max-width: 520px;
    animation: vngFadeIn 0.22s ease forwards;
}

.vng-tts-controls.is-visible {
    display: flex;
}

@keyframes vngFadeIn {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Круглі кнопки навігації (Назад / Вперед / Стоп) */
.vng-tts-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(156, 163, 175, 0.35);
    background: rgba(255, 255, 255, 0.92);
    color: #374151;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    -webkit-tap-highlight-color: transparent;
}

.vng-tts-nav-btn:hover {
    background: #f3f4f6;
    color: #111827;
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.vng-tts-nav-btn:active {
    transform: scale(0.95);
}

.vng-tts-nav-btn svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
    display: block;
}

/* Контейнер смуги прокрутки (Seek Bar) */
.vng-tts-scrubber-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 110px;
    padding: 0 4px;
}

.vng-tts-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(to right, #e02424 0%, #e02424 var(--vng-progress, 0%), #e5e7eb var(--vng-progress, 0%), #e5e7eb 100%);
    outline: none;
    cursor: pointer;
    margin: 0;
    transition: height 0.15s ease;
}

.vng-tts-range:hover {
    height: 8px;
}

.vng-tts-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e02424;
    border: 2.5px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.vng-tts-range::-webkit-slider-thumb:hover {
    transform: scale(1.18);
    background: #b91c1c;
}

.vng-tts-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e02424;
    border: 2.5px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.15s ease;
}

/* Індикатор прогресу (%) */
.vng-tts-progress-label {
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #4b5563;
    min-width: 34px;
    text-align: right;
    user-select: none;
}

/* Кнопка перемикання швидкості (1x -> 1.15x -> 1.25x -> 1.5x -> 0.9x) */
.vng-tts-speed-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid rgba(156, 163, 175, 0.35);
    background: rgba(255, 255, 255, 0.92);
    color: #1f2937;
    font-size: 12.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.vng-tts-speed-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Світле делікатне підсвічування поточного абзацу при читанні */
.vng-tts-active-block {
    background-color: rgba(224, 36, 36, 0.055) !important;
    border-radius: 6px;
    box-shadow: -4px 0 0 0 #e02424;
    padding-left: 10px !important;
    margin-left: -10px !important;
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

/* Підтримка темної теми сайту (Boombox Dark Mode) */
body.dark-mode .vng-tts-nav-btn,
body.dark-mode .vng-tts-speed-btn,
html.dark .vng-tts-nav-btn,
html.dark .vng-tts-speed-btn {
    background: rgba(31, 41, 55, 0.9);
    border-color: rgba(75, 85, 99, 0.6);
    color: #f3f4f6;
}

body.dark-mode .vng-tts-range,
html.dark .vng-tts-range {
    background: linear-gradient(to right, #e02424 0%, #e02424 var(--vng-progress, 0%), #374151 var(--vng-progress, 0%), #374151 100%);
}

body.dark-mode .vng-tts-progress-label,
html.dark .vng-tts-progress-label {
    color: #9ca3af;
}

/* Адаптивність для мобільних пристроїв */
@media (max-width: 640px) {
    .vng-tts-player {
        gap: 8px;
        margin: 12px 0 18px 0;
    }

    .vng-tts-main-btn {
        padding: 10px 16px;
        font-size: 13.5px;
    }

    .vng-tts-controls {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        margin-top: 2px;
        gap: 6px;
    }

    .vng-tts-nav-btn {
        width: 32px;
        height: 32px;
    }

    .vng-tts-speed-btn {
        height: 32px;
        padding: 0 9px;
        font-size: 12px;
    }
}
