/* ========================================================================
   VARIABLES & RESET
   ======================================================================== */
:root {
    --bg-body: #121212;
    --bg-card: #1e1e1e;
    --bg-header: #181818;
    --bg-input: #000000;
    --accent: #e50914;
    --accent-hover: #ff1f2b;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --border-color: #333;
    --radius: 6px;
    --container-width: 1240px;
    --font-main: 'Nunito', sans-serif;
}

/* Добавь это правило для всех шрифтов */
@font-face {
    font-family: 'Nunito';
    font-display: swap; /* ВАЖНО: Показывает текст сразу стандартным шрифтом, потом подменяет на красивый */
}

* { box-sizing: border-box; outline: none; }

body {
    margin: 0; padding: 0;
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.5;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: 0.2s; cursor: pointer; }
a:hover { color: var(--accent); }
ul { list-style: none; padding: 0; margin: 0; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0 0 15px 0; font-weight: 700; }

/* Глобальные стили для форм */
input[type="text"], input[type="password"], textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 10px;
    border-radius: var(--radius);
    font-family: var(--font-main);
}
input:focus, textarea:focus { border-color: var(--accent); }
button, input[type="submit"], input[type="button"] {
    cursor: pointer;
    font-family: var(--font-main);
}

/* UTILS */
.d-flex { display: flex; }
.ai-center { align-items: center; }
.jc-space-between { justify-content: space-between; }
.hidden { display: none; }
.btn { cursor: pointer; display: inline-block; transition: 0.2s; }

/* ========================================================================
   LAYOUT STRUCTURE
   ======================================================================== */
.wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.wrapper-container { width: 100%; max-width: var(--container-width); margin: 0 auto; padding: 0 15px; position: relative; z-index: 10; }

/* ========================================================================
   HEADER
   ======================================================================== */
.header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.header__inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.logo {
    font-size: 26px; font-weight: 900; text-transform: uppercase;
    color: #fff !important; white-space: nowrap; display: flex; align-items: center;
}
.logo span { color: var(--accent); }

.header__search { flex-grow: 1; max-width: 600px; position: relative; }
.header__search-input {
    width: 100%; background: var(--bg-input); border: 1px solid var(--border-color);
    padding: 10px 45px 10px 15px; border-radius: var(--radius); color: #fff;
}
.header__search-btn {
    position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px;
}

.header__auth .btn-login {
    background: var(--accent); color: #fff; padding: 8px 20px;
    border-radius: var(--radius); font-weight: 700; font-size: 14px;
}
.header__auth .btn-login:hover { background: var(--accent-hover); }

/* Элементы мобильного меню (скрыты на ПК) */
.header__btn-mobile-menu { font-size: 24px; cursor: pointer; display: none; }
.header__btn-mobile-search { display: none; }

/* ========================================================================
   NAVIGATION
   ======================================================================== */
.nav { background: var(--bg-card); border-bottom: 1px solid var(--border-color); margin-bottom: 30px; }
.nav ul { display: flex; flex-wrap: wrap; justify-content: center; }
.nav li { margin: 0; }
.nav a {
    display: block; padding: 15px 20px; font-weight: 700; text-transform: uppercase;
    font-size: 14px; color: var(--text-muted);
}
.nav a:hover, .nav a.active { color: var(--text-main); background: rgba(255,255,255,0.05); }

/* ========================================================================
   MAIN GRID
   ======================================================================== */
.colums { display: grid; grid-template-columns: 1fr 300px; gap: 30px; margin-bottom: 40px; }

/* SECTIONS */
.section { margin-bottom: 40px; }
.section__header {
    display: flex; align-items: center; margin-bottom: 20px;
    border-left: 4px solid var(--accent); padding-left: 15px;
}
.section__title { font-size: 22px; font-weight: 800; text-transform: uppercase; margin: 0; }

/* ========================================================================
   SHORTSTORY (GRID ITEMS)
   ======================================================================== */
.section__items { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }

