/* Video Player с таймкодами v1.3.0 */
.vtp-wrap {
    --vtp-accent: #1a7fc4;
    --vtp-bg: transparent;
    --vtp-text: #1a1a1a;
    --vtp-muted: #6b7280;
    --vtp-border: #e5e7eb;
    --vtp-track: rgba(255, 255, 255, 0.35);
    --vtp-hover: #f3f4f6;
    --vtp-active-bg: #eff6ff;
    --vtp-tc-bg: #ffffff;
    --vtp-video-bg: #000000;
    --vtp-video-radius: 0px;
    --vtp-aspect: 16 / 9;
    --vtp-aspect-w: 16;
    --vtp-aspect-h: 9;
    --vtp-video-max-h: none;
    --vtp-video-frame-h: 360px;
    --vtp-overlay-size: 72px;
    --vtp-bar-play-size: 28px;
    --vtp-bar-seek-width: 55%;
    --vtp-bar-gap: 8px;
    --vtp-bar-fg: #ffffff;
    --vtp-bar-muted: rgba(255, 255, 255, 0.85);
    --vtp-tc-max-w: 220px;
    --vtp-tc-gap: 8px;
    --vtp-tc-radius: 999px;
    --vtp-tc-padding-x: 12px;
    --vtp-tc-padding-y: 8px;
    --vtp-tc-margin-top: 12px;
    --vtp-tc-track-padding-x: 0px;

    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
    font-family: inherit;
    box-shadow: none;
    color: var(--vtp-text);
}

.vtp-wrap.vtp-dark {
    --vtp-text: #e5e7eb;
    --vtp-muted: #9ca3af;
    --vtp-border: #374151;
    --vtp-hover: #2d3748;
    --vtp-active-bg: #1e3a5f;
    --vtp-tc-bg: #1e1e2e;
}

.vtp-video-shell {
    position: relative;
    border-radius: var(--vtp-video-radius);
    overflow: hidden;
    background: var(--vtp-video-bg);
    line-height: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.vtp-wrap[data-vtp-fit="contain"] .vtp-video-shell {
    aspect-ratio: var(--vtp-aspect);
    max-height: var(--vtp-video-max-h);
    width: 100%;
}

.vtp-wrap[data-vtp-fit="contain"] .vtp-video {
    display: block;
    width: 100%;
    height: 100%;
    max-height: var(--vtp-video-max-h);
    object-fit: contain;
    background: var(--vtp-video-bg);
}

.vtp-wrap[data-vtp-fit="cover-frame"] .vtp-video-shell {
    height: var(--vtp-video-max-h, var(--vtp-video-frame-h));
    max-height: var(--vtp-video-max-h, var(--vtp-video-frame-h));
}

.vtp-wrap[data-vtp-fit="cover-frame"] .vtp-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--vtp-video-bg);
}

.vtp-wrap[data-vtp-fit="cover-custom"] .vtp-video-shell {
    width: 100%;
    aspect-ratio: var(--vtp-aspect);
    max-height: var(--vtp-video-max-h, none);
    overflow: hidden;
}

.vtp-wrap[data-vtp-fit="cover-custom"] .vtp-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--vtp-video-bg);
}

/* Центральный play — только когда видео на паузе */
.vtp-overlay-play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: var(--vtp-overlay-size);
    height: var(--vtp-overlay-size);
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: opacity 0.2s, transform 0.15s;
}

.vtp-overlay-play:hover {
    transform: scale(1.05);
}

.vtp-wrap.vtp-playing .vtp-overlay-play {
    display: none;
}

.vtp-overlay-play img.vtp-icon-play {
    width: var(--vtp-overlay-size);
    height: var(--vtp-overlay-size);
}

/* Панель: play + время + (полоска + mute); тень только под полоской */
.vtp-video-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: var(--vtp-bar-gap, 8px);
    padding: 10px 12px 12px;
    background: transparent;
    line-height: normal;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}

.vtp-bar-play {
    flex-shrink: 0;
    width: var(--vtp-bar-play-size);
    height: var(--vtp-bar-play-size);
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vtp-bar-fg);
    align-self: center;
}

.vtp-bar-play img.vtp-bar-icon-play {
    width: var(--vtp-bar-play-size);
    height: var(--vtp-bar-play-size);
    display: block;
}

.vtp-bar-play svg.vtp-bar-icon-pause {
    width: var(--vtp-bar-play-size);
    height: var(--vtp-bar-play-size);
    padding: calc(var(--vtp-bar-play-size) * 0.18);
    box-sizing: border-box;
    border-radius: 0;
    background: transparent;
    color: var(--vtp-bar-fg);
    fill: currentColor;
}

.vtp-bar-cur {
    flex-shrink: 0;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--vtp-bar-muted);
    min-width: 0;
    white-space: nowrap;
}

/* seek + mute — одна группа, ширина из Elementor */
.vtp-bar-track-group {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--vtp-bar-gap, 8px);
    flex: 0 1 var(--vtp-bar-seek-width, 55%);
    width: var(--vtp-bar-seek-width, 55%);
    max-width: var(--vtp-bar-seek-width, 55%);
    min-width: 0;
}

.vtp-bar-seek-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 48px;
    height: 20px;
    display: flex;
    align-items: center;
}

