/* =============== BASE STYLING =============== */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background: #000;
    touch-action: pan-y;
}

/* =============== SWIPER CONTAINER STYLING =============== */
.swiper-container {
    width: 100%;
    height: 100%;
    position: relative;
    user-select: none;
}

.swiper-wrapper {
    z-index: 2;
}

.swiper-slide {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    position: relative;
    height: 100%;
    background: none;
}

.mySwiper-short .swiper-slide {
    background: none;
}

/* =============== VIDEO CONTAINER STYLING =============== */
.video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: none;
}

.video-container.active {
    display: block;
}

.video-container-placeholder {
    display: none;
}

.swiper-slide .video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: block;
}

.swiper-slide .video-container.vjs-fullscreen {
    z-index: 9999;
}

.video-js {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-js .vjs-control-bar,
.video-js .vjs-big-play-button {
    display: none !important;
}

video {
    transition: opacity 0.15s ease-out;
}

/* =============== VIDEO POSTER =============== */
.video-poster {
    transition: opacity 0.3s ease;
}

.video-poster.v-hidden {
    opacity: 0;
    pointer-events: none;
}

.swiper-slide .video-container.active + .item-ev .video-poster {
    /* opacity: 0; */
    transition: opacity 0.3s ease;
}

/* =============== VIDEO INFO & UI ELEMENTS =============== */
.video-short-info {
    position: relative;
    z-index: 2;
}

.swiper-slide .item-ev {
    z-index: 2;
}

.format-selector {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 4;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px;
    border-radius: 5px;
}

.format-selector select {
    background: #333;
    color: #fff;
    border: none;
    padding: 5px;
    font-size: 0.9em;
    border-radius: 3px;
    cursor: pointer;
}

.debug-box {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 4;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px;
    font-size: 0.8em;
    border-radius: 5px;
    max-width: 200px;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.4;
}

/* =============== PLAYBACK CONTROLS =============== */
/* Play/Pause Button */
.play-pause-button {
    display: none;
    width: 80px;
    height: 80px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M6 19h4V5H6v14zm8-14v14h4V5h-4z'/%3E%3C/svg%3E");
    background-size: 50%;
    background-position: center;
    background-repeat: no-repeat;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: absolute;
    top: calc(50% - 40px);
    left: calc(50% - 40px);
    z-index: 2;
}

.play-pause-button.paused {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
    opacity: 1;
    display: block;
}

.play-pause-icon {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    font-size: 3em;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.play-pause-icon.show {
    display: block;
    opacity: 1;
}

/* =============== PROGRESS BAR COMPONENTS =============== */
/* Main container */
.progress-container {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3;
    cursor: pointer;
    touch-action: none;
    opacity: 0;
    transition: opacity 0.3s ease, width 0.3s ease, left 0.3s ease;
    overflow: hidden;
}

.progress-container.show-progress {
    opacity: 1;
    width: 100%;
    overflow: hidden;
}

.progress-container.scrubbing {
    height: 6px;
    opacity: 1 !important;
}

/* Progress components */
.progress-total {
    width: 100%;
    height: 100%;
    background: #555;
    position: relative;
}

.progress-played {
    height: 100%;
    background: #ff2d55;
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
}

.progress-buffer {
    height: 100%;
    background: #888;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0.5;
    width: 0;
}

.progress-total,
.progress-played,
.progress-buffer {
    border-radius: inherit;
}

/* Progress handle */
.progress-handle {
    position: absolute;
    top: -5px;
    width: 16px;
    height: 16px;
    background: #ff2d55;
    border-radius: 50%;
    transform: translateX(-50%);
    z-index: 3;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.progress-container:hover .progress-handle,
.progress-container.scrubbing .progress-handle {
    opacity: 1;
}

/* Progress hover area */
.progress-hover-area {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 25px;
    z-index: 2;
    pointer-events: auto;
    background: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.progress-hover-area:hover + .progress-container,
.progress-container:hover {
    opacity: 1;
    width: 100%;
    overflow: hidden;
}

/* Tooltip & hover effects */
.progress-tooltip {
    position: absolute;
    bottom: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 10;
    display: none;
    white-space: nowrap;
}

.progress-container:hover .progress-tooltip,
.progress-container.touched .progress-tooltip {
    display: block;
}

.progress-hover-line {
    position: absolute;
    top: -10px;
    height: 26px;
    width: 2px;
    background: #fff;
    transform: translateX(-50%);
    pointer-events: none;
    display: none;
    z-index: 9;
}

.progress-container:hover .progress-hover-line {
    display: block;
}

.progress-preview {
    position: absolute;
    bottom: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    transform: translateX(-50%);
    display: none;
    pointer-events: none;
    z-index: 10;
}

.progress-container.scrubbing .progress-preview {
    display: block;
}

/* =============== LOADING ANIMATION =============== */
.loading-line {
    display: none;
    position: absolute;
    left: 0;
    top: 0px;
    width: 100%;
    height: 7px;
    background: linear-gradient(90deg, transparent, #ff2d55, transparent);
    z-index: 5;
    opacity: 0;
    transition: opacity 0.2s ease;
    animation: loading-line-animation 1.5s ease-in-out infinite;
}

.loading-line.show {
    display: block;
    opacity: 1;
}

.mySwiper-short .button-slide {
    z-index: 10;
}

.poster-fade-out {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.video-poster {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* =============== ANIMATIONS =============== */
@keyframes loading-line-animation {
    0% {
        transform: scaleX(0.1);
        opacity: 0.7;
    }

    50% {
        transform: scaleX(1);
        opacity: 1;
    }

    100% {
        transform: scaleX(0.1);
        opacity: 0.7;
    }
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}