.home-shell {
    width: min(1500px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 28px 0 56px;
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 28px;
    align-items: end;
    min-height: 360px;
    padding: 42px;
    border: 1px solid #263241;
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(13, 17, 23, 0.96), rgba(13, 17, 23, 0.70)),
        url("https://image.tmdb.org/t/p/original/9l1eZiJHmhr5jIlthMdJN5WYoff.jpg") center / cover;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.hero-copy {
    max-width: 720px;
}

.eyebrow {
    margin: 0 0 8px;
    color: #58a6ff;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.hero-copy h1 {
    margin: 0;
    color: #f0f6fc;
    font-size: clamp(2.4rem, 7vw, 5.4rem);
    line-height: 0.95;
    letter-spacing: 0;
}

.hero-text {
    max-width: 620px;
    margin: 18px 0 0;
    color: #d0d7de;
    font-size: 1.05rem;
    line-height: 1.6;
}

.search-panel {
    padding: 22px;
    border: 1px solid rgba(139, 148, 158, 0.28);
    border-radius: 8px;
    background: rgba(13, 17, 23, 0.82);
    backdrop-filter: blur(18px);
}

.search-label {
    display: block;
    margin: 0;
    color: #f0f6fc;
    font-weight: 700;
}

.panel-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.language-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    border: 1px solid #3d444d;
    border-radius: 8px;
    background: #0d1117;
}

.language-toggle button {
    min-width: 44px;
    height: 32px;
    border: 0;
    color: #8b949e;
    background: transparent;
    font-weight: 800;
}

.language-toggle button.active {
    color: #ffffff;
    background: #1f6feb;
}

.search-box {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 36px;
    align-items: center;
    min-height: 54px;
    border: 1px solid #3d444d;
    border-radius: 8px;
    background: #0d1117;
}

.search-icon {
    color: #8b949e;
    text-align: center;
    font-size: 1rem;
    font-weight: 900;
}

.search-box input {
    min-width: 0;
    height: 52px;
    border: 0;
    outline: 0;
    color: #f0f6fc;
    background: transparent;
    font-size: 1rem;
}

.search-box button {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    color: #8b949e;
    background: transparent;
    font-size: 1.25rem;
    line-height: 1;
}

.search-box button:hover {
    color: #f0f6fc;
    background: #21262d;
}

.filter-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.filter-chip {
    border: 1px solid #3d444d;
    border-radius: 8px;
    color: #c9d1d9;
    background: #161b22;
    padding: 8px 12px;
    font-weight: 700;
}

.filter-chip.active,
.filter-chip:hover {
    color: #ffffff;
    border-color: #58a6ff;
    background: #1f6feb;
}

.rows-area {
    margin-top: 30px;
}

.content-section {
    margin-top: 34px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: end;
    margin-bottom: 14px;
}

.section-heading h2 {
    margin: 0;
    color: #f0f6fc;
    font-size: 1.45rem;
    letter-spacing: 0;
}

.section-note,
.section-count {
    color: #8b949e;
    font-size: 0.92rem;
}

.media-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 180px);
    gap: 14px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 2px 2px 16px;
    scrollbar-color: #3d444d transparent;
}

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

.discover-section {
    padding-top: 10px;
}

.discover-filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid #30363d;
    border-radius: 8px;
    background: #161b22;
}

.discover-filters label {
    display: grid;
    gap: 7px;
    min-width: 0;
    color: #8b949e;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.discover-filters select,
.discover-filters input {
    width: 100%;
    min-width: 0;
    height: 42px;
    border: 1px solid #3d444d;
    border-radius: 8px;
    color: #f0f6fc;
    background: #0d1117;
    padding: 0 10px;
    font-size: 0.95rem;
}

.media-card {
    min-width: 0;
    cursor: pointer;
    outline: none;
}

.media-card:focus-visible .poster-wrap {
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.25);
}

.poster-wrap {
    position: relative;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border: 1px solid #30363d;
    border-radius: 8px;
    background: #161b22;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.26);
}

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

.media-card:hover img {
    transform: scale(1.035);
    filter: brightness(1.08);
}

.poster-wrap.is-local {
    border: 2px solid #2ea043;
}

.available-badge {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 7px 6px;
    color: #ffffff;
    background: rgba(46, 160, 67, 0.92);
    font-size: 0.72rem;
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
}

.poster-fallback {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    padding: 14px;
    color: #8b949e;
    text-align: center;
    font-weight: 700;
}

.media-meta {
    padding: 9px 2px 0;
}

.media-meta h3 {
    margin: 0;
    overflow: hidden;
    color: #f0f6fc;
    font-size: 0.94rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-meta p {
    margin: 4px 0 0;
    overflow: hidden;
    color: #8b949e;
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rating-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 7px;
}

.rating-row span {
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #d0d7de;
    background: #161b22;
    padding: 3px 5px;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
}

.loading-state,
.empty-state {
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #8b949e;
    background: #161b22;
    padding: 20px;
}

.hidden {
    display: none;
}

.scroll-sentinel {
    height: 1px;
}

.modal-open {
    overflow: hidden;
}

.title-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 28px;
}

