html,
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    background: #0d0f12;
    color: #f2f2f2;
}

.films-page,
.films-page * {
    box-sizing: border-box;
}

.films-page {
    width: calc(100% - 80px);
    margin: 35px auto 80px;
}

.films-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 25px;
}

.films-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.films-subtitle {
    margin: 6px 0 0;
    color: #8f949d;
}

.films-tools {
    padding: 18px;
    border: 1px solid #262a30;
    border-radius: 12px;
    background: #15181d;
}

.search-container {
    position: relative;
    margin-bottom: 14px;
}

.search-container i {
    position: absolute;
    top: 50%;
    left: 14px;
    color: #727781;
    transform: translateY(-50%);
    pointer-events: none;
}

#search-bar {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1px solid #30343b;
    border-radius: 8px;
    outline: none;
    background: #0f1115;
    color: #f2f2f2;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, background 0.2s ease;
}

#search-bar:focus {
    border-color: #666d78;
    background: #12151a;
}

#search-bar::placeholder {
    color: #6f747c;
}

.filter-container {
    display: grid;
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    gap: 10px;
}

.filter-container select {
    width: 100%;
    min-width: 0;
    padding: 10px 34px 10px 11px;
    border: 1px solid #30343b;
    border-radius: 7px;
    outline: none;
    background: #0f1115;
    color: #dfe1e5;
    cursor: pointer;
}

.filter-container select:focus {
    border-color: #666d78;
}

.films-information {
    display: flex;
    justify-content: flex-end;
    margin: 18px 2px 12px;
}

#film-count {
    color: #9298a1;
    font-size: 0.9rem;
}

.films-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 18px;
}

.film-card {
    display: flex;
    min-width: 0;
    overflow: hidden;
    flex-direction: column;
    border: 1px solid #24282e;
    border-radius: 10px;
    background: #15181d;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease;
}

.film-card:hover {
    transform: translateY(-4px);
    border-color: #4a5059;
    background: #191d22;
}

.film-main-link {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
}

.film-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: #101216;
}

.film-image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.film-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    background:
        linear-gradient(
            145deg,
            #191c21,
            #101216
        );
    color: #656b74;
    text-align: center;
}

.film-placeholder i {
    font-size: 2.3rem;
}

.film-placeholder span {
    font-size: 0.85rem;
}

.film-card-content {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 12px;
}

.film-card-content h2 {
    margin: 0 0 9px;
    overflow: hidden;
    color: #f1f1f1;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.film-info {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    margin: 4px 0 0;
    color: #858b94;
    font-size: 0.78rem;
}

.film-info i {
    width: 14px;
    flex-shrink: 0;
    color: #69717c;
    text-align: center;
}

.film-info span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.film-card-actions {
    padding: 0 10px 10px;
}

.film-watched-button {
    display: flex;
    width: 100%;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 9px;
    border: 1px solid #34404c;
    border-radius: 7px;
    background: #182029;
    color: #aebdcb;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        color 0.2s ease;
}

.film-watched-button:hover {
    border-color: #3b82f6;
    background: #14253a;
    color: #cbe1fb;
}

.loading-container {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    color: #8f949d;
}

.loading-container.visible {
    display: flex;
}

.loader {
    width: 17px;
    height: 17px;
    border: 2px solid #353a42;
    border-top-color: #d4d6da;
    border-radius: 50%;
    animation: loading-spin 0.7s linear infinite;
}

.end-message {
    display: none;
    padding: 30px;
    color: #686e77;
    text-align: center;
    font-size: 0.9rem;
}

.end-message.visible {
    display: block;
}

@keyframes loading-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1200px) {
    .filter-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 700px) {
    .films-page {
        width: calc(100% - 24px);
        margin-top: 20px;
    }

    .films-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .filter-container {
        grid-template-columns: 1fr 1fr;
    }

    .films-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .film-card-content {
        padding: 10px;
    }

    .film-card-content h2 {
        font-size: 0.88rem;
    }

    .film-info {
        font-size: 0.72rem;
    }

    .film-card-actions {
        padding: 0 8px 8px;
    }

    .film-watched-button {
        font-size: 0.72rem;
    }
}

@media (max-width: 430px) {
    .filter-container {
        grid-template-columns: 1fr;
    }
}