/* Глобальный сброс для элементов шапки */
.main-header {
    background-color: #1a1e29; /* Глубокий темно-синий цвет */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 15px 0;
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin-bottom: 30px;
}

/* Флекс-контейнер для выстраивания элементов в одну строку */
.header-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

/* Стилизация логотипа */
.site-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffffff;
    text-decoration: none;
    transition: color 0.2s;
}

.site-logo:hover {
    color: #3b82f6; /* Мягкий голубой цвет при наведении */
}

/* Красивая поисковая строка */
.search-block {
    flex: 1;
    max-width: 500px; /* Ограничиваем максимальную ширину поиска */
}

.search-form {
    display: flex;
    width: 100%;
}

.search-form input[type="text"] {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #334155;
    border-right: none;
    border-radius: 24px 0 0 24px; /* Делаем закругленным, как на референсе */
    background-color: #1e293b;    /* Темный фон по умолчанию */
    color: #94a3b8;               /* Серый цвет подсказки/текста */
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;    /* Плавный переход цвета */
}

.search-form input[type="text"]::placeholder {
    color: #64748b;
}

.search-form input[type="text"]:focus {
    background-color: #ffffff;    /* Белый светлый фон, как на скриншоте */
    color: #0f172a;               /* Темный текст для читаемости на белом */
    border-color: #3b82f6;        /* Подсветка границы голубым */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); /* Легкое свечение вокруг */
}

/* Меняем цвет подсказки на темный при фокусе */
.search-form input[type="text"]:focus::placeholder {
    color: #94a3b8;
}

.search-form input[type="text"]:focus {
    border-color: #3b82f6;
}

.search-form button {
    padding: 12px 24px;
    background-color: #3b82f6;
    color: #ffffff;
    border: 1px solid #3b82f6;
    border-radius: 0 24px 24px 0; /* Округление правой части */
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95rem;
    transition: background-color 0.2s;
}

.search-form button:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}

/* Стилизация блока авторизации */
.auth-block {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.95rem;
}

.auth-block a {
    color: #ffffff;
    text-decoration: none;
}

.user-welcome a {
    color: #3b82f6;
    transition: underline 0.2s;
}

.user-welcome a:hover {
    text-decoration: underline;
}

/* Стильная кнопка входа */
.btn-login {
    padding: 8px 16px;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    color: #3b82f6 !important;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-login:hover {
    background-color: #3b82f6;
    color: #ffffff !important;
}

/* Ссылки выхода */
.btn-logout {
    color: #f43f5e !important; /* Спокойный красный цвет */
    font-weight: 600;
}

.btn-logout:hover {
    text-decoration: underline;
}