.title-modal.hidden {
    display: none;
}

.title-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(1, 4, 9, 0.78);
    backdrop-filter: blur(8px);
}

.title-modal__panel {
    position: relative;
    width: min(1300px, 100%); /* Szélesebb lett */
    max-height: min(880px, calc(100vh - 56px));
    overflow-y: auto; /* Csak lefelé görgethető a szöveg */
    overflow-x: hidden; /* Globális vízszintes görgetés letiltása! */
    border: 1px solid #30363d;
    border-radius: 8px;
    background: #0d1117;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.58);
}


.title-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(240, 246, 252, 0.22);
    border-radius: 8px;
    color: #ffffff;
    background: rgba(13, 17, 23, 0.78);
    font-size: 1.4rem;
    line-height: 1;
}

.detail-hero {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 26px;
    min-height: 420px;
    padding: 42px;
    background-position: center;
    background-size: cover;
}

.detail-poster {
    align-self: end;
}

.detail-poster img {
    width: 100%;
    border: 1px solid #30363d;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.detail-copy {
    align-self: end;
}

.detail-copy h2 {
    margin: 0;
    color: #f0f6fc;
    font-size: clamp(2.1rem, 5vw, 4.4rem);
    line-height: 0.98;
    letter-spacing: 0;
}

.detail-tagline {
    margin: 12px 0 0;
    color: #d0d7de;
    font-size: 1.05rem;
}

.detail-ratings,
.genre-row,
.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.detail-ratings span,
.genre-row span {
    border: 1px solid #3d444d;
    border-radius: 8px;
    color: #f0f6fc;
    background: rgba(22, 27, 34, 0.82);
    padding: 7px 10px;
    font-size: 0.86rem;
}

.request-button,
.trailer-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 8px;
    padding: 0 16px;
    font-weight: 900;
    text-decoration: none;
}

.request-button {
    border: 0;
    color: #ffffff;
    background: #2ea043;
}

.trailer-link {
    border: 1px solid #3d444d;
    color: #f0f6fc;
    background: rgba(22, 27, 34, 0.82);
}

.request-note {
    margin: 10px 0 0;
    color: #8b949e;
    font-size: 0.86rem;
}

.detail-body {
    display: grid;
    gap: 28px;
    padding: 0 42px 42px;
}

.detail-body section {
    min-width: 0; 
}

.detail-body h3 {
    margin: 0 0 12px;
    color: #f0f6fc;
    font-size: 1.1rem;
}

.detail-body p {
    max-width: 880px;
    margin: 0;
    color: #d0d7de;
    line-height: 1.7;
}


.cast-row,
.image-row {
    display: grid;
    grid-auto-flow: column;
    gap: 12px;
    overflow-x: auto; /* Helyi vízszintes görgetés */
    padding-bottom: 14px; /* Hely a görgetősávnak */
    scrollbar-color: #3d444d transparent; /* Modern, sötét görgetősáv */
}

.cast-row {
    grid-auto-columns: 132px;
}

.image-row {
    grid-auto-columns: minmax(260px, 360px);
}

/* Tegyünk egy kis hover effektet a színészekre is, hogy éljen a felület */
.cast-card {
    min-width: 0;
    transition: transform 0.2s ease;
    cursor: default;
}
.cast-card:hover {
    transform: scale(1.03);
}


.cast-card img,
.cast-fallback {
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: 8px;
    object-fit: cover;
    background: #161b22;
}

.cast-card strong,
.cast-card small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cast-card strong {
    margin-top: 8px;
    color: #f0f6fc;
    font-size: 0.88rem;
}

.cast-card small {
    color: #8b949e;
    font-size: 0.78rem;
}

.image-row {
    grid-auto-columns: minmax(260px, 360px);
}

.image-row img {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    object-fit: cover;
    background: #161b22;
}

@media (max-width: 860px) {
    .home-shell {
        width: min(100vw - 20px, 760px);
        padding-top: 14px;
    }

    .hero-panel {
        grid-template-columns: 1fr;
        min-height: 0;
        padding: 24px;
    }

    .hero-copy h1 {
        font-size: 3rem;
    }

    .media-row {
        grid-auto-columns: minmax(132px, 42vw);
    }

    .section-heading {
        align-items: start;
        flex-direction: column;
        gap: 4px;
    }

    .discover-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .title-modal {
        padding: 12px;
    }

    .title-modal__panel {
        max-height: calc(100vh - 24px);
    }

    .detail-hero {
        grid-template-columns: 1fr;
        padding: 28px;
    }

    .detail-poster {
        width: min(190px, 52vw);
    }

    .detail-body {
        padding: 0 28px 28px;
    }
}

@media (max-width: 520px) {
    .panel-topline {
        align-items: start;
        flex-direction: column;
    }

    .discover-filters {
        grid-template-columns: 1fr;
    }
}
