/* ============================================================
   VozKnig AudioPlayer v3
   ============================================================ */

/* ── Нижняя панель ─────────────────────────────────────────── */

.vk-player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #1a1d23;
    border-top: 1px solid #2e3240;
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    font-family: 'Inter', Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    will-change: transform;
    -webkit-transform: translateY(100%);
    padding-bottom: env(safe-area-inset-bottom, 0);
    display: flex;
    flex-direction: column;
}

.vk-player-bar--visible {
    transform: translateY(0);
    -webkit-transform: translateY(0);
}

/* ── Прогресс-бар ─────────────────────────────────────────── */

.vk-bar__progress-wrap {
    padding: 0;
    cursor: pointer;
}

/* Прогресс-бар всегда виден на всех экранах */

.vk-bar__progress {
    position: relative;
    height: 3px;
    background: #2e3240;
    overflow: visible;
    transition: height .15s;
}

.vk-bar__progress:hover { height: 5px; }

.vk-bar__fill {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 0;
    background: linear-gradient(90deg, #4f8ef7, #7b6cf7);
    border-radius: 0 3px 3px 0;
    pointer-events: none;
    transition: width .1s linear;
}

.vk-bar__handle {
    position: absolute;
    top: 50%;
    left: 0;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    margin-left: -6px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,.5);
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
}

.vk-bar__progress:hover .vk-bar__handle { opacity: 1; }

/* ── Десктопная строка (скрыта на мобайле) ─────────────────── */

.vk-bar__body {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    min-height: 56px;
}

@media (max-width: 600px) {
    .vk-bar__body { display: none; }
}

/* Прогресс-бар виден на всех экранах, включая мобайл */

.vk-bar__cover {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 4px;
    background: #2e3240 center/cover no-repeat;
    flex-shrink: 0;
}

.vk-bar__info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.vk-bar__title {
    font-size: 12px;
    color: #8892a4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.vk-bar__subtitle {
    font-size: 13px;
    font-weight: 500;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    margin-top: 1px;
}

.vk-bar__controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.vk-bar__btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8892a4;
    transition: color .15s;
    font-size: 12px;
    width: 28px;
    height: 28px;
    -webkit-tap-highlight-color: transparent;
}

