/* =========================================================
   БАЗОВЫЕ СТИЛИ
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    background: #090b10;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 40px 34px;

    background:
        radial-gradient(
            ellipse at top,
            rgba(55, 110, 180, 0.22) 0%,
            rgba(30, 55, 95, 0.10) 28%,
            transparent 60%
        ),
        linear-gradient(
            to bottom,
            #0b1119 0%,
            #090d14 35%,
            #07090d 70%,
            #050608 100%
        );
    background-attachment: fixed;

    color: #ffffff;
    font-family: Arial, sans-serif;
}

body::before {
    content: "";

    position: fixed;
    inset: 0;
    z-index: -1;

    pointer-events: none;

    background:
        radial-gradient(
            circle at 12% 35%,
            rgba(38, 76, 125, 0.10),
            transparent 32%
        ),
        radial-gradient(
            circle at 88% 58%,
            rgba(117, 62, 40, 0.07),
            transparent 34%
        );

    filter: blur(20px);
}

h1 {
    margin-bottom: 40px;
    text-align: center;
}

button,
input,
select {
    font: inherit;
}

button {
    border: none;
    cursor: pointer;
}

form {
    margin: 0;
}


/* =========================================================
   ВЕРХНЯЯ ПАНЕЛЬ И АДМИНСКИЕ ИКОНКИ
   ========================================================= */

.header {
    position: absolute;
    top: 20px;
    right: 20px;

    display: flex;
    align-items: center;
    gap: 12px;
}

.adminIcon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    margin: 0;

    border: none;
    border-radius: 10px;

    background: transparent;
    color: inherit;

    text-decoration: none;
    cursor: pointer;

    transform: translateY(0) scale(1);
    transform-origin: center;

    transition:
        transform 0.15s ease,
        background-color 0.15s ease,
        opacity 0.15s ease;
}

.adminIcon img {
    display: block;
    width: 23px;
    height: 23px;
    object-fit: contain;
    pointer-events: none;
}

.adminIcon:hover {
    transform: translateY(-1px) scale(1.06);
    background: rgba(255, 255, 255, 0.08);
    opacity: 0.85;
}

.adminIcon:active {
    transform: translateY(0) scale(0.96);
}


/* =========================================================
   СОЦИАЛЬНЫЕ ССЫЛКИ
   ========================================================= */

.socialLinks {
    position: fixed;
    top: 20px;
    left: 50px;
    z-index: 999;

    display: flex;
    gap: 12px;
}

.socialLinks a {
    width: 32px;
    height: 32px;

    overflow: hidden;
    border-radius: 50%;

    background: #2d2d2d;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.35);

    transition: transform 0.2s ease;
}

.socialLinks a:hover {
    transform: scale(1.12);
}

.socialLinks img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* =========================================================
   ПОИСК И ФИЛЬТРЫ
   ========================================================= */

.filters {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;

    margin: 0 auto 40px;
}

.filters input,
.filters select,
.filters button {
    height: 44px;
    padding: 0 14px;

    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 10px;

    background: rgba(18, 22, 30, 0.76);
    color: rgba(255, 255, 255, 0.92);

    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);

    font-size: 15px;

    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.20),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);

    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease;
}

.filters input {
    width: min(350px, 100%);
}

.filters select {
    min-width: 60px;
    padding-left: 14px;
    padding-right: 42px;
    cursor: pointer;
    color: rgba(255,255,255,.92);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: none;
}

.filters button {
    padding: 0 20px;
    background: rgba(22, 27, 37, 0.92);
    border-color: rgba(112, 163, 230, 0.13);
    font-weight: 600;
}

.filters input::placeholder {
    color: rgba(255, 255, 255, 0.42);
}

.filters input:hover,
.filters select:hover {
    border-color: rgba(255, 255, 255, 0.20);
    background: rgba(24, 29, 39, 0.84);
}

.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: rgba(91, 151, 228, 0.72);
    background: rgba(22, 27, 37, 0.92);

    box-shadow:
        0 0 0 3px rgba(65, 129, 215, 0.15),
        0 10px 28px rgba(0, 0, 0, 0.26);
}

.filters button:hover {
    background: rgba(64, 113, 178, 0.88);
    border-color: rgba(135, 183, 241, 0.42);
}

.filters button:active {
    transform: translateY(1px);
}


/* =========================================================
   СЕТКА ФИЛЬМОВ
   ========================================================= */

.movies {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 24px;
    align-items: start;
    justify-content: center;
}

.card {
    position: relative;

    width: 100%;
    max-width: 220px;
    margin: 0 auto;
    padding-bottom: 15px;

    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;

    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.10),
        rgba(255, 255, 255, 0.035)
    );

    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);

    box-shadow:
        0 12px 32px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.09);

    text-align: center;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.22);

    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.50),
        inset 0 1px 0 rgba(255, 255, 255, 0.13);
}

