/* static/css/carousel.css */
.carousel-item {
    position: relative;
    overflow: hidden;
    height: 500px; /* Фиксированная высота для контейнера */
}

.carousel-item img {
    width: 100%; /* Картинка на всю ширину */
    height: 100%;
    object-fit: cover; /* Сохраняем пропорции, обрезаем если нужно */
    display: block;
}

.carousel-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 15px 10px 20px 10px;
    color: #fff;
    text-align: center;
    z-index: 10;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
    box-sizing: border-box;
}

/* Контейнер для контента с ограничением по ширине */
.caption-inner {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 15px;
    box-sizing: border-box;
}

/* Заголовок с адаптивным шрифтом */
.carousel-caption .titleCarousel {
    font-size: clamp(20px, 4vw, 48px); /* Адаптивный шрифт */
    font-weight: bold;
    margin: 0 auto 10px auto;
    line-height: 1.1;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 90%;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Максимум 2 строки */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.carousel-caption .dateCarousel {
    font-size: clamp(16px, 3vw, 40px);
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.carousel-caption .ostalosCarousel {
    font-size: clamp(14px, 2.5vw, 25px);
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Countdown timer */
.timeHead {
    font-size: clamp(20px, 3.5vw, 50px);
    margin-bottom: 15px;
}

/* Компактный адаптивный таймер */
.countdown-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(5px, 1.5vw, 15px);
    flex-wrap: nowrap;
    max-width: 100%;
    padding: 0 5px;
}

.countdown-item {
    text-align: center;
    flex: 0 0 auto;
    min-width: clamp(40px, 8vw, 80px);
}

.countdown-number {
    font-size: clamp(24px, 4vw, 50px);
    font-weight: bold;
    display: block;
    line-height: 1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.countdown-label {
    font-size: clamp(10px, 1.8vw, 20px);
    margin-top: 3px;
    display: block;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

/* Адаптивные кнопки */
.buttons-container {
    display: flex;
    justify-content: center;
    gap: clamp(8px, 1.5vw, 15px);
    margin-top: 15px;
    flex-wrap: wrap;
    padding: 0 5px;
}

.btn-register,
.btn-more-info {
    font-size: clamp(14px, 2vw, 25px);
    padding: clamp(6px, 1.2vw, 12px) clamp(12px, 2vw, 24px);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    min-width: 120px;
    flex: 0 1 auto;
}

.btn-register {
    background-color: lightcoral;
    color: white;
}

.btn-more-info {
    background-color: deepskyblue;
    color: white;
    border-radius: 10px;
}

.btn-register:hover,
.btn-more-info:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Адаптивные стрелочки */
.carousel-control-prev,
.carousel-control-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20; /* Повышаем z-index чтобы были над капшном */
    font-size: clamp(20px, 3vw, 40px);
    color: white;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: clamp(30px, 5vw, 50px);
    height: clamp(30px, 5vw, 50px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0.8;
    transition: all 0.3s ease;
}

.carousel-control-prev {
    left: clamp(10px, 3vw, 30px);
}

.carousel-control-next {
    right: clamp(10px, 3vw, 30px);
}

.carousel-control-prev:hover,
.carousel-control-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
    opacity: 1;
}

/* Медиа-запросы для дополнительной настройки */
@media (max-width: 768px) {
    .carousel-item {
        height: 350px; /* Уменьшаем высоту на мобильных */
    }

    .carousel-caption {
        padding: 10px 5px 15px 5px;
        background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.5) 50%, transparent 100%);
    }

    .caption-inner {
        padding: 0 10px;
    }

    .carousel-caption .titleCarousel {
        max-width: 95%;
        -webkit-line-clamp: 2; /* На мобильных максимум 2 строки */
        line-clamp: 2;
    }

    .buttons-container {
        flex-direction: row; /* Оставляем в ряд на мобильных если помещается */
        justify-content: center;
    }

    .btn-register,
    .btn-more-info {
        min-width: 100px;
        flex: 1;
        max-width: 160px;
    }
}

@media (max-width: 480px) {
    .carousel-item {
        height: 300px;
    }

    .carousel-caption {
        padding: 8px 5px 12px 5px;
    }

    .buttons-container {
        flex-direction: column; /* На очень маленьких в столбик */
        align-items: center;
        gap: 8px;
    }

    .btn-register,
    .btn-more-info {
        width: 90%;
        max-width: 200px;
        min-width: 0;
    }

    .countdown-container {
        gap: 5px;
    }

    .countdown-item {
        min-width: 35px;
    }
}

@media (max-width: 360px) {
    .carousel-item {
        height: 250px;
    }

    .carousel-caption .titleCarousel {
        font-size: clamp(16px, 4vw, 20px);
        -webkit-line-clamp: 2;
        line-clamp: 2;
        max-height: 2.2em;
    }

    .carousel-caption .dateCarousel {
        font-size: clamp(14px, 3vw, 18px);
    }

    .buttons-container {
        flex-direction: column;
        gap: 6px;
    }

    .btn-register,
    .btn-more-info {
        width: 95%;
        font-size: 14px;
        padding: 6px 10px;
    }

    .carousel-control-prev,
    .carousel-control-next {
        width: 25px;
        height: 25px;
        font-size: 25px;
    }
}

/* Для очень маленьких экранов в портретной ориентации */
@media (max-width: 320px) and (orientation: portrait) {
    .carousel-item {
        height: 220px;
    }

    .carousel-caption {
        padding: 5px 3px 10px 3px;
    }

    .countdown-container {
        gap: 3px;
    }

    .countdown-item {
        min-width: 30px;
    }

    .countdown-number {
        font-size: 20px;
    }

    .countdown-label {
        font-size: 9px;
    }
}

/* Для ландшафтной ориентации на мобильных */
@media (max-height: 500px) and (orientation: landscape) {
    .carousel-item {
        height: 250px;
    }

    .carousel-caption {
        padding: 5px 8px 10px 8px;
    }

    .carousel-caption .titleCarousel {
        -webkit-line-clamp: 1;
        line-clamp: 1;
        font-size: clamp(14px, 3vw, 24px);
    }

    .timeHead {
        margin-bottom: 8px;
    }

    .buttons-container {
        margin-top: 10px;
    }
}

/* Сохраняем минимальный размер для читаемости */
.carousel-caption .titleCarousel {
    min-font-size: 16px; /* Минимальный размер шрифта */
}

/* Убираем кнопки на совсем маленьких если совсем не помещается */
@media (max-width: 280px) {
    .carousel-control-prev,
    .carousel-control-next {
        display: none; /* Прячем кнопки на очень маленьких */
    }

    .carousel-caption {
        padding: 5px 2px 8px 2px;
    }
}