.movie-item {
    background: var(--bg-card); border-radius: var(--radius); overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s; position: relative; display: flex; flex-direction: column;
}
.movie-item:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.4); }
.movie-item__link { display: block; position: relative; z-index: 1; }
.movie-item__img { position: relative; width: 100%; aspect-ratio: 2 / 3; overflow: hidden; background: #111; }
.movie-item__img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.movie-item:hover .movie-item__img img { transform: scale(1.05); }
.movie-item__label {
    position: absolute; top: 10px; right: 10px; background: var(--accent);
    color: #fff; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; z-index: 2;
}
.hover__overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center; opacity: 0; transition: 0.3s; z-index: 3; pointer-events: none;
}
.movie-item:hover .hover__overlay { opacity: 1; }
.hover__overlay .fa-play { font-size: 40px; color: #fff; filter: drop-shadow(0 0 10px rgba(0,0,0,0.5)); }
.movie-item__info { padding: 12px; flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between; }
.movie-item__title {
    font-weight: 700; font-size: 15px; line-height: 1.3; margin-bottom: 8px; color: #fff;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.movie-item__meta {
    font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between;
    border-top: 1px solid rgba(255,255,255,0.1); padding-top: 8px;
}

/* ========================================================================
   FULLSTORY
   ======================================================================== */
.inner-page__columns { display: grid; grid-template-columns: 260px 1fr; gap: 40px; }
.inner-page__left { position: relative; z-index: 5; }
.inner-page__img {
    border-radius: var(--radius); overflow: hidden; box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    margin-bottom: 20px; aspect-ratio: 2 / 3;
}
.inner-page__img img { width: 100%; height: 100%; object-fit: cover; }

.btn-download {
    display: flex; align-items: center; justify-content: center; width: 100%;
    background: transparent; color: var(--accent); text-align: center; padding: 14px;
    border-radius: var(--radius); font-weight: 800; text-transform: uppercase;
    border: 2px solid var(--accent); font-size: 16px; transition: 0.2s;
    position: relative; z-index: 10;
}
.btn-download:hover { background: var(--accent); color: #fff; box-shadow: 0 0 15px rgba(229, 9, 20, 0.4); }

.inner-page__header { border-bottom: 1px solid var(--border-color); padding-bottom: 20px; margin-bottom: 20px; }
.inner-page__title { font-size: 32px; line-height: 1.2; margin-bottom: 10px; color: #fff; }

/* Кнопка редактирования */
.inner-page__title a[onclick], 
.inner-page__title a[href^="/admin"] {
    position: relative; z-index: 100; display: inline-block; vertical-align: middle; cursor: pointer;
}
.inner-page__title .fa-pencil { transition: 0.2s; }
.inner-page__title a:hover .fa-pencil { opacity: 1 !important; color: var(--accent); transform: scale(1.2); }

.inner-page__rating { display: flex; gap: 10px; }
.rating-btn {
    display: flex; align-items: center; padding: 5px 10px; border-radius: 4px;
    font-size: 13px; font-weight: bold; cursor: pointer;
}
.rating-btn.like { background: #2ecc71; color: #fff; }
.rating-btn.dislike { background: #e74c3c; color: #fff; }
.rating-btn img { width: 16px; height: 16px; margin-right: 5px; }

.inner-page__list { background: var(--bg-card); padding: 20px; border-radius: var(--radius); margin-bottom: 30px; }
.inner-page__list li { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; align-items: center; }
.inner-page__list li:last-child { border-bottom: none; }
.inner-page__list li span:first-child { width: 100px; color: var(--text-muted); font-weight: 600; flex-shrink: 0; }

.inner-page__list .tags-list { display: flex; flex-wrap: wrap; gap: 6px; }
.inner-page__list .tags-list a {
    background: #333; color: #ccc; padding: 4px 10px; border-radius: 4px; font-size: 13px; display: inline-block;
}
.inner-page__list .tags-list a:hover { background: var(--accent); color: #fff; }

/* --- КАРТИНКИ В ПОЛНОЙ НОВОСТИ (ПК) --- */
.inner-page__text { font-size: 16px; color: #ddd; line-height: 1.8; margin-top: 20px; }
.inner-page__text img { max-width: 100%; border-radius: 6px; margin-bottom: 10px; }

/* Миниатюры 85x100 на ПК */
.inner-page__text img, 
.inner-page__text a:has(img) { 
    display: inline-block;
    width: 85px; 
    height: 100px;
    object-fit: cover; 
    object-position: top center;
    margin-right: 10px;
    margin-bottom: 10px;
    vertical-align: top;
}

/* ========================================================================
   SIMPLE SEARCH PAGE (Поиск по центру)
   ======================================================================== */
.simple-search-container {
    grid-column: 1 / -1 !important; width: 100%;
    background: var(--bg-card); padding: 40px 20px;
    border-radius: var(--radius); border: 1px solid var(--border-color);
    margin-bottom: 30px; box-sizing: border-box;
    display: flex; justify-content: center;
}
.simple-search-row {
    display: flex; flex-direction: column; align-items: center; gap: 15px; width: 100%;
}
.simple-search-input {
    width: 100%; max-width: 300px; background: #000;
    border: 1px solid #333; color: #fff; padding: 12px 15px;
    border-radius: 4px; font-size: 16px; height: 45px; text-align: center;
}
.simple-search-input:focus { border-color: var(--accent); }
.simple-search-btn {
    width: 100%; max-width: 200px; background: var(--accent);
    color: #fff; border: none; padding: 0 20px;
    border-radius: 4px; font-weight: 800; text-transform: uppercase;
    cursor: pointer; height: 45px; transition: 0.2s;
}
.simple-search-btn:hover { background: var(--accent-hover); }
.search-result-msg {
    grid-column: 1 / -1 !important; width: 100%; margin-bottom: 20px;
    padding: 15px; background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid var(--accent); color: #ddd; font-size: 16px;
    box-sizing: border-box; text-align: center;
}

/* ========================================================================
   PAGINATION (Навигация)
   ======================================================================== */
.navigation {
    grid-column: 1 / -1 !important; width: 100%;
    display: flex; justify-content: center; align-items: center;
    gap: 8px; margin: 40px 0; flex-wrap: wrap; clear: both;
}
.navigation a, .navigation span {
    display: flex; align-items: center; justify-content: center;
    min-width: 40px; height: 40px; padding: 0 15px;
    background: var(--bg-card); color: #fff;
    border-radius: var(--radius); font-weight: 700; font-size: 14px;
    border: 1px solid var(--border-color); transition: all 0.2s ease;
    text-decoration: none;
}
.navigation a:hover {
    background: var(--accent); border-color: var(--accent); color: #fff;
    transform: translateY(-2px); box-shadow: 0 5px 15px rgba(229, 9, 20, 0.3);
}
.navigation span {
    background: var(--accent); border-color: var(--accent); color: #fff;
    cursor: default; pointer-events: none;
}
.navigation a i, .navigation span i { font-style: normal; }

/* Скрываем кривую навигацию внутри сетки поиска */
.section__items .navigation, .section__items > div:not(.movie-item) { display: none !important; }
.main .navigation { display: flex !important; }

/* ========================================================================
   LOGIN MODAL
   ======================================================================== */
.login-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8); z-index: 9999;
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(5px);
}
.login-box {
    background: #1e1e1e; width: 100%; max-width: 360px;
    padding: 30px; border-radius: 10px; position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5); border: 1px solid #333;
    text-align: center;
}
.login-close {
    position: absolute; top: 15px; right: 15px;
    color: #777; cursor: pointer; font-size: 20px; transition: 0.2s;
}
.login-close:hover { color: #fff; }
.login-title { font-size: 22px; font-weight: 800; margin-bottom: 20px; color: #fff; text-transform: uppercase; }
.login-input { margin-bottom: 15px; }
.login-input input {
    width: 100%; background: #111; border: 1px solid #333;
    padding: 12px; border-radius: 6px; color: #fff;
}
.login-input input:focus { border-color: var(--accent); }
.login-btn {
    width: 100%; background: var(--accent); color: #fff; border: none;
    padding: 12px; border-radius: 6px; font-weight: 800; text-transform: uppercase;
    margin-top: 10px; display: block;
}
.login-btn:hover { background: var(--accent-hover); }
.login-btn.logout { background: #333; margin-top: 20px; }
.login-btn.logout:hover { background: #444; }
.login-links { margin-top: 15px; display: flex; justify-content: space-between; font-size: 13px; }
.login-links a { color: #888; }
.login-links a:hover { color: #fff; }
.login-user { margin-bottom: 20px; }
.login-avatar img { width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 10px; object-fit: cover; border: 3px solid var(--accent); }
.login-name { font-size: 18px; font-weight: 700; color: #fff; }
.login-menu { text-align: left; margin-bottom: 10px; }
.login-menu li { border-bottom: 1px solid rgba(255,255,255,0.05); }
.login-menu li:last-child { border-bottom: none; }
.login-menu a { display: block; padding: 12px 0; color: #ccc; font-weight: 600; font-size: 14px; }
.login-menu a span { width: 25px; color: var(--accent); text-align: center; }
.login-menu a:hover { color: #fff; padding-left: 5px; }

/* ========================================================================
   SIDEBAR & FOOTER
   ======================================================================== */
.sidebar .section__content { display: flex; flex-direction: column; gap: 15px; }
.soon-item {
    display: flex; gap: 15px; align-items: center; background: var(--bg-card);
    padding: 10px; border-radius: var(--radius); transition: 0.2s;
}
.soon-item:hover { background: #2a2a2a; }
.soon-item__img { width: 60px; height: 80px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.soon-item__info { overflow: hidden; }
.soon-item__title {
    font-size: 14px; font-weight: 700; margin-bottom: 4px; color: #fff;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.soon-item__meta { font-size: 12px; color: var(--text-muted); }

.footer {
    background: var(--bg-header); padding: 40px 0; margin-top: auto;
    border-top: 1px solid var(--border-color); text-align: center; color: var(--text-muted);
}
.footer__menu { display: flex; justify-content: center; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; }
.footer__menu a { font-weight: 700; text-transform: uppercase; font-size: 14px; }
.seo-text-block { background: var(--bg-card); border-radius: var(--radius); margin-top: 40px; color: #ccc; }

/* ========================================================================
   TAGS CLOUD
   ======================================================================== */
.tags-cloud-page {
    background: var(--bg-card); padding: 30px; border-radius: var(--radius);
    text-align: center; font-size: 0; line-height: 0;
}
.tags-cloud-page a {
    display: inline-block; font-size: 14px; line-height: 1.5;
    background: #2d2d2d; color: #ccc; padding: 8px 16px; margin: 6px;
    border-radius: 20px; font-weight: 700; transition: all 0.2s ease;
    border: 1px solid transparent;
}
.tags-cloud-page a:hover {
    background: var(--accent); color: #fff; transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(229, 9, 20, 0.3); border-color: var(--accent);
    text-decoration: none;
}

/* ========================================================================
   SCROLL TO TOP
   ======================================================================== */
.scroll-top {
    position: fixed; bottom: 30px; right: 30px; width: 50px; height: 50px;
    background: var(--accent); color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 900; font-size: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    opacity: 0; visibility: hidden; transform: translateY(20px);
    transition: all 0.3s ease;
}
.scroll-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-top:hover {
    background: var(--accent-hover); transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(229, 9, 20, 0.5);
}

/* ========================================================================
   FIX: Скрываем старый мусор
   ======================================================================== */
#scrolltop, .mobile-menu-close, .mobile-menu, .overlay {
    display: none !important; opacity: 0 !important;
    pointer-events: none !important; visibility: hidden !important;
}

/* ========================================================================
   RESPONSIVE (Финальная адаптация под iPhone)
   ======================================================================== */
@media (max-width: 1024px) {
    .colums { grid-template-columns: 1fr; }
    .sidebar { display: none; }
}

@media (max-width: 768px) {
    /* Показываем кнопку меню */
    .header__btn-mobile-menu { display: block; }
    
    /* --- МОБИЛЬНЫЙ ПОИСК --- */
    .header__btn-mobile-search {
        display: block; font-size: 22px; cursor: pointer; margin-left: auto; padding: 5px;
    }
    .header__search {
        display: none; position: absolute; top: 100%; left: 0; width: 100%;
        background: var(--bg-header); padding: 15px;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 10px 20px rgba(0,0,0,0.5); z-index: 90;
    }
    
    /* Скрываем лишнее */
    .nav { display: none; }
    .header__auth { display: none; }

    /* --- КОНТЕНТ --- */
    .content { padding-top: 20px; }
    
    /* Сетка 2 столбика */
    .section__items { 
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
    }
    
    /* Шрифты */
    .movie-item__title { font-size: 13px; line-height: 1.2; }
    .movie-item__meta { font-size: 10px; padding-top: 5px; }

    /* Пагинация */
    .navigation { gap: 5px; margin: 20px 0; }
    .navigation a, .navigation span {
        min-width: 32px; height: 32px; font-size: 12px; padding: 0;
    }

    /* Полная новость */
    .inner-page__columns { grid-template-columns: 1fr; gap: 20px; }
    .inner-page__img { max-width: 100%; margin: 15px auto 20px; }
    
    /* Галерея (крупная) */
    .inner-page__text img, .inner-page__text a:has(img) {
        display: inline-block;
        width: 48% !important;
        height: auto !important;
        aspect-ratio: 4/3;
        margin-right: 2% !important;
        margin-bottom: 10px !important;
        object-fit: cover;
    }
    .inner-page__text img:nth-of-type(2n),
    .inner-page__text a:nth-of-type(2n) { margin-right: 0 !important; }

    /* Остальное */
    .seo-text-block { padding: 15px !important; font-size: 13px; }
    .tags-cloud-page { padding: 15px; }
    .tags-cloud-page a { padding: 5px 10px; margin: 3px; font-size: 12px; }
    .search-page-wrapper { padding: 15px; }
    .simple-search-container { padding: 20px 15px; }
    .simple-search-input { max-width: 100%; }
    .section { margin-bottom: 30px; }
    .section__title { font-size: 18px; }
    .scroll-top { width: 40px; height: 40px; bottom: 20px; right: 20px; font-size: 16px; }
}