/**
 * Стили для карусели вертикальных кадров на страницах проектов
 * Адаптивный дизайн с поддержкой touch-жестов
 */

/* ===== ОСНОВНЫЕ СТИЛИ КАРУСЕЛИ ===== */

.project-carousel {
    position: relative;
    width: 100%;
    margin: 20px 0;
    overflow: hidden;
    border-radius: 10px;
    background: #000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    /* Улучшаем взаимодействие с прокруткой */
    touch-action: pan-y pinch-zoom;
    -webkit-overflow-scrolling: touch;
}

.carousel-slides {
    position: relative;
    width: 100%;
    height: auto;
    display: flex;
    transition: transform 0.3s ease-in-out;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-in-out;
    z-index: 1;
    /* Улучшаем взаимодействие с прокруткой */
    touch-action: pan-y pinch-zoom;
    -webkit-overflow-scrolling: touch;
}

.carousel-slide.active {
    position: relative;
    opacity: 1;
    transform: translateX(0);
    z-index: 2;
}

.carousel-slide img,
.carousel-slide video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
    /* Улучшаем взаимодействие с прокруткой */
    touch-action: pan-y pinch-zoom;
    -webkit-overflow-scrolling: touch;
}

/* ===== НАВИГАЦИЯ ===== */

.carousel-navigation {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    pointer-events: none;
    z-index: 3;
}

.carousel-prev,
.carousel-next {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto;
    color: #fff;
}

.carousel-prev:hover,
.carousel-next:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.carousel-prev:active,
.carousel-next:active {
    transform: scale(0.95);
}

.carousel-prev svg,
.carousel-next svg {
    width: 20px;
    height: 20px;
}

/* ===== ИНДИКАТОРЫ ===== */

.carousel-indicators {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 3;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.carousel-indicator.active {
    background: #fff;
    transform: scale(1.2);
}

.carousel-indicator:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

/* ===== АДАПТИВНОСТЬ ===== */

/* Планшеты */
@media (max-width: 1024px) {
    .project-carousel {
        margin: 15px 0;
        border-radius: 8px;
    }
    
    .carousel-slide img,
    .carousel-slide video {
        border-radius: 8px;
    }
    
    .carousel-prev,
    .carousel-next {
        width: 40px;
        height: 40px;
    }
    
    .carousel-prev svg,
    .carousel-next svg {
        width: 18px;
        height: 18px;
    }
    
    .carousel-indicators {
        bottom: 12px;
    }
    
    .carousel-indicator {
        width: 7px;
        height: 7px;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    .project-carousel {
        margin: 10px 0;
        border-radius: 6px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    }
    
    .carousel-slides {
        min-height: 300px; /* Минимальная высота для мобильных */
    }
    
    .carousel-slide img,
    .carousel-slide video {
        border-radius: 6px;
        min-height: 300px;
        object-fit: cover;
    }
    
    .carousel-navigation {
        padding: 0 10px;
    }
    
    .carousel-prev,
    .carousel-next {
        width: 36px;
        height: 36px;
        background: rgba(0, 0, 0, 0.8);
    }
    
    .carousel-prev svg,
    .carousel-next svg {
        width: 16px;
        height: 16px;
    }
    
    .carousel-indicators {
        bottom: 10px;
        gap: 6px;
    }
    
    .carousel-indicator {
        width: 6px;
        height: 6px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .project-carousel {
        margin: 8px 0;
        border-radius: 4px;
    }
    
    .carousel-slides {
        min-height: 250px;
    }
    
    .carousel-slide img,
    .carousel-slide video {
        border-radius: 4px;
        min-height: 250px;
    }
    
    .carousel-navigation {
        padding: 0 8px;
    }
    
    .carousel-prev,
    .carousel-next {
        width: 32px;
        height: 32px;
    }
    
    .carousel-prev svg,
    .carousel-next svg {
        width: 14px;
        height: 14px;
    }
    
    .carousel-indicators {
        bottom: 8px;
        gap: 4px;
    }
    
    .carousel-indicator {
        width: 5px;
        height: 5px;
    }
}

/* ===== АНИМАЦИИ ===== */

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

/* ===== СОСТОЯНИЯ ЗАГРУЗКИ ===== */

.carousel-slide.loading {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.carousel-slide.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid #ddd;
    border-top: 3px solid #000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== ДОСТУПНОСТЬ ===== */

.carousel-prev:focus,
.carousel-next:focus,
.carousel-indicator:focus {
    outline: 2px solid #007AFF;
    outline-offset: 2px;
}

.carousel-prev:focus-visible,
.carousel-next:focus-visible,
.carousel-indicator:focus-visible {
    outline: 2px solid #007AFF;
    outline-offset: 2px;
}

/* Скрытие навигации для пользователей, предпочитающих уменьшенное движение */
@media (prefers-reduced-motion: reduce) {
    .carousel-slide {
        transition: none;
    }
    
    .carousel-prev,
    .carousel-next,
    .carousel-indicator {
        transition: none;
    }
}

/* ===== ТЕМНАЯ ТЕМА ===== */

@media (prefers-color-scheme: dark) {
    .carousel-prev,
    .carousel-next {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }
    
    .carousel-prev:hover,
    .carousel-next:hover {
        background: rgba(255, 255, 255, 0.2);
    }
    
    .carousel-indicator {
        background: rgba(255, 255, 255, 0.3);
    }
    
    .carousel-indicator.active {
        background: #fff;
    }
    
    .carousel-indicator:hover {
        background: rgba(255, 255, 255, 0.6);
    }
}

/* ===== ПЕЧАТЬ ===== */

@media print {
    .carousel-navigation,
    .carousel-indicators {
        display: none;
    }
    
    .carousel-slide {
        position: relative !important;
        opacity: 1 !important;
        transform: none !important;
        page-break-inside: avoid;
    }
    
    .carousel-slide:not(.active) {
        display: none;
    }
}
