/* Video Stories Modal CSS - based on example implementation */

/* Lock scroll когда открыта модалка */
body.lockscroll {
    position: fixed;
    width: 100%;
    overflow: hidden;
}


/* Video Preview Swiper Styles */
.video-preview-swiper {
    overflow: hidden;
    margin: 0 -10px; /* Компенсируем отступы */
    padding: 0 10px;
}

.video-preview-swiper .swiper-slide {
    height: auto;
    width: auto;
}

/* Адаптивная ширина слайдов */
.video-preview-swiper .swiper-slide {
    width: auto; /* Базовая ширина для desktop */
}

@media (max-width: 1200px) {
    .video-preview-swiper .swiper-slide {
        width: auto;
    }
}

@media (max-width: 992px) {
    .video-preview-swiper .swiper-slide {
        width: auto;
    }
}

@media (max-width: 768px) {
    .video-preview-swiper .swiper-slide {
        width: auto;
    }
}

@media (max-width: 576px) {
    .video-preview-swiper .swiper-slide {
        width: auto;
    }
}

@media (max-width: 480px) {
    .video-preview-swiper .swiper-slide {
        width: auto;
    }
}

.video-preview-swiper .video-card {
    width: 100%;
    height: 100%;
}

/* Убираем горизонтальный скролл */
.video-slider-section {
    overflow: hidden;
}

.video-slider-section .container {
    overflow: hidden;
}

@media (max-width: 550px) {
    .video-slider-section > div.container,
    .video-preview-swiper {
        padding-left: 0 !important;
    }
}


.stories__modal {
    position: fixed;
    height: 100dvh;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.95);
    transition: 0.3s all;
    z-index: 2000;
    transform: translateY(100%);
}

.stories__modal.active {
    transform: translateY(0);
}

.video-stories__modal.active {
    transform: translateY(0);
}

.video-stories__slide-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding-right: 0;
    transition: 0.15s all;
}

.video-stories__slide-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.video-stories__slide-info {
    position: absolute;
    top: 41px;
    left: 17px;
    display: grid;
    grid-template-columns: 60px max-content;
    column-gap: 13px;
    row-gap: 21px;
    font-size: 17px;
    line-height: 24px;
    color: #fff;
    font-weight: 400;
    z-index: 10;
}

.video-stories__slide-info a {
    color: #fff;
}

.video-stories__slide-image {
    display: block;
    height: 60px;
    width: 60px;
    overflow: hidden;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
}

.video-stories__slide-data {
    align-content: start;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.video-stories__slide-data span {
    display: block;
}

.video-stories__slide-name {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 25px;
    line-height: 21px;
    font-weight: 600;
}

.video-stories__slide-author {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 12px;
    font-weight: 400;
    opacity: 0.8;
}

.video-stories__slide-close {
    position: absolute;
    top: 30px;
    right: 12px;
    cursor: pointer;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    transition: 0.3s all;
}

.video-stories__slide-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.video-stories__slide-close svg {
    transition: 0.3s all;
    fill: rgba(255, 255, 255, 0.8);
    width: 24px;
    height: 24px;
}

.video-stories__slide-close:hover svg {
    fill: rgba(255, 255, 255, 1);
}

.video-stories__slide-player {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-stories__slide-player video {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
}

.video-stories__slide-timeline {
    position: absolute;
    top: 6px;
    width: calc(100% - 24px);
    left: 50%;
    height: 2px;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    z-index: 10;
}

.video-stories__slide-timeline span {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    display: block;
    width: 0%;
    border-radius: 2px;
    background-color: #fff;
    /* Ширину выставляет JS через requestAnimationFrame (60 fps) — transition
       не нужен и наоборот будет давать «запаздывание» на каждом кадре. */
    will-change: width;
}

.video-stories__slide-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    z-index: 10;
}

.video-stories__control-btn {
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s all;
}

.video-stories__control-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.video-stories__control-btn i {
    font-size: 20px;
}

.stories__arrow {
    position: absolute;
    top: 50%;
    height: 65px;
    width: 65px;
    transform: translateY(-50%);
    background-color: rgba(111, 114, 112, 0.5);
    z-index: 10;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s all;
}

.stories__arrow:not(.disabled):hover {
    background-color: rgba(143, 141, 141, 0.8);
}

.stories__arrow.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.stories__arrow-next {
    right: 0;
}

.stories__arrow-prev {
    left: 0;
}

.stories__arrow svg {
    width: 30px;
    height: 30px;
    fill: rgba(255, 255, 255, 0.8);
    transition: 0.3s all;
}

.stories__arrow:not(.disabled):hover svg {
    fill: rgba(255, 255, 255, 1);
}

.video-stories__slide-preloader {
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 95px;
    height: 95px;
    transform: translate(-50%, -50%);
    border: 0.25rem solid rgba(255, 255, 255, 0.2);
    border-top-color: rgb(255, 255, 255);
    animation: storiesPreloaderSpin 1s infinite linear;
}

/* Уникальное имя анимации, чтобы избежать конфликта с @keyframes spin
   из Tailwind CDN, style.css, alpine-components.css и других стилей,
   которые могут перетереть translate(-50%, -50%) и «увести» прелоадер. */
@keyframes storiesPreloaderSpin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.video-stories__slide-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s all;
    z-index: 5;
}