.card::after {
    content: "";

    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;

    height: 105px;

    background: linear-gradient(
        to bottom,
        rgba(10, 10, 10, 0),
        rgba(10, 10, 10, 0.22)
    );

    pointer-events: none;
}

.card h3,
.card .addedDate {
    position: relative;
    z-index: 1;
}

.card h3 {
    margin: 14px 14px 0px;
    min-height: 54px;
    color: #ffffff;
    font-size: 16px;
    line-height: 1.45;
    text-align: center;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.addedDate {
    min-height: 18px;
    margin: 0 12px 13px;

    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}


/* =========================================================
   ПОСТЕР И ПЛАШКИ
   ========================================================= */

.poster {
    position: relative;
    z-index: 1;

    width: 100%;
    aspect-ratio: 2 / 3;

    overflow: hidden;
    background: #2b2b2b;
}

.poster a {
    display: block;
    width: 100%;
    height: 100%;
}

.poster img,
.card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.posterRating,
.posterYear {
    position: absolute;
    z-index: 2;

    display: flex;
    align-items: center;
    justify-content: center;

    height: 24px;

    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 7px;

    background: rgba(15, 15, 15, 0.72);

    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);

    font-size: 12px;
    line-height: 1;

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.55);

    pointer-events: none;
}

.posterRating {
    bottom: 10px;
    min-width: 34px;
    padding: 0 7px;
    font-weight: 700;
}

.posterRatingUser {
    left: 10px;
}

.posterRatingKp {
    right: 10px;
    color: #ffd54a;
}

.posterYear {
    top: 10px;
    left: 10px;
    min-width: 42px;
    padding: 0 8px;
    color: #ffffff;
    font-weight: 600;
}

.rating1  { color: #b71c1c; }
.rating2  { color: #c62828; }
.rating3  { color: #d84315; }
.rating4  { color: #ef6c00; }
.rating5  { color: #f9a825; }
.rating6  { color: #c0ca33; }
.rating7  { color: #6b9143; }
.rating8  { color: #72aa36; }
.rating9  { color: #72bb24; }
.rating10 { color: #81f704; }

.deleteButton {
    position: absolute;
    top: 10px;
    right: 10px;

    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    margin: 0;

    border: none;
    border-radius: 50%;

    background: rgba(20, 20, 20, 0.78);
    color: #ffffff;

    font-size: 22px;
    line-height: 1;

    opacity: 0;

    transition:
        opacity 0.2s ease,
        background 0.15s ease,
        transform 0.15s ease;
}

.poster:hover .deleteButton {
    opacity: 1;
}

.deleteButton:hover {
    background: rgba(190, 35, 35, 0.95);
    transform: scale(1.08);
}


/* =========================================================
   МОДАЛЬНЫЕ ОКНА ВХОДА И ДОБАВЛЕНИЯ ФИЛЬМА
   ========================================================= */

.modal {
    display: none;

    position: fixed;
    inset: 0;
    z-index: 1000;

    justify-content: center;
    align-items: center;

    padding: 20px;

    background: rgba(4, 6, 10, 0.70);

    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.loginModalContent {
    width: 320px;
    max-width: 100%;
    padding: 26px;

    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;

    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;

    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.09),
        rgba(255, 255, 255, 0.035)
    );

    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);

    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#addMovieModal .modal-content {
    width: 340px;
}

.loginModalContent form {
    width: 100%;

    display: flex;
    flex-direction: column;
    gap: 12px;
}

.loginModalContent input {
    display: block;
    width: 100%;
    height: 46px;

    padding: 0 14px;
    margin: 0;

    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 10px;

    background: rgba(18, 22, 30, 0.78);
    color: #ffffff;

    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);

    font-size: 15px;

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}

.loginModalContent input::placeholder {
    color: rgba(255, 255, 255, 0.40);
}

.loginModalContent input:focus {
    outline: none;
    border-color: rgba(93, 150, 230, 0.75);
    background: rgba(18, 22, 30, 0.92);
    box-shadow: 0 0 0 3px rgba(70, 130, 220, 0.18);
}

.loginModalContent form > button[type="submit"],
.closeButton {
    display: block;
    width: 100%;
    height: 40px;

    padding: 0 14px;
    margin: 0;

    border-radius: 6px;

    color: #ffffff;
    font-size: 15px;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.loginModalContent form > button[type="submit"] {
    border: none;
    background: rgba(34, 67, 110, 0.82);
    font-weight: 600;
}

.loginModalContent form > button[type="submit"]:hover {
    background: rgba(65, 112, 178, 0.92);
}

.closeButton {
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: transparent;
    color: #d8d8d8;
}

.closeButton:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.05);
}

.loginModalContent form > button[type="submit"]:active,
.closeButton:active {
    transform: translateY(1px);
}

/* Автозаполнение пароля в Chrome без изменения дизайна поля. */
#loginModal input[type="password"]:-webkit-autofill,
#loginModal input[type="password"]:-webkit-autofill:hover,
#loginModal input[type="password"]:-webkit-autofill:focus {
    -webkit-text-fill-color: #ffffff;
    -webkit-box-shadow: 0 0 0 1000px rgba(18, 22, 30, 0.98) inset;
    box-shadow: 0 0 0 1000px rgba(18, 22, 30, 0.98) inset;
}


/* =========================================================
   ВЫБОР ОЦЕНКИ В ОКНЕ ДОБАВЛЕНИЯ
   ========================================================= */

#ratingButtons {
    width: 100%;
    margin: 10px 0 18px;

    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 3px;
}

.loginModalContent form .ratingStar {
    width: 28px;
    height: 32px;
    min-width: 28px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    margin: 0;

    border: none;
    border-radius: 0;

    background: transparent;
    color: #777777;

    font-size: 28px;
    line-height: 1;

    box-shadow: none;
    transform: none;
}

.loginModalContent form .ratingStar:hover {
    background: transparent;
    color: #f5c518;
    transform: scale(1.15);
}

.loginModalContent form .ratingStar.selected {
    background: transparent;
    color: #f5c518;
}


/* =========================================================
   МОДАЛЬНОЕ ОКНО ПОИСКА ФИЛЬМА (СТАРЫЙ #modal)
   ========================================================= */

#modal {
    display: none;

    position: fixed;
    inset: 0;
    z-index: 1000;

    justify-content: center;
    align-items: center;

    padding: 20px;

    background: rgba(0, 0, 0, 0.75);
}

#modal-content {
    width: 700px;
    max-width: 100%;
    max-height: 80vh;

    overflow-y: auto;

    padding: 25px;

    border-radius: 12px;

    background: #202020;
    color: #ffffff;

    box-shadow: 0 0 30px rgba(0, 0, 0, 0.50);
}

#movieSearch {
    width: 100%;
    padding: 12px;
    margin: 15px 0 20px;

    border: none;
    border-radius: 8px;

    font-size: 18px;
}

#searchResults {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 15px;

    padding: 10px;

    border-radius: 10px;
    background: #2a2a2a;
}

