/* ============================================================ */
/* Слайдер сравнения "До/После" slider-comparison */
/* ============================================================ */

/* ===== 1. Родительский контейнер (для модалок) ===== */
.risk-photos {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    display: block !important;
    padding: 0 !important;
}

/* Скрываем старые элементы, если они остались */
.risk-photos .photo-item {
    display: none !important;
}

/* ===== 2. Слайдер сравнения ===== */
.comparison-slider {
    width: 100% !important;
    max-width: 100% !important;
    margin: 16px 0;
    display: block !important;
    flex: 0 0 100% !important;
}

/* ===== 3. Трек слайдера ===== */
.slider-track {
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 10px;
    overflow: hidden;
    background: #0d0f13;
    border: 1px solid rgba(255, 255, 255, 0.05);
    user-select: none;
    touch-action: none;
    cursor: ew-resize;
    /* Убираем aspect-ratio, height теперь автоматом от картинок */
}

.slider-track img {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    height: auto !important; /* Ключевой момент — авто-высота */
    display: block;
    position: relative;
    pointer-events: none;
}

/* Before — нижний слой (виден слева) */
.img-before {
    position: relative !important;
    z-index: 1;
    filter: brightness(0.92);
}

/* After — верхний слой (обрезается справа) */
.img-after {
    position: relative !important;
    z-index: 2;
    clip-path: inset(0 50% 0 0);
}

/* === Разделительная линия === */
.slider-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    background: var(--blue);
    z-index: 10;
    transform: translateX(-50%);
    box-shadow: 0 0 12px rgba(255, 138, 31, 0.25);
    pointer-events: none;
}

/* === Ручка === */
.slider-handle-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background: var(--blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #0d0f13;
    font-weight: 700;
    box-shadow: 0 0 0 3px #0d0f13, 0 2px 12px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

/* === Подписи === */
.slider-badges {
    position: absolute;
    top: 10px;
    left: 0;
    right: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    padding: 0 14px;
    pointer-events: none;
}

.slider-badges span {
    background: rgba(13, 15, 19, 0.75);
    backdrop-filter: blur(4px);
    padding: 3px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    color: #e8ecf1;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.badge-after {
    background: rgba(255, 138, 31, 0.15) !important;
    border-color: rgba(255, 138, 31, 0.2) !important;
}

/* === Мобильная версия === */
@media (max-width: 480px) {
    .slider-handle-btn {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }
    .slider-badges span {
        font-size: 9px;
        padding: 2px 8px;
    }
    .slider-badges {
        top: 8px;
        padding: 0 10px;
    }
}

/* ============================================================ */
/* ===== СТИЛИ ТОЛЬКО ДЛЯ ПАНЕЛЕЙ СО СЛАЙДЕРОМ ===== */
/* ============================================================ */

/* Только те .visual-panel, которые содержат .comparison-slider */
.visual-panel:has(.comparison-slider) {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    position: relative;
    background: #1a1a2e;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Убираем aspect-ratio, чтобы панель подстраивалась */
}

/* Растягиваем слайдер на всю ширину панели */
.visual-panel:has(.comparison-slider) .comparison-slider {
    width: 100% !important;
    height: auto !important; /* Авто-высота от слайдера */
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

/* Трек в панели — без лишних ограничений */
.visual-panel:has(.comparison-slider) .slider-track {
    width: 100% !important;
    height: auto !important; /* Авто-высота от картинок */
    border-radius: 0 !important;
    border: none !important;
}

/* Изображения в панели */
.visual-panel:has(.comparison-slider) .slider-track img {
    width: 100%;
    height: auto !important;
    object-fit: contain; /* Вместо cover, чтобы не обрезались */
}

/* Корректировка подписей для панели */
.visual-panel:has(.comparison-slider) .slider-badges {
    top: 12px;
    padding: 0 16px;
}

.visual-panel:has(.comparison-slider) .slider-badges span {
    font-size: 12px;
    padding: 4px 14px;
}

/* ===== Стили для панелей БЕЗ слайдера (пагинатор) ===== */
.visual-panel:not(:has(.comparison-slider)) {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    position: relative;
    background: #1a1a2e;
    aspect-ratio: 4 / 3;
    width: 100%;
}

/* Убеждаемся, что пагинатор отображается правильно */
.visual-panel:not(:has(.comparison-slider)) .panel-container {
    width: 100%;
    height: 100%;
}

.visual-panel:not(:has(.comparison-slider)) .panel-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== Для модальных окон ===== */
.risk-modal-content .comparison-slider {
    height: auto !important;
    margin: 16px 0 !important;
}

.risk-modal-content .slider-track {
    height: auto !important; /* Авто-высота */
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.risk-modal-content .slider-track img {
    height: auto !important;
}