/* Мобильная адаптивность */
@media (max-width: 768px) {
    .header-wrap {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    .search-block {
        width: 100%;
        max-width: 100%;
    }
}

/* Общие стили для контейнера */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Адаптивная CSS-сетка для каталога фильмов */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

/* Стили карточки фильма */
.movie-card {
    background: #fff;
    border: 1px solid #e3e6f0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s;
	display: flex;
    flex-direction: column;
}

.movie-card:hover {
    transform: translateY(-5px);
}

/* Ограничение контейнера обложки по вашей задаче */
.movie-cover {
    height: 300px;
    overflow: hidden;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.movie-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.index-movie-info {
    padding: 15px;
	display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.index-movie-info h3 {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    line-height: 1.3;
}

.index-movie-info h3 a {
    color: #005;
	transition: color 0.15s ease;
    text-decoration: none;
}

.index-movie-info h3 a:hover {
    color: #ff5500 !important;;
}

/* Строка метаданных (год, рейтинг и кнопка) */
.movie-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
	height: 26px;
    font-size: 0.9rem;
    color: #4b5563;
	margin-top: auto; 
    padding-top: 10px;
}

/* Компактная круглая кнопка закладок внутри строки инфо */
.card-wishlist-btn {
    width: 26px !important;
    height: 26px !important;
    max-width: 26px !important;
    max-height: 26px !important;
    border-radius: 50%;
    border: none;
    position: relative;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    user-select: none;
    padding: 0 !important;
    margin: 0 !important;
    flex-shrink: 0;
	transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.2s ease;
    transform-origin: center center !important;
}

/* Состояния кнопок (цвета остаются прежними) */
.card-wishlist-btn.add {
    background-color: #28a745 !important; /* Зеленый */
}

.card-wishlist-btn.remove {
    background-color: #dc3545 !important; /* Красный */
}

.card-wishlist-btn.remove::after {
    display: none !important;
}

.card-wishlist-btn.guest {
    background-color: #e9ecef !important;
}

.card-wishlist-btn.guest::before, .card-wishlist-btn.guest::after {
    background-color: #6c757d;
}

.card-wishlist-btn:hover {
    transform: scale(1.12);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.card-wishlist-btn::before, .card-wishlist-btn::after {
    content: "";
    position: absolute;
    background-color: #ffffff;
    border-radius: 1px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) !important;
    transform-origin: center center !important;
}

.card-wishlist-btn::before {
    width: 12px;
    height: 2px;
}

.card-wishlist-btn.add::after {
    width: 2px;
    height: 12px;
}

/* Оформление таблицы спецификаций фильма */
.movie-tech-specs {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95rem;
}

.movie-tech-specs td {
	padding: 8px 12px; 
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}

/* Фиксированная ширина для левой колонки с названиями параметров */
.movie-tech-specs td:first-child {
    width: 210px;
    font-weight: 500;
	white-space: nowrap;
	vertical-align: top;
}

.movie-tech-specs tr:last-child td {
	 color: #1a1e29;
}

.movie-info {
	flex: 1; 
	min-width: 300px;
}

.movie-info a {
    transition: color 0.15s ease; /* Добавляем плавность перехода цвета */
}

.movie-info a:hover {
    color: #ff5500 !important; /* Перекрашиваем строго в #f50 при наведении */
}

.tech-spec-section-title td {
    font-size: 1rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.spoiler-row {
	display: none;
}

.spoiler-row a {
	color: #005;
	text-decoration: none;
	transition: color 0.15s ease;
	font-size: 1rem;
    line-height: 1.7;
}

.spoiler-row a:hover {
	color: #ff5500 !important;
}

/* Контейнер для звездного рейтинга */
.stars-rating-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Segoe UI', sans-serif;
}

/* Базовый блок под 5 звезд */
.stars-outer {
    position: relative;
    display: inline-block;
    font-size: 1.25rem; /* Размер звезд */
    line-height: 1;
    color: #e2e8f0; /* Цвет пустых звезд (серый, как на скриншоте) */
    user-select: none;
}

/* Слой заполнения желтыми звездами */
.stars-inner {
    position: absolute;
    top: 0;
    left: 0;
    white-space: nowrap;
    overflow: hidden;
    width: 0; /* Будет задаваться динамически через Jinja2 в % */
    color: #ffb703; /* Яркий золотой цвет заполненных звезд */
    text-shadow: 0 1px 2px rgba(251, 191, 36, 0.4);
}

/* Псевдоэлементы, рисующие ровно 5 звезд */
.stars-outer::before, .stars-inner::before {
    content: "\2605\2605\2605\2605\2605"; /* Юникод-символ закрашенной звезды ★ */
    letter-spacing: 2px;
}

/* Текстовая цифра оценки рядом со звездами */
.stars-rating-text {
    font-size: 1rem;
    font-weight: bold;
    color: #1a1e29;
}

/* 1. Сетка миниатюр в карточке фильма */
.screenshots-gallery-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    margin-bottom: 40px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.screenshot-thumb-item {
    flex: 1;
    min-width: 0;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    cursor: pointer;
    aspect-ratio: 16 / 9;
    background: #000;
}

.screenshot-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease, filter 0.2s ease;
    display: block;
}

.screenshot-thumb-item:hover img {
    transform: scale(1.04);
    filter: brightness(1.1);
}

/* 2. Модальное окно просмотра (Lightbox) */
.lightbox-modal {
    border: none;
    background: transparent;
    padding: 0;
    max-width: 100vw;
    max-height: 100vh;
    outline: none;
}

/* Затемнение заднего фона всей страницы */
.lightbox-modal::backdrop {
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(3px);
}

.lightbox-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    position: relative;
    font-family: Arial, sans-serif;
}

/* Главный блок просмотра кадра */
.lightbox-main-view {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 90%;
    max-height: 70vh;
}

.lightbox-img-wrapper {
    background: #ffffff;
    padding: 10px 10px 0 10px;
    border-radius: 4px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

.lightbox-img-wrapper img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    display: block;
}

/* Счетчик как на вашем скриншоте */
.lightbox-counter {
    padding: 12px 5px;
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: bold;
    background: #ffffff;
}

/* Кнопки навигации стрелки */
.lightbox-nav-arrow {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    font-size: 3rem;
    padding: 10px 20px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
    user-select: none;
}

