/* ==========================================================
   Bilyat Kino — 首页样式（深色玻璃拟态主题，RTL / 维语）
   ========================================================== */

:root {
    --bg: #0b0d13;
    --bg-soft: #141822;
    --card: #171c28;
    --card-hover: #1e2433;
    --line: rgba(255, 255, 255, 0.08);
    --text: #f2f4f8;
    --muted: #98a1b3;
    --brand: #ff2d6f;
    --brand-2: #ff8a3d;
    --accent: #4fd1c5;
    --radius: 16px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'UKIJEkran', Arial, sans-serif;
    color: var(--text);
    direction: rtl;
    background:
        radial-gradient(1100px 500px at 85% -10%, rgba(255, 45, 111, 0.16), transparent 60%),
        radial-gradient(900px 480px at 10% 0%, rgba(79, 209, 197, 0.12), transparent 55%),
        var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px 16px 60px;
    -webkit-tap-highlight-color: transparent;
}

.container { max-width: 1280px; margin: 0 auto; }

/* ---------------- 头部 ---------------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 34px 28px 26px;
    margin-bottom: 22px;
    border-radius: 24px;
    animation: fadeUp .5s ease both;
    border: 1px solid var(--line);
    background:
        linear-gradient(135deg, rgba(255, 45, 111, 0.24), rgba(255, 138, 61, 0.14) 45%, rgba(79, 209, 197, 0.12)),
        rgba(20, 24, 34, 0.85);
    box-shadow: var(--shadow);
    text-align: center;
}

.hero::after {
    content: "";
    position: absolute;
    inset: -60% -10% auto auto;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(255, 45, 111, 0.28), transparent 65%);
    filter: blur(10px);
    pointer-events: none;
}

.hero h1 {
    position: relative;
    font-size: clamp(28px, 5vw, 46px);
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(100deg, #fff, #ffd9e6 35%, #ffb27a 70%, #9ff3ec);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.hero-sub {
    position: relative;
    color: var(--muted);
    font-size: 15px;
}

.hero-badge {
    position: relative;
    display: inline-block;
    margin-top: 14px;
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 13px;
    color: #0b0d13;
    font-weight: 700;
    background: linear-gradient(120deg, var(--accent), #7ee8fa);
    box-shadow: 0 6px 18px rgba(79, 209, 197, 0.35);
}

/* ---------------- 筛选 ---------------- */
.filter-section {
    padding: 16px 14px;
    margin-bottom: 18px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(23, 28, 40, 0.72);
    backdrop-filter: blur(8px);
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.filter-label {
    flex: 0 0 auto;
    position: sticky;
    right: 0;
    padding: 5px 12px;
    margin-left: 4px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--brand);
    background: rgba(255, 45, 111, 0.12);
    border: 1px solid rgba(255, 45, 111, 0.25);
    white-space: nowrap;
}

.filter-row:last-child { margin-bottom: 0; }
.filter-row::-webkit-scrollbar { display: none; }

.filter-btn {
    flex: 0 0 auto;
    padding: 8px 15px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: all .22s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.filter-btn.active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    box-shadow: 0 6px 18px rgba(255, 45, 111, 0.32);
}

/* ---------------- 搜索 ---------------- */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 22px;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

#searchInput {
    width: 100%;
    padding: 13px 46px 13px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(23, 28, 40, 0.85);
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    text-align: right;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    -webkit-appearance: none;
}

#searchInput::placeholder { color: #6d7688; }

#searchInput:focus {
    border-color: rgba(255, 45, 111, 0.55);
    box-shadow: 0 0 0 4px rgba(255, 45, 111, 0.14);
}

.search-wrap::before {
    content: "🔍";
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: .65;
    pointer-events: none;
}

#searchButton {
    flex: 0 0 auto;
    min-width: 92px;
    padding: 13px 22px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 8px 20px rgba(255, 45, 111, 0.28);
}

#searchButton:hover { transform: translateY(-2px); }
#searchButton:active { transform: translateY(0); }

/* ---------------- 加载 ---------------- */
.loading-spinner {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 46px 0;
    color: var(--muted);
}

.spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 区块标题 */
.section-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 4px 0 16px;
}

.section-head h2 {
    position: relative;
    padding-right: 12px;
    font-size: 20px;
    font-weight: 800;
}

