/**
 * Единый компонент слайдшоу
 * mnogoletnik.com
 *
 * Компонент заполняет 100% ширины родителя.
 * Родительский элемент контролирует ширину и позиционирование.
 */

/* =====================================================
   Контейнер
   ===================================================== */
.slideshow {
    position: relative;
    background: #f5f5f5;
    overflow: hidden;
}

/* Квадратный viewport */
.slideshow__viewport {
    position: relative;
    width: 100%;
    padding-top: 100%; /* Квадратный контейнер */
}

/* =====================================================
   Слайды
   ===================================================== */
.slideshow__slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #1a1a1a;
    cursor: zoom-in;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.slideshow__slide.active {
    opacity: 1;
    pointer-events: auto;
}

/* Видео-превью */
.slideshow__slide--video {
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.slideshow__play-icon {
    width: 80px;
    height: 80px;
    background: rgba(0, 166, 157, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: #fff;
    transition: all 0.3s;
}

.slideshow__slide--video:hover .slideshow__play-icon {
    background: rgba(0, 166, 157, 1);
    transform: scale(1.1);
}

/* =====================================================
   Навигационные стрелки
   ===================================================== */
.slideshow__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #333;
    transition: all 0.2s;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.slideshow__nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.slideshow__nav--prev {
    left: 16px;
}

.slideshow__nav--next {
    right: 16px;
}

/* =====================================================
   Панель управления (точки, play/pause, счётчик)
   ===================================================== */
.slideshow__controls {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 24px;
    z-index: 10;
}

/* Индикаторы (точки) */
.slideshow__dots {
    display: flex;
    gap: 8px;
}

.slideshow__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.slideshow__dot:hover {
    background: rgba(255, 255, 255, 0.7);
}

.slideshow__dot.active {
    background: #fff;
    transform: scale(1.2);
}

/* Кнопка Play/Pause */
.slideshow__playpause {
    width: 32px;
    height: 32px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    transition: all 0.2s;
    padding: 0;
}

.slideshow__playpause:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
}

/* Счётчик */
.slideshow__counter {
    color: #fff;
    font-size: 14px;
    min-width: 50px;
    text-align: center;
}

/* =====================================================
   Подпись (новый элемент)
   ===================================================== */
.slideshow__caption {
    padding: 8px 12px;
    font-size: 13px;
    color: #555;
    text-align: center;
    background: #f9f9f9;
    border-top: 1px solid #eee;
    min-height: 1.6em;
    line-height: 1.4;
    transition: opacity 0.3s ease;
}

.slideshow__caption:empty {
    display: none;
}

/* =====================================================
   Одно изображение — скрыть навигацию
   ===================================================== */
.slideshow--single .slideshow__nav,
.slideshow--single .slideshow__controls {
    display: none;
}

/* =====================================================
   Адаптивность
   ===================================================== */
@media (max-width: 768px) {
    .slideshow__nav {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .slideshow__nav--prev {
        left: 8px;
    }

    .slideshow__nav--next {
        right: 8px;
    }

    .slideshow__controls {
        padding: 6px 12px;
        gap: 12px;
    }

    .slideshow__dot {
        width: 8px;
        height: 8px;
    }

    .slideshow__play-icon {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }

    .slideshow__caption {
        font-size: 12px;
        padding: 6px 10px;
    }
}