.vtp-progress-track {
    position: absolute;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--vtp-track);
    border-radius: 2px;
    pointer-events: none;
}

.vtp-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--vtp-accent);
    border-radius: 2px;
    transition: width 0.1s linear;
}

.vtp-seek {
    position: absolute;
    left: 0;
    right: 0;
    width: 100%;
    height: 20px;
    opacity: 0;
    cursor: pointer;
    margin: 0;
}

.vtp-bar-mute {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--vtp-bar-fg);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.vtp-bar-volume {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.vtp-volume-pop {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    padding: 10px 6px;
    background: rgba(0, 0, 0, 0.88);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 12;
    touch-action: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.vtp-volume-pop[hidden] {
    display: none;
}

/* Вертикальный слайдер: горизонтальный range −90° (стабильнее writing-mode; не ломается темой Astra) */
.vtp-volume-wrap {
    width: 32px;
    height: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.vtp-volume {
    width: 84px;
    height: 24px;
    margin: 0;
    padding: 0;
    transform: rotate(-90deg);
    transform-origin: center center;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    touch-action: none;
    accent-color: var(--vtp-accent);
}

.vtp-volume::-webkit-slider-runnable-track {
    height: 4px;
    background: var(--vtp-track);
    border-radius: 2px;
}

.vtp-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border-radius: 50%;
    background: var(--vtp-accent);
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.vtp-volume::-moz-range-track {
    height: 4px;
    background: var(--vtp-track);
    border-radius: 2px;
    border: none;
}

.vtp-volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--vtp-accent);
    border: 2px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.vtp-bar-fullscreen {
    flex: 0 0 auto;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--vtp-bar-fg);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.vtp-bar-fullscreen:hover {
    color: var(--vtp-bar-muted);
}

.vtp-bar-fullscreen svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Полноэкранный режим — shell с панелью на видео */
.vtp-video-shell:fullscreen,
.vtp-video-shell:-webkit-full-screen {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    background: var(--vtp-video-bg);
}

.vtp-video-shell:fullscreen .vtp-video,
.vtp-video-shell:-webkit-full-screen .vtp-video {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
}

.vtp-wrap.vtp-fs .vtp-overlay-play img.vtp-icon-play {
    width: min(var(--vtp-overlay-size), 18vw);
    height: min(var(--vtp-overlay-size), 18vw);
}

.vtp-volume:focus {
    outline: none;
}

.vtp-volume:focus-visible {
    outline: 2px solid var(--vtp-accent);
    outline-offset: 2px;
}

.vtp-bar-mute:hover {
    color: var(--vtp-bar-muted);
}

.vtp-bar-mute svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Таймкоды — только внутри секции, без раздувания страницы */
.vtp-timecodes {
    margin-top: var(--vtp-tc-margin-top);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-left: var(--vtp-tc-track-padding-x);
    padding-right: var(--vtp-tc-track-padding-x);
    box-sizing: border-box;
}

.vtp-timecodes-track {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--vtp-tc-gap);
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--vtp-accent) var(--vtp-border);
    cursor: grab;
    user-select: none;
}

.vtp-timecodes-track.vtp-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
}

.vtp-timecodes-track::-webkit-scrollbar {
    height: 6px;
}

.vtp-timecodes-track::-webkit-scrollbar-thumb {
    background: var(--vtp-accent);
    border-radius: 3px;
}

.vtp-timecodes-track::-webkit-scrollbar-track {
    background: var(--vtp-border);
    border-radius: 3px;
}

.vtp-tc-btn {
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: max-content;
    max-width: var(--vtp-tc-max-w);
    padding: var(--vtp-tc-padding-y) var(--vtp-tc-padding-x);
    border: 1px solid var(--vtp-border);
    border-radius: var(--vtp-tc-radius);
    background: var(--vtp-tc-bg);
    color: var(--vtp-text);
    cursor: pointer;
    scroll-snap-align: start;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    font: inherit;
    text-align: left;
    user-select: none;
}

.vtp-timecodes-track.vtp-dragging .vtp-tc-btn {
    pointer-events: none;
}

.vtp-tc-btn:hover {
    background: var(--vtp-hover);
    border-color: var(--vtp-accent);
}

.vtp-tc-btn.vtp-active {
    background: var(--vtp-active-bg);
    border-color: var(--vtp-accent);
    box-shadow: 0 0 0 1px var(--vtp-accent);
}

.vtp-tc-btn.vtp-active .vtp-tc-time {
    color: var(--vtp-accent);
}

.vtp-tc-btn.vtp-active .vtp-tc-label {
    font-weight: 600;
}

.vtp-tc-time {
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--vtp-muted);
    line-height: 1.2;
}

.vtp-tc-label {
    font-size: 13px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(var(--vtp-tc-max-w) - 24px);
}

@media (max-width: 480px) {
    .vtp-tc-label {
        font-size: 12px;
        max-width: 140px;
    }

    .vtp-video-bar {
        gap: 6px;
        padding: 8px 8px 10px;
    }
}

/* Elementor: виджет не шире колонки секции */
.elementor-widget-video_timecodes {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.elementor-widget-video_timecodes .elementor-widget-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