.section-head h2::before {
    content: "";
    position: absolute;
    right: 0;
    top: 4px;
    bottom: 4px;
    width: 4px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--brand), var(--brand-2));
}

.section-head span { color: var(--muted); font-size: 13px; }

/* 骨架屏 */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

.skeleton-card {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--line);
}

.skeleton-pic { height: 300px; background: linear-gradient(90deg, #1b202c, #242b3b, #1b202c); }
.skeleton-line { height: 14px; margin: 14px 14px 0; border-radius: 6px; background: #242b3b; }
.skeleton-line.short { width: 55%; margin-bottom: 14px; }

.skeleton-pic, .skeleton-line {
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite linear;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------------- 影片网格 ---------------- */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.movie-card {
    position: relative;
    display: block;
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.movie-card:hover {
    transform: translateY(-6px);
    border-color: rgba(255, 45, 111, 0.45);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.5);
}

.movie-poster {
    position: relative;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: #10141d;
}

.movie-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .45s ease, filter .3s ease;
}

.movie-card:hover .movie-image { transform: scale(1.07); filter: saturate(1.12); }

.movie-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(9, 11, 16, 0.92) 0%, rgba(9, 11, 16, 0.15) 45%, transparent 70%);
    opacity: .9;
    pointer-events: none;
}

.movie-remarks {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    backdrop-filter: blur(6px);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    max-width: 78%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.movie-episodes {
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    backdrop-filter: blur(6px);
    font-size: 12px;
    font-weight: 700;
    color: #0b0d13;
    background: linear-gradient(120deg, var(--accent), #7ee8fa);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
    white-space: nowrap;
}

.movie-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s ease;
}

.movie-card:hover .movie-play { opacity: 1; }

.movie-play span {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 20px;
    color: #fff;
    background: rgba(255, 45, 111, 0.9);
    box-shadow: 0 8px 22px rgba(255, 45, 111, 0.45);
    transform: scale(.85);
    transition: transform .25s ease;
}

.movie-card:hover .movie-play span { transform: scale(1); }

.movie-info { position: relative; padding: 12px 13px 14px; }

.movie-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.5;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 44px;
}

.movie-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--muted);
}

.movie-tag {
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(79, 209, 197, 0.14);
    color: var(--accent);
    font-weight: 700;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------------- 分页 ---------------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.page-numbers { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

button, .page-numbers button {
    padding: 10px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(23, 28, 40, 0.85);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: all .2s ease;
}

button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.page-numbers button { padding: 8px 14px; min-width: 40px; }

.page-numbers button.active {
    border-color: transparent;
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    box-shadow: 0 6px 16px rgba(255, 45, 111, 0.3);
}

button:disabled { opacity: .45; cursor: not-allowed; }

#currentPage {
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(23, 28, 40, 0.6);
    color: var(--muted);
    font-size: 13px;
}

/* ---------------- 空状态 / 回到顶部 ---------------- */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    border-radius: var(--radius);
    border: 1px dashed var(--line);
    background: rgba(23, 28, 40, 0.5);
    color: var(--muted);
    font-size: 16px;
}

.empty-state::before {
    content: "🍿";
    font-size: 34px;
    opacity: .8;
}

.to-top {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(23, 28, 40, 0.9);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
}

.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }

button:focus-visible, .filter-btn:focus-visible, #searchInput:focus-visible {
    outline: 2px solid rgba(255, 45, 111, 0.7);
    outline-offset: 2px;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 768px) {
    body { padding: 14px 10px 50px; }

    .hero { padding: 24px 18px 20px; border-radius: 18px; }

    .movies-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .skeleton-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

    .movie-title { font-size: 14px; min-height: 40px; }
    .movie-meta { font-size: 11px; }

    #searchButton { min-width: 74px; padding: 13px 16px; }

    .pagination { gap: 8px; }
    .page-numbers { order: 2; width: 100%; }
    #currentPage { order: 1; width: 100%; text-align: center; }
    #prevPage, #nextPage { order: 3; padding: 9px 14px; }

    .filter-section { padding: 12px 10px; }
    .filter-label { padding: 4px 10px; font-size: 11px; }
    .section-head { margin-bottom: 12px; }
    .section-head h2 { font-size: 18px; }
}

@media (min-width: 1280px) {
    .movies-grid, .skeleton-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
