/* Добавляем в начало файла */
.movie-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px; /* Фиксированные отступы по бокам */
    box-sizing: border-box;
}

.movie-content .movie-selection {
    display: grid !important;
    grid-template-columns: 1fr !important;  /* Одна колонка на десктопе */
    gap: 30px !important;
    padding: 20px !important;
    background-color: #f9f9f9 !important;
    border-radius: 8px !important;
}

/* Контейнер для всех карточек */
.movie-selection-wrapper {
    margin: 20px 0;
}

.movie-selection {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

/* Карточка фильма */
.movie-item {
    display: grid;
    grid-template-columns: 300px 1fr;  /* Постер слева, контент справа */
    gap: 30px;
    padding: 30px;
    background-color: #ffffff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.movie-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Контейнер для контента справа */
.movie-item-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Блок с заголовком и описанием */
.movie-header {
    flex-grow: 1;
}

/* Заголовок */
.movie-item h3 {
    font-size: 24px;
    margin: 0 0 20px 0;
    color: #333;
    line-height: 1.3;
}

/* Блок с описанием и фактами */
.movie-details {
    margin-bottom: 30px;
}

.movie-details p {
    margin: 0 0 15px 0;
    color: #666;
    line-height: 1.6;
}

.movie-details p:last-child {
    margin-bottom: 0;
}

/* Кнопка просмотра */
.watch-button {
    margin-top: auto;
    align-self: flex-start;
    padding: 12px 25px;
    background: #e50914;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.watch-button:hover {
    background: #f40612;
    color: white;
    text-decoration: none;
}

.watch-button img {
    height: 20px;
    width: auto;
}

/* Контейнер для постера */
.poster-container {
    width: 100%;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Обертка для изображения */
.img-wrapper {
    position: relative;
}

/* Стили для изображения */
.poster-container img {
    width: 100%;
    height: 450px;
    object-fit: cover;
    display: block;
    position: relative;
    background-color: #f0f0f0; /* Фон для заглушки */
}

.poster-container img[src*="non-poster.webp"] {
    object-fit: contain; /* Для заглушки используем contain вместо cover */
    padding: 20px;
    background-color: #f0f0f0;
}

.poster-container img.lazy.loaded {
    width: 100%;
    height: 450px;
    object-fit: cover;
    display: block;
    position: relative;
    cursor: pointer;
}

.poster-container img.lazy.loaded:hover {
    cursor: pointer;
}

/* Плашка TRAILER */
.trailer-label {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 15px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    z-index: 3;
    letter-spacing: 0.5px; /* Уменьшаем межбуквенный интервал для русского текста */
    transition: opacity 0.3s ease;
    white-space: nowrap;
    pointer-events: none;
}

.poster-container:hover .trailer-label {
    opacity: 0;
}

/* Иконка плей */
.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0,0,0,0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    opacity: 1;
    transition: opacity 0.3s ease;
    margin: auto;  /* Добавляем автоматические отступы */
}

.poster-container:hover .play-icon {
    opacity: 0;
}

/* Модальное окно */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 800px;
    aspect-ratio: 16/9;
}

#videoFrame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

.modal-close {
    position: absolute;
    right: -30px;
    top: -30px;
    color: #fff;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

/* Обновляем стили для модального окна и кнопки */
.modal-button-container {
    position: absolute;
    bottom: -60px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 1001;
}

.modal-amazon-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 12px 25px;
    background: #e50914;
    color: white !important;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s ease;
    gap: 10px;
    margin: 0 auto;
}

.modal-amazon-button:hover {
    background: #f40612;
    color: white !important;
    text-decoration: none;
}

.modal-amazon-button img {
    height: 20px;
    width: auto;
}

/* Медиа-запросы для адаптивности */
@media (min-width: 1025px) and (max-width: 1199px) {
    .movie-content {
        max-width: 1000px;
    }
    
    .movie-item {
        grid-template-columns: auto 1fr; /* Меняем фиксированную ширину на auto */
        padding: 20px;
        gap: 20px;
    }
}

@media (min-width: 769px) and (max-width: 1199px) {
    .play-icon {
        width: 50px; /* Уменьшаем размер иконки */
        height: 50px;
        font-size: 20px;
    }
}

@media (max-width: 1024px) {
    .movie-item {
        grid-template-columns: 200px 1fr;
    }
    
    .poster-container img {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .movie-selection {
        grid-template-columns: 1fr;
        padding: 5px; /* Уменьшаем внешний отступ контейнера */
    }

    .movie-item {
        grid-template-columns: 1fr;
        padding: 10px; /* Уменьшаем внутренние отступы карточки */
        gap: 15px;
    }

    .poster-container {
        max-width: 100%;
        aspect-ratio: 2/3; /* Сохраняем пропорции постера фильма */
    }

    .poster-container img {
        width: 100%;
        height: 100%; /* Высота будет определяться aspect-ratio */
        object-fit: cover;
    }

    .movie-item h3 {
        font-size: 18px; /* Немного уменьшаем заголовок */
        margin-bottom: 10px;
    }

    .movie-details {
        margin-bottom: 15px; /* Уменьшаем отступ */
    }

    .watch-button {
        width: 100%; /* Кнопка на всю ширину */
        justify-content: center; /* Центрируем содержимое кнопки */
        padding: 10px 20px;
    }

    .play-icon {
        width: 40px; /* Еще меньше для мобильных */
        height: 40px;
        font-size: 18px;
    }
}

/* Добавляем стили для очень маленьких экранов */
@media (max-width: 320px) {
    .movie-selection {
        padding: 3px;
    }

    .movie-item {
        padding: 8px; /* Еще меньше отступы */
        gap: 10px;
    }

    .movie-item h3 {
        font-size: 16px;
    }

    .movie-details p {
        font-size: 14px;
        line-height: 1.4;
    }

    .watch-button {
        padding: 8px 15px;
        font-size: 14px;
    }

    .watch-button img {
        height: 16px;
    }
}

/* Сообщение о недоступности фильма */
.no-amazon-message {
    margin-bottom: 10px;
    color: #666;
    font-size: 14px;
    text-align: center;
}

/* Кнопка бесплатного периода */
.watch-button.free-trial {
    background: #00a8e1;
}

.watch-button.free-trial:hover {
    background: #0095c8;
}

/* Для модального окна */
.modal-content .no-amazon-message {
    color: white;
    text-align: center;
    margin-bottom: 15px;
}

/* Стили для секции метаданных фильма */
.movie-selection .movie-metadata,
.movie-item .movie-metadata {
    margin-top: 0 !important;
    padding: 15px !important;
    background: #f9f9f9 !important;
    border-radius: 0 0 8px 8px !important;
    border-top: 1px solid #eee !important;
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    line-height: 1.6 !important;
    font-size: 14px !important;
    color: #666 !important;
    grid-column: 1 / -1 !important; /* Добавляем это свойство для растягивания на всю ширину */
}

.movie-selection .movie-director, 
.movie-selection .movie-rating, 
.movie-selection .movie-actors,
.movie-item .movie-director, 
.movie-item .movie-rating, 
.movie-item .movie-actors {
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    margin-bottom: 5px !important;
}

/* Добавляем стили для эмодзи с высоким приоритетом */
.movie-selection .movie-director::before, 
.movie-selection .movie-rating::before, 
.movie-selection .movie-actors::before,
.movie-item .movie-director::before, 
.movie-item .movie-rating::before, 
.movie-item .movie-actors::before {
    margin-right: 5px !important;
    font-size: 16px !important; /* Чуть больше размер для эмодзи */
    display: inline-block !important;
}

.movie-selection .movie-director::before,
.movie-item .movie-director::before {
    content: '🎬' !important; /* Эмодзи для режиссера */
}

.movie-selection .movie-rating::before,
.movie-item .movie-rating::before {
    content: '⭐' !important; /* Эмодзи для рейтинга */
}

.movie-selection .movie-actors::before,
.movie-item .movie-actors::before {
    content: '🎭' !important; /* Эмодзи для актеров */
}

/* Добавляем пробел после слов */
.movie-selection .movie-director strong::after,
.movie-item .movie-director strong::after,
.movie-selection .movie-rating strong::after,
.movie-item .movie-rating strong::after,
.movie-selection .movie-actors strong::after,
.movie-item .movie-actors strong::after {
    content: ' ' !important;
    white-space: pre !important;
}

/* Медиа-запросы для мобильных устройств с высоким приоритетом */
@media (max-width: 768px) {
    .movie-selection .movie-metadata,
    .movie-item .movie-metadata {
        padding: 12px !important;
        font-size: 13px !important;
        gap: 5px !important;
    }
    
    .movie-selection .movie-director, 
    .movie-selection .movie-rating, 
    .movie-selection .movie-actors,
    .movie-item .movie-director, 
    .movie-item .movie-rating, 
    .movie-item .movie-actors {
        width: 100% !important;
        display: block !important;
    }
}

/* Дополнительные стили для очень маленьких экранов */
@media (max-width: 320px) {
    .movie-selection .movie-metadata,
    .movie-item .movie-metadata {
        padding: 10px !important;
        font-size: 12px !important;
        line-height: 1.3 !important;
    }
    
    .movie-selection .movie-director::before, 
    .movie-selection .movie-rating::before, 
    .movie-selection .movie-actors::before,
    .movie-item .movie-director::before, 
    .movie-item .movie-rating::before, 
    .movie-item .movie-actors::before {
        font-size: 14px !important;
    }
}

.movie-selection .movie-director strong, 
.movie-selection .movie-rating strong, 
.movie-selection .movie-actors strong,
.movie-item .movie-director strong, 
.movie-item .movie-rating strong, 
.movie-item .movie-actors strong {
    white-space: nowrap !important;
}

/* Добавляем пробел после слов */
.movie-selection .movie-director strong::after,
.movie-item .movie-director strong::after,
.movie-selection .movie-rating strong::after,
.movie-item .movie-rating strong::after,
.movie-selection .movie-actors strong::after,
.movie-item .movie-actors strong::after {
    content: ' ' !important;
    white-space: pre !important;
}
