:root {
    --bg-main: #08080a;
    --bg-card: #141418;
    --bg-glass: rgba(255, 255, 255, 0.06);
    --bg-glass-hover: rgba(255, 255, 255, 0.12);
    --accent: #ff5500;
    --accent-hover: #ff6e26;
    --text-main: #ffffff;
    --text-muted: #8e8e98;
    --border: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-content {
    flex: 1;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8, 8, 10, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 28px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 6px;
}

.logo-text {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #fff, #ff7b39);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-badge {
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 6px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link {
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: 0.2s;
}

.nav-link:hover {
    color: #fff;
    background: var(--bg-glass);
}

.nav-link.active {
    background: #fff;
    color: #000;
    font-weight: 600;
}

.nav-link.admin-link {
    color: #ff884d;
    border: 1px solid rgba(255, 85, 0, 0.35);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 12px;
}

.search-box input {
    background: none;
    border: none;
    color: #fff;
    outline: none;
    font-size: 14px;
    width: 150px;
}

.search-box button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.auth-btn {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: 0.2s;
}

.auth-btn:hover {
    background: var(--bg-glass-hover);
}

.mobile-tabbar {
    display: none;
}

/* Category Pills */
.category-pills {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 20px 0 8px;
    scrollbar-width: none;
}

.category-pills::-webkit-scrollbar {
    display: none;
}

.pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: 0.2s;
}

.pill:hover {
    background: var(--bg-glass-hover);
}

.pill.featured-pill {
    background: linear-gradient(135deg, #c94000, #ff6a00);
    border: none;
}

.section-header {
    margin: 24px 0 16px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
}

/* Movies Grid */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 18px;
    margin-bottom: 40px;
}

.movie-card {
    display: block;
    transition: transform 0.25s;
}

.movie-card:hover {
    transform: translateY(-5px);
}

.poster-wrapper {
    position: relative;
    aspect-ratio: 2 / 3;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.poster-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rating-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 7px;
}

.tag-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 6px;
}

.movie-info {
    margin-top: 8px;
}

.movie-title {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movie-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Movie Details Page */
.movie-hero {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    margin: 20px 0 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.movie-hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.25;
    filter: blur(8px);
}

.movie-hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 32px;
    padding: 36px;
    background: linear-gradient(90deg, rgba(8,8,10,0.95) 35%, rgba(8,8,10,0.6) 100%);
}

.hero-poster {
    width: 230px;
    border-radius: 16px;
    aspect-ratio: 2/3;
    object-fit: cover;
    flex-shrink: 0;
}

.hero-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 680px;
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--text-muted);
    align-items: center;
}

.hero-title {
    font-size: 34px;
    font-weight: 800;
    margin-bottom: 14px;
    line-height: 1.15;
}

.hero-desc {
    color: #d1d1d6;
    font-size: 15px;
    margin-bottom: 24px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* Episodes Selector */
.episodes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.episode-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: 0.2s;
}

.episode-card:hover {
    background: var(--bg-glass-hover);
    border-color: var(--accent);
}

.episode-card.active {
    background: rgba(255, 85, 0, 0.18);
    border-color: var(--accent);
}

.episode-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
}

.episode-name {
    font-size: 14px;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-glass {
    background: var(--bg-glass);
    color: #fff;
    border: 1px solid var(--border);
}

.btn-glass:hover {
    background: var(--bg-glass-hover);
}

/* Watch Page (Player) */
.player-wrapper {
    margin: 20px 0 36px;
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.video-container video,
.video-container iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Forms & Cards */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    margin: 20px auto;
}

.auth-panel {
    max-width: 440px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
}

.captcha-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 85, 0, 0.08);
    border: 1px solid rgba(255, 85, 0, 0.25);
    padding: 12px 14px;
    border-radius: 12px;
}

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: rgba(255, 59, 48, 0.15);
    border: 1px solid rgba(255, 59, 48, 0.4);
    color: #ff6b6b;
}

.alert-success {
    background: rgba(52, 199, 89, 0.15);
    border: 1px solid rgba(52, 199, 89, 0.4);
    color: #5cd679;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
}

th, td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

th {
    color: var(--text-muted);
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 36px 0 24px;
    margin-top: 40px;
    background: #050507;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 28px;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 10px;
    max-width: 340px;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-links h4 {
    font-size: 14px;
    margin-bottom: 4px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 13px;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    body {
        padding-bottom: 68px;
    }

    .container {
        padding: 0 14px;
    }

    .nav-menu,
    .desktop-only {
        display: none;
    }

    .search-box {
        flex: 1;
        max-width: 200px;
    }

    .search-box input {
        width: 100%;
        font-size: 13px;
    }

    .mobile-tabbar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 200;
        display: flex;
        justify-content: space-around;
        align-items: center;
        background: rgba(14, 14, 18, 0.94);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid var(--border);
        padding: 8px 4px;
    }

    .tab-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        color: var(--text-muted);
        font-size: 18px;
    }

    .tab-item small {
        font-size: 10px;
        font-weight: 500;
    }

    .tab-item.active {
        color: var(--accent);
    }

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

    .episodes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .movie-hero-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 20px 16px;
        gap: 18px;
    }

    .hero-poster {
        width: 170px;
    }

    .hero-badges {
        justify-content: center;
    }

    .hero-title {
        font-size: 24px;
    }

    .hero-actions {
        width: 100%;
        flex-direction: column;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* Бейджи подписки PRO и бесплатного доступа */
.pro-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 7px;
    border-radius: 7px;
    letter-spacing: 0.4px;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.free-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 7px;
}

/* Модальное окно трейлера */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.86);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-backdrop.open {
    display: flex;
}

.modal-box {
    width: 100%;
    max-width: 920px;
    background: #121216;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-close {
    background: var(--bg-glass);
    border: 1px solid var(--border);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
}

/* Баннер блокировки без подписки */
.sub-lock-box {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(255, 85, 0, 0.12));
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 18px;
    padding: 28px 22px;
    text-align: center;
    margin: 20px 0;
}