/* ==========================================================
   OTVUT Modern Ultra-Fast Video Player
   Minimal / Optimized CSS
   ========================================================== */

.video_player {
    --otv-orange: #ff7a00;
    --otv-bg: rgba(8, 8, 10, .92);
    --otv-border: rgba(255, 255, 255, .12);
    --otv-white: #fff;

    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 180px;
    background: #000;
    overflow: hidden;
    isolation: isolate;
    color: var(--otv-white);
    font-family: inherit;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.video_player video {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: contain;
    background: #000;
}

/* ==========================================================
   Loader
   ========================================================== */

.otv-loader {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease;
}

.otv-loader.visible {
    opacity: 1;
    visibility: visible;
}

.otv-loader span {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(255, 255, 255, .2);
    border-top-color: var(--otv-orange);
    border-radius: 50%;
    animation: otv-spin .65s linear infinite;
}

@keyframes otv-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================
   Error
   ========================================================== */

.otv-error {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: grid;
    place-content: center;
    gap: 12px;
    text-align: center;
    background: rgba(0, 0, 0, .72);
}

.otv-error[hidden] {
    display: none;
}

.otv-error-title {
    font-size: 14px;
    color: #fff;
}

.otv-retry {
    justify-self: center;
    border: 0;
    border-radius: 8px;
    padding: 8px 16px;
    background: var(--otv-orange);
    color: #fff;
    cursor: pointer;
}

/* ==========================================================
   Center Controls
   ========================================================== */

.otv-center {
    position: absolute;
    z-index: 15;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(18px, 5vw, 42px);
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s ease;
}

.video_player:hover .otv-center,
.video_player.otv-controls-visible .otv-center {
    opacity: 1;
}

.otv-center button {
    pointer-events: auto;
}

.otv-main-play,
.otv-seek {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition:
        transform .15s ease,
        background .15s ease;
}

.otv-main-play {
    width: 62px;
    height: 62px;
    font-size: 20px;
    background: rgba(0, 0, 0, .65);
}

.otv-seek {
    position: relative;
    font-size: 18px;
}

.otv-seek small {
    position: absolute;
    font-size: 8px;
    font-weight: 700;
    bottom: 12px;
}

.otv-main-play:hover,
.otv-seek:hover {
    background: var(--otv-orange);
    transform: scale(1.08);
}

/* ==========================================================
   Caption
   ========================================================== */

.otv-caption {
    position: absolute;
    z-index: 12;
    left: 5%;
    right: 5%;
    bottom: 78px;
    text-align: center;
    color: #fff;
    font-size: 16px;
    pointer-events: none;
    text-shadow:
        0 1px 3px #000,
        0 2px 8px #000;
}

/* ==========================================================
   Seek Preview
   ========================================================== */

.otv-seek-preview {
    position: absolute;
    z-index: 50;
    bottom: 62px;
    transform: translateX(-50%);
    padding: 5px 8px;
    border-radius: 5px;
    background: rgba(0, 0, 0, .88);
    color: #fff;
    font-size: 11px;
    pointer-events: none;
    white-space: nowrap;
}

.otv-seek-preview[hidden] {
    display: none;
}

/* ==========================================================
   Controls
   ========================================================== */

.otv-controls {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0 10px 8px;
    background:
        linear-gradient(
            to bottom,
            transparent,
            rgba(0, 0, 0, .92)
        );
    opacity: 0;
    visibility: hidden;
    transition:
        opacity .18s ease,
        visibility .18s ease;
}

.video_player:hover .otv-controls,
.video_player.otv-controls-visible .otv-controls {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================
   Progress
   ========================================================== */

.otv-progress-wrap {
    position: relative;
    height: 14px;
    cursor: pointer;
    touch-action: none;
}

.otv-buffer,
.otv-progress {
    position: absolute;
    left: 0;
    top: 5px;
    height: 4px;
    border-radius: 4px;
    pointer-events: none;
}

.otv-buffer {
    width: 0;
    background: rgba(255, 255, 255, .28);
}

.otv-progress {
    width: 0;
    background: var(--otv-orange);
}

.otv-progress span {
    position: absolute;
    right: -5px;
    top: 50%;
    width: 10px;
    height: 10px;
    transform: translateY(-50%);
    border-radius: 50%;
    background: var(--otv-orange);
    box-shadow: 0 0 8px rgba(255, 122, 0, .55);
}

.otv-seekbar {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 14px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

/* ==========================================================
   Toolbar
   ========================================================== */

.otv-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 32px;
    gap: 10px;
}

.otv-left,
.otv-right {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.otv-btn {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition:
        background .12s ease,
        color .12s ease;
}

.otv-btn:hover,
.otv-btn.active {
    background: rgba(255, 122, 0, .15);
    color: var(--otv-orange);
}

.otv-time {
    display: flex;
    gap: 4px;
    color: rgba(255, 255, 255, .9);
    font-size: 11px;
    white-space: nowrap;
}

/* ==========================================================
   Volume
   ========================================================== */

.otv-volume {
    display: flex;
    align-items: center;
}

.otv-volume-range {
    width: 0;
    opacity: 0;
    pointer-events: none;
    transition:
        width .15s ease,
        opacity .15s ease;
    accent-color: var(--otv-orange);
}

.otv-volume:hover .otv-volume-range,
.otv-volume:focus-within .otv-volume-range {
    width: 58px;
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================================
   Menus
   ========================================================== */

.otv-menu {
    position: absolute;
    z-index: 60;
    right: 10px;
    bottom: 52px;
    width: 220px;
    max-height: 320px;
    overflow: auto;
    padding: 6px;
    border: 1px solid var(--otv-border);
    border-radius: 12px;
    background: var(--otv-bg);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, .45);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.otv-menu[hidden] {
    display: none;
}

.otv-menu button {
    width: 100%;
    min-height: 38px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
}

.otv-menu button:hover,
.otv-menu button.active {
    background: rgba(255, 122, 0, .13);
    color: var(--otv-orange);
}

.otv-menu-home button {
    display: grid;
    grid-template-columns: 1fr auto 18px;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
}

.otv-menu-home strong {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255, 255, 255, .55);
}

.otv-menu-header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 4px;
    font-size: 13px;
    font-weight: 600;
}

.otv-menu-header button {
    width: 32px;
    min-height: 32px;
    text-align: center;
    font-size: 18px;
}

.otv-quality-list,
.otv-speed-list,
.otv-caption-list {
    display: grid;
    gap: 2px;
}

.otv-quality-list button,
.otv-speed-list button,
.otv-caption-list button {
    padding: 0 10px;
}

.otv-quality-list button.active,
.otv-speed-list button.active,
.otv-caption-list button.active {
    color: var(--otv-orange);
}

/* ==========================================================
   Fullscreen
   ========================================================== */

.video_player:fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    aspect-ratio: auto;
    background: #000;
}

.video_player:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    aspect-ratio: auto;
    background: #000;
}

/* ==========================================================
   Mobile
   ========================================================== */

@media (max-width: 600px) {
    .video_player {
        min-height: 150px;
    }

    .otv-center {
        gap: 22px;
    }

    .otv-main-play {
        width: 52px;
        height: 52px;
    }

    .otv-seek {
        width: 42px;
        height: 42px;
    }

    .otv-toolbar {
        min-height: 30px;
    }

    .otv-btn {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }

    .otv-volume-range {
        display: none;
    }

    .otv-menu {
        right: 6px;
        bottom: 48px;
        width: min(220px, calc(100% - 12px));
    }

    .otv-caption {
        bottom: 68px;
        font-size: 14px;
    }
}

/* ==========================================================
   Reduced Motion
   ========================================================== */

@media (prefers-reduced-motion: reduce) {
    .otv-loader span {
        animation: none;
    }

    .otv-center,
    .otv-controls,
    .otv-btn,
    .otv-main-play,
    .otv-seek {
        transition: none;
    }
}