.lightbox-nav-arrow:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-nav-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 3.5rem;
    cursor: pointer;
    line-height: 1;
}

/* Карусель миниатюр внизу экрана */
.lightbox-thumbs-carousel {
    display: flex;
    gap: 8px;
    margin-top: 30px;
    max-width: 80%;
    overflow-x: auto;
    padding: 5px 10px;
    box-sizing: border-box;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.lightbox-thumbs-carousel::-webkit-scrollbar {
    display: none;
    width: 0 !important;
    height: 0 !important;
}

.lightbox-strip-thumb {
    height: 45px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 2px;
    cursor: pointer;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.lightbox-strip-thumb:hover {
    opacity: 0.8;
}

/* Активный кадр выделяется рамочкой и стрелочкой сверху (как на скриншоте) */
.lightbox-strip-thumb.active {
    opacity: 1;
    border-color: #ffffff;
    transform: scale(1.05);
}

.actor-preview-popup {
    position: fixed; /* Позволяет точно позиционировать окно относительно экрана */
    z-index: 9999;   /* Показываем карточку поверх абсолютно всех элементов */
    display: flex;
    gap: 15px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    pointer-events: none; /* Пропускаем клики сквозь подсказку */
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 320px;
}

/* Состояние видимости, которое будет включать JS */
.actor-preview-popup.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Левая часть: Миниатюра-аватар */
.actor-popup-avatar {
    width: 60px;
    height: 90px;
    border-radius: 4px;
    overflow: hidden;
    background: #f1f5f9;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.actor-popup-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Правая часть: Блок текстовой информации */
.actor-popup-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.actor-popup-name {
    font-size: 0.95rem;
    font-weight: bold;
    color: #0f172a;
    margin: 0;
    line-height: 1.2;
}

.actor-popup-altname {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
    line-height: 1.2;
}

.actor-popup-birthday {
    font-size: 0.8rem;
    color: #0d9488;
    margin-top: 2px;
    font-weight: 500;
}

.kinopoisk-badge-btn img {
    transition: transform 0.15s ease, filter 0.15s ease;
    filter: brightness(1);
	display: inline-block;
	text-decoration: none;
	line-height: 0;
}

.kinopoisk-badge-btn:hover img {
    transform: scale(1.05);
    filter: brightness(1.15);/
}

.trailer-badge-btn {
	width:73px;
	height:20px;
	display: inline-block;
	box-sizing: border-box;
    text-decoration: none;
    outline: none;
	background:url(../img/trailer.png);
	background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
	transition: background-image 0.1s ease-in-out, filter 0.15s ease;
}

.trailer-badge-btn:hover {
	background:url(../img/trailer_hover.png);
	filter: brightness(1.05);
}

.movie_comments {
	line-height: 1.7;
	color: #1e293b;
	font-size: 1rem;
	margin-bottom: 40px;
	text-align: justify;
}

.movie_comments a {
	color: #005;
	text-decoration: none;
	transition: color 0.15s ease;
}

.movie_comments a:hover {
	color: #ff5500 !important;
}

.actor-movie-row {
	font-size: 1rem;
    line-height: 1.7;
}
	
.actor-movie-row a {
	color: #005;
	text-decoration: none;
	transition: color 0.15s ease;
}

.actor-movie-row a:hover {
	color: #ff5500 !important;
}

.scroll-to-top-button {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 32px;
    height: 48px;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    cursor: pointer;
    z-index: 999;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.scroll-to-top-button.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.scroll-to-top-button::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../img/up.png'); 
    background-size: 32px 96px;
    background-repeat: no-repeat;
    background-position: top center;
    z-index: 1;
    transition: filter 0.25s ease;
}

.scroll-to-top-button::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../img/up.png'); 
    background-size: 32px 96px;
    background-repeat: no-repeat;
    background-position: bottom center;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-to-top-button:hover::after {
    opacity: 1;
}

.scroll-to-top-button:hover {
    transform: scale(1.03);
}

.watch-online-btn:hover {
    background-color: #e04b00 !important;
    transform: scale(1.03);
    box-shadow: 0 3px 8px rgba(255, 85, 0, 0.3) !important;
}

.multi-watch-dropdown-list {
    display: block;
}

.multi-watch-item-link {
    white-space: nowrap !important;
}

.multi-watch-item-link:last-child {
    border-bottom: none !important;
}

.multi-watch-item-link:hover {
    background-color: #fff7ed !important;
    color: #ff5500 !important;
}