.vk-bar__btn:hover { color: #e2e8f0; }

.vk-btn-play {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #4f8ef7, #7b6cf7) !important;
    color: #fff !important;
    font-size: 14px !important;
    box-shadow: 0 2px 8px rgba(79,142,247,.35);
    transition: transform .15s, box-shadow .15s !important;
}

.vk-btn-play:hover {
    transform: scale(1.07);
    box-shadow: 0 4px 14px rgba(79,142,247,.5) !important;
    color: #fff !important;
}

.vk-bar__time {
    font-size: 12px;
    color: #8892a4;
    flex-shrink: 0;
    min-width: 70px;
    text-align: center;
    line-height: 1;
}

.vk-bar__time-sep { margin: 0 2px; opacity: .5; }

.vk-bar__close {
    background: none;
    border: none;
    cursor: pointer;
    color: #4a5568;
    font-size: 14px;
    padding: 4px;
    line-height: 1;
    transition: color .15s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.vk-bar__close:hover { color: #e2e8f0; }

/* Крупный крестик для мобайла */
.vk-bar__close--lg {
    font-size: 18px;
    padding: 6px 8px;
}

/* ── Доп. кнопки десктопа ─────────────────────────────────── */

.vk-bar__extra {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* ── Громкость ─────────────────────────────────────────────── */

.vk-bar__vol-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.vk-bar__vol-btn {
    background: #2e3240;
    border: none;
    border-radius: 5px;
    color: #8892a4;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 7px;
    min-width: 36px;
    line-height: 1.6;
    transition: color .15s, background .15s;
    -webkit-tap-highlight-color: transparent;
}

.vk-bar__vol-btn:hover { color: #e2e8f0; background: #3a4055; }

.vk-bar__vol-popup {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1d23;
    border: 1px solid #2e3240;
    border-radius: 10px;
    padding: 14px 0 10px;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 110px;
    z-index: 10001;
    box-shadow: 0 4px 16px rgba(0,0,0,.5);
}

.vk-bar__vol-popup--open { display: flex; }

/* Мобильный попап — открывается вверх, но учитывает expanded-панель */
.vk-bar__vol-popup--mob {
    bottom: calc(100% + 6px);
}

.vk-bar__vol-slider {
    -webkit-appearance: slider-vertical;
    appearance: slider-vertical;
    writing-mode: vertical-lr;
    direction: rtl;
    width: 4px;
    height: 80px;
    background: #2e3240;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    padding: 0;
}

.vk-bar__vol-slider::-webkit-slider-runnable-track {
    width: 4px;
    background: linear-gradient(to top, #4f8ef7 var(--vol, 100%), #2e3240 var(--vol, 100%));
    border-radius: 3px;
}

.vk-bar__vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.5);
    margin-left: -5px;
}

.vk-bar__vol-slider::-moz-range-thumb {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.5);
}

.vk-bar__vol-slider::-moz-range-track {
    width: 4px;
    background: #2e3240;
    border-radius: 3px;
}

/* ── Скорость ──────────────────────────────────────────────── */

.vk-bar__speed-wrap { position: relative; }

.vk-bar__speed-btn {
    background: #2e3240;
    border: none;
    border-radius: 5px;
    color: #8892a4;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 7px;
    min-width: 36px;
    transition: color .15s, background .15s;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
}

.vk-bar__speed-btn:hover { color: #e2e8f0; background: #3a4055; }

.vk-bar__speed-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1d23;
    border: 1px solid #2e3240;
    border-radius: 8px;
    overflow: hidden;
    min-width: 80px;
    z-index: 10001;
    box-shadow: 0 4px 16px rgba(0,0,0,.5);
}

.vk-bar__speed-menu--open { display: block; }

.vk-speed__item {
    padding: 8px 14px;
    font-size: 13px;
    color: #8892a4;
    cursor: pointer;
    text-align: center;
    transition: background .12s, color .12s;
}

.vk-speed__item:hover { background: #232736; color: #e2e8f0; }
.vk-speed__item--active { color: #4f8ef7; font-weight: 600; }

/* ── Таймер ────────────────────────────────────────────────── */

.vk-bar__timer-wrap { position: relative; }

.vk-bar__timer-btn {
    background: #2e3240;
    border: none;
    border-radius: 5px;
    color: #8892a4;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 7px;
    min-width: 36px;
    line-height: 1.4;
    transition: color .15s, background .15s;
    -webkit-tap-highlight-color: transparent;
}

.vk-bar__timer-btn:hover { color: #e2e8f0; background: #3a4055; }

.vk-bar__timer-btn--active {
    color: #f7a74f !important;
    background: #2e2a1a !important;
}

.vk-bar__timer-menu {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: #1a1d23;
    border: 1px solid #2e3240;
    border-radius: 8px;
    overflow: hidden;
    min-width: 110px;
    z-index: 10001;
    box-shadow: 0 4px 16px rgba(0,0,0,.5);
}

/* Мобильный таймер — открывается левее */
.vk-bar__timer-menu--mob {
    right: auto;
    left: 50%;
    transform: translateX(-50%);
}

.vk-bar__timer-menu--open { display: block; }

.vk-timer__label {
    padding: 8px 14px 4px;
    font-size: 11px;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.vk-timer__item {
    padding: 7px 14px;
    font-size: 13px;
    color: #8892a4;
    cursor: pointer;
    transition: background .12s, color .12s;
}

.vk-timer__item:hover { background: #232736; color: #e2e8f0; }
.vk-timer__item--cancel { color: #e74c3c; border-top: 1px solid #2e3240; margin-top: 2px; }
.vk-timer__item--cancel:hover { background: #2a1a1a; color: #ff6b6b; }

/* ── Мобильная компактная строка (показывается на ≤600px) ───── */

.vk-bar__mobile-compact {
    display: none;
}

@media (max-width: 600px) {
    .vk-bar__mobile-compact {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 7px 10px;
        min-height: 52px;
    }
}

.vk-bar__cover--sm {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border-radius: 4px;
    background: #2e3240 center/cover no-repeat;
    flex-shrink: 0;
}

.vk-bar__mobile-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.vk-bar__subtitle--sm {
    font-size: 12px;
    font-weight: 500;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    margin-top: 0;
}

.vk-bar__controls--mobile {
    gap: 2px !important;
    flex-shrink: 0;
}

.vk-btn-play--sm {
    width: 38px !important;
    height: 38px !important;
    font-size: 13px !important;
    margin: 0 2px;
}

/* Стрелка «развернуть» */
.vk-bar__arrow-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #4a5568;
    font-size: 14px;
    padding: 6px 8px;
    line-height: 1;
    transition: color .15s, transform .25s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.vk-bar__arrow-btn:hover { color: #ffffff; }

.vk-bar__arrow-btn--up {
    transform: rotate(180deg);
    color: #7b9ef7;
}

.vk-bar__arrow-btn--up:hover { color: #ffffff; }

/* ── Мобильная расширенная строка — показывается НАД компактной ── */

.vk-bar__mobile-extra {
    display: none;
}

@media (max-width: 600px) {
    .vk-bar__mobile-extra {
        display: none;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 6px 10px 8px;
        border-top: 1px solid #2e3240;
        flex-wrap: wrap;
    }

    .vk-bar__mobile-extra--open {
        display: flex;
    }
}

.vk-bar__mobile-time {
    font-size: 12px;
    color: #8892a4;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Кнопка глав */
.vk-bar__chapters-btn {
    background: #2e3240;
    border: none;
    border-radius: 5px;
    color: #8892a4;
    font-size: 15px;
    cursor: pointer;
    padding: 4px 9px;
    min-width: 36px;
    line-height: 1.5;
    transition: color .15s, background .15s;
    -webkit-tap-highlight-color: transparent;
}

.vk-bar__chapters-btn:hover { color: #e2e8f0; background: #3a4055; }

/* ── Оверлей глав (полноэкранный) ──────────────────────────── */

.vk-chapters-overlay {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 10000;
    background: #13161e;
    flex-direction: column;
    overflow: hidden;
}

.vk-chapters-overlay--open {
    display: flex;
}

.vk-chapters-overlay__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px 10px;
    border-bottom: 1px solid #2e3240;
    flex-shrink: 0;
}

.vk-chapters-overlay__title {
    font-size: 16px;
    font-weight: 600;
    color: #e2e8f0;
    line-height: 1.3;
}

.vk-chapters-overlay__sub {
    font-size: 12px;
    color: #4a5568;
    margin-top: 3px;
}

.vk-chapters-overlay__close {
    background: none;
    border: none;
    color: #4a5568;
    font-size: 20px;
    cursor: pointer;
    /* фиксированный размер чтобы иконка × не «прыгала» при ховере */
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    line-height: 1;
    transition: color .15s, background .15s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.vk-chapters-overlay__close:hover {
    color: #ffffff;
    background: #252836;
}

.vk-chapters-overlay__list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.vk-chapters-overlay__list::-webkit-scrollbar { width: 4px; }
.vk-chapters-overlay__list::-webkit-scrollbar-track { background: #13161e; }
.vk-chapters-overlay__list::-webkit-scrollbar-thumb { background: #2e3240; border-radius: 2px; }

.vk-chapters-overlay__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    cursor: pointer;
    border-bottom: 1px solid #1e2130;
    transition: background .12s;
    -webkit-tap-highlight-color: transparent;
}

.vk-chapters-overlay__item:last-child { border-bottom: none; }
.vk-chapters-overlay__item:hover { background: #1e2235; }

.vk-chapters-overlay__item--active {
    background: #1c2540;
}

.vk-chapters-overlay__item--active .vk-chapters-overlay__num,
.vk-chapters-overlay__item--active .vk-chapters-overlay__track {
    color: #4f8ef7;
}

.vk-chapters-overlay__num {
    font-size: 13px;
    color: #4a5568;
    min-width: 26px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.vk-chapters-overlay__track {
    flex: 1;
    font-size: 14px;
    color: #c5cdd8;
    line-height: 1.4;
}

.vk-chapters-overlay__dur {
    font-size: 13px;
    color: #4a5568;
    min-width: 40px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* ── Спиннер загрузки ──────────────────────────────────────── */

@keyframes vk-spin {
    to { transform: rotate(360deg); }
}

.vk-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: vk-spin .7s linear infinite;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Спиннер в инлайн-кнопке (она крупнее) */
.vk-inline__play .vk-spinner {
    width: 18px;
    height: 18px;
    border-width: 2.5px;
}

/* Кнопка в состоянии загрузки не реагирует на клики */
.vk-btn--loading {
    pointer-events: none;
    opacity: .85;
}

/* ── Toast ─────────────────────────────────────────────────── */

.vk-toast {
    position: fixed;
    left: 50%;
    bottom: 80px;
    transform: translateX(-50%) translateY(10px);
    background: rgba(30,35,48,.97);
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.5;
    padding: 10px 18px;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
    z-index: 20000;
    white-space: pre-line;
    text-align: center;
    opacity: 0;
    transition: opacity .3s, transform .3s;
    pointer-events: none;
    font-family: 'Inter', Arial, sans-serif;
}

.vk-toast--show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Инлайн-блок на странице ─────────────────────────────────── */

.vk-inline-player {
    background: #1e2330;
    border: 1px solid #2e3240;
    border-radius: 10px;
    overflow: hidden;
    font-family: 'Inter', Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    margin: 16px 0;
}

.vk-inline__top {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
}

.vk-inline__play {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #4f8ef7, #7b6cf7);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(79,142,247,.4);
    transition: transform .15s, box-shadow .15s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.vk-inline__play:hover {
    transform: scale(1.07);
    box-shadow: 0 4px 16px rgba(79,142,247,.55);
}

.vk-inline__meta { flex: 1; min-width: 0; }

.vk-inline__track {
    font-size: 13px;
    font-weight: 500;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.vk-inline__time {
    font-size: 12px;
    color: #8892a4;
    margin-top: 2px;
    line-height: 1;
}

.vk-inline__list-toggle {
    background: none;
    border: 1px solid #2e3240;
    border-radius: 6px;
    color: #8892a4;
    font-size: 14px;
    cursor: pointer;
    padding: 6px 10px;
    transition: color .15s, border-color .15s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.vk-inline__list-toggle:hover { color: #e2e8f0; border-color: #4f8ef7; }

.vk-inline__list {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
    border-top: 0 solid #2e3240;
}

.vk-inline__list--open {
    max-height: 400px;
    overflow-y: auto;
    border-top-width: 1px;
}

.vk-inline__list::-webkit-scrollbar { width: 4px; }
.vk-inline__list::-webkit-scrollbar-track { background: #1a1d23; }
.vk-inline__list::-webkit-scrollbar-thumb { background: #2e3240; border-radius: 2px; }

.vk-inline__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    border-bottom: 1px solid #232736;
    transition: background .12s;
    -webkit-tap-highlight-color: transparent;
}

.vk-inline__item:last-child { border-bottom: none; }
.vk-inline__item:hover { background: #232736; }
.vk-inline__item--active { background: #1c2540; }
.vk-inline__item--active .vk-inline__item-num { color: #4f8ef7; }
.vk-inline__item--active .vk-inline__item-title { color: #fff; }

.vk-inline__item-num {
    font-size: 12px;
    color: #4a5568;
    min-width: 22px;
    font-variant-numeric: tabular-nums;
}

.vk-inline__item-title {
    flex: 1;
    font-size: 13px;
    color: #c5cdd8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.vk-inline__item-dur {
    font-size: 12px;
    color: #4a5568;
    min-width: 36px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