.search-item img {
    width: 60px;
    border-radius: 6px;
}

.search-info {
    flex: 1;
}

.search-title {
    font-size: 18px;
    font-weight: 700;
}

.search-year {
    color: #999999;
}

.add-button {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: #2ecc71;
    font-size: 16px;
}

#previewPoster {
    width: 180px;
    margin-bottom: 20px;
    border-radius: 12px;
}

#previewTitle {
    margin: 10px 0;
}

#previewGenres {
    margin: 15px 0;
    color: #999999;
}

#closeButton {
    margin-top: 20px;
}


/* =========================================================
   ЗАСТАВКА ПЕРЕД ВХОДОМ
   ========================================================= */

#introScreen {
    position: fixed;
    inset: 0;
    z-index: 10000;

    overflow: hidden;
    cursor: pointer;

    background: #111111;

    transform: translateY(0);
    transition: transform 0.20s ease-in-out;
}

#introScreen.is-hidden {
    transform: translateY(-100%);
}

#introScreen img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.introOverlay {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: flex-end;
    justify-content: center;

    padding: 40px;

    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.05),
        rgba(0, 0, 0, 0.70)
    );
}

.introHint {
    padding: 12px 20px;

    border-radius: 12px;

    background: rgba(20, 20, 20, 0.65);
    color: #ffffff;

    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);

    font-size: 18px;
    font-weight: 600;

    animation: introPulse 1.8s ease-in-out infinite;
}

@keyframes introPulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.04);
        opacity: 1;
    }
}

body.intro-open {
    overflow: hidden;
}

html.intro-already-shown #introScreen {
    display: none !important;
}


/* =========================================================
   АДАПТИВНОСТЬ
   ========================================================= */

@media (max-width: 700px) {
    body {
        padding: 28px 16px 36px;
    }

    .socialLinks {
        left: 16px;
    }

    .header {
        right: 16px;
    }

    .filters {
        align-items: stretch;
        gap: 10px;
    }

    .filters input,
    .filters select,
    .filters button {
        width: 100%;
        min-width: 0;
    }

    .movies {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 16px;
    }

    .modal {
        padding: 14px;
    }

    .loginModalContent {
        padding: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


/* =========================================================
   ДЛЯ СТРЕЛКИ
   ========================================================= */

.selectWrapper {
    position: relative;
    display: inline-block;

}

.selectArrow {
    position: absolute;
    right: 16px;
    top: 40%;
    transform: translateY(-50%);
    color: rgba(255,255,255,.55);
    font-size: 18px;
    pointer-events: none;
    transition: .18s;

}

.selectWrapper:hover .selectArrow {
    color: rgba(255,255,255,.92);

}