:root {
    --bg-color: #f4f4f9;
    --card-bg: #ffffff;
    --text-color: #222;
    --header-bg: rgba(255, 255, 255, 0.95);
    --accent-color: #f1c40f;
}

body.dark-theme {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #ffffff;
    --header-bg: rgba(18, 18, 18, 0.95);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    transition: 0.3s;
}

.container { max-width: 1200px; margin: 0 auto; padding: 10px 20px; }

/* Overlay: Слой затемнения */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1500; /* Ниже меню и хедера */
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 2500; /* Самый высокий */
    background-color: var(--header-bg);
    backdrop-filter: blur(5px);    
}

.sticky-wrapper { position: relative; }

.header-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.logo { font-size: 1.2rem; margin: 0; }
@media (min-width: 768px) { .logo { font-size: 2rem; } }

/* Бургер */
.burger-btn {
    width: 28px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 3001; /* Выше всех */
    position: relative;
}

.burger-btn span {
    width: 100%;
    height: 3px;
    background-color: var(--text-color);
    border-radius: 3px;
    transition: 0.3s;
    transform-origin: center;
}

.burger-btn.active span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.burger-btn.active span:nth-child(2) { opacity: 0; }
.burger-btn.active span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* Боковое меню */
.side-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 250px;
    height: calc(100vh - 100%);
    background-color: var(--card-bg);
    z-index: 2000;
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
    transition: 0.4s ease;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.2);
    overflow-y: auto;
}

.side-menu.open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}

/* Элементы внутри меню */
.genres-list { display: flex; flex-direction: column; padding: 20px; gap: 5px; }

.genre-btn, .info-btn {
    background: none;
    border: none;
    color: var(--text-color);
    padding: 12px 10px;
    cursor: pointer;
    text-align: left;
    font-size: 1.1rem;
    transition: 0.2s;
}

.genre-btn:hover { background: var(--accent-color); color: #000; padding-left: 20px; }

.menu-divider { border: 0; border-top: 1px solid rgba(128,128,128,0.2); margin: 10px 0; }

.info-btn { opacity: 0.6; font-size: 0.9rem; }
.info-btn:hover { opacity: 1; color: var(--accent-color); }

/* Остальные стили */
.search-form { display: flex; gap: 10px; margin-bottom: 10px; }
.search-form input { flex: 1; padding: 10px; border-radius: 8px; border: 1px solid #ccc; background: var(--card-bg); color: var(--text-color); }

.pagination { display: flex; justify-content: center; align-items: center; gap: 15px; padding-bottom: 10px; }
.btn-page { background: var(--accent-color); border: none; padding: 5px 15px; border-radius: 5px; cursor: pointer; font-weight: bold; }

.movies-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none; /* Скрыто по умолчанию */
    justify-content: center;
    align-items: center;
    z-index: 5000; /* Выше всех меню */
    backdrop-filter: blur(8px);
    transition: opacity 0.3s ease;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: var(--card-bg);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    border-radius: 15px;
    position: relative;
    padding: 30px;
    overflow-y: auto;
    color: var(--text-color);
}

.close-modal {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 2rem;
    background: none; border: none;
    color: var(--text-color);
    cursor: pointer;
    z-index: 10;
}

/* Сетка внутри модалки */
.modal-details {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .movies-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .modal-details { grid-template-columns: 1fr 2fr; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-poster { width: 100%; border-radius: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.modal-info h2 { margin-top: 0; color: var(--accent-color); }
.tagline { font-style: italic; opacity: 0.7; margin-bottom: 10px; display: block; }

.movie-card { background: var(--card-bg); border-radius: 12px; overflow: hidden; box-shadow: 0 4px 6px rgba(0,0,0,0.1); transition: 0.3s; }
.movie-card:hover { transform: translateY(-5px); }
.movie-card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; }
.movie-card h3 { padding: 10px; font-size: 0.9rem; margin: 0; }