.video-stories__slide-play:hover {
    background: rgba(0, 0, 0, 0.7);
}

.video-stories__slide-play i {
    font-size: 40px;
    color: white;
    margin-left: 5px;
}

/* Hide controls on interaction */
.stories__modal.hide-controls .stories__slide-info,
.stories__modal.hide-controls .stories__slide-close,
.stories__modal.hide-controls .stories__slide-controls,
.stories__modal.hide-controls .stories__slide-timeline,
.stories__modal.hide-controls .stories__arrow {
    opacity: 0;
    transition: 0.3s all;
}

/* Mobile responsiveness */
@media (max-width: 1024px) {
    .video-stories__modal {
        background-color: rgba(0, 0, 0, 1);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    .stories__arrow {
        display: none;
    }

    .video-stories__slide-info {
        top: 35px;
        grid-template-columns: 70px max-content;
        column-gap: 20px;
    }

    .video-stories__slide-image {
        width: 70px;
        height: 70px;
    }

    .video-stories__slide-author {
        font-size: 17px;
        line-height: 14px;
    }

    .video-stories__slide-timeline {
        max-width: calc(100vw - 12px);
    }

    .video-stories__slide-controls {
        bottom: 16px;
        gap: 23px;
    }

    .video-stories__control-btn {
        height: 55px;
        width: 55px;
    }

    .video-stories__control-btn i {
        font-size: 24px;
    }
}

/* Stories slide styles */
.stories__slide {
    position: relative;
    width: 100%;
    height: 100%;
}

.stories__slide-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    transition: 0.15s all;
}

.stories__slide-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.stories__slide-info {
    position: absolute;
    top: 41px;
    left: 17px;
    display: grid;
    grid-template-columns: 60px max-content;
    column-gap: 13px;
    row-gap: 21px;
    font-size: 17px;
    line-height: 24px;
    color: #fff;
    font-weight: 400;
    z-index: 10;
}

.stories__slide-icon {
    position: relative;
}

.stories__slide-image {
    display: block;
    height: 60px;
    width: 60px;
    overflow: hidden;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
}

.stories__slide-data {
    align-content: start;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.stories__slide-data span {
    display: block;
}

.stories__slide-name {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 21px;
    line-height: 18px;
    font-weight: 600;
}

.stories__slide-author {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 12px;
    font-weight: 400;
    opacity: 0.8;
}

.stories__slide-timeline {
    position: absolute;
    top: 6px;
    width: calc(100% - 24px);
    left: 50%;
    height: 2px;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    z-index: 10;
}

.stories__slide-timeline span {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    display: block;
    width: 0%;
    border-radius: 2px;
    background-color: #fff;
    /* Ширину выставляет JS через requestAnimationFrame (60 fps) — transition
       не нужен и наоборот будет давать «запаздывание» на каждом кадре. */
    will-change: width;
}

.stories__slide-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.stories__slide-player video {
    max-height: 100vh;
    max-width: 100vw;
    width: auto;
    height: auto;
    z-index: 1;
}

.stories__slide-actions {
    position: absolute;
    right: 10px;
    bottom: 18px;
    display: grid;
    grid-template-columns: max-content;
    row-gap: 22px;
    z-index: 10;
}

.stories__slide-actions path {
    fill: rgba(255, 255, 255, 0.8);
    transition: 0.3s all;
}

.stories__slide-actions > div {
    position: relative;
    height: 50px;
    width: 50px;
    cursor: pointer;
    border-radius: 50%;
    background-color: rgba(111, 114, 112, 0.5)  ;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stories__slide-actions > div:hover path {
    fill: rgba(255, 255, 255, 1);
}

.stories__slide-actions > div i {
    font-size: 20px;
    color: white;
}

.stories__slide-close {
    position: absolute;
    top: 30px;
    right: 12px;
    cursor: pointer;
    z-index: 10;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(111, 114, 112, 0.5);
    border-radius: 50%;
    transition: 0.3s all;
}

.stories__slide-close:hover {
    background: rgba(143, 141, 141, 0.8);
}

.stories__slide-close svg {
    transition: 0.3s all;
    fill: rgba(255, 255, 255, 0.8);
    width: 24px;
    height: 24px;
}

.stories__slide-close:hover svg {
    fill: rgba(255, 255, 255, 1);
}

.stories__slide-preloader {
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 95px;
    height: 95px;
    transform: translate(-50%, -50%);
    border: 0.25rem solid rgba(255, 255, 255, 0.2);
    border-top-color: rgb(255, 255, 255);
    animation: storiesPreloaderSpin 1s infinite linear;
    z-index: 5;
}
