/* --- Global Styles & Variables --- */
:root {
	--primary-color: #e50914;
	--dark-bg: #141414;
	--card-bg: #222;
	--text-color: #ffffff;
	--text-muted: #999;
	--border-color: #333;
	--container-width: 1200px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif; background-color: var(--dark-bg); color: var(--text-color); font-size: 16px; }
a { color: var(--primary-color); text-decoration: none; transition: color 0.3s ease; }
a:hover { color: var(--text-color); }
img { max-width: 100%; height: auto; display: block; }
.container { max-width: var(--container-width); margin: 0 auto; padding: 0 15px; }
.wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.main { flex-grow: 1; padding: 20px 0; }
.page-title, .section-title { margin-bottom: 20px; border-left: 4px solid var(--primary-color); padding-left: 15px; font-size: 24px; }

/* --- Header --- */
.header { background-color: var(--card-bg); padding: 15px 0; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.header__inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.header__logo { font-size: 28px; font-weight: 700; color: var(--text-color); text-decoration: none; text-transform: uppercase; letter-spacing: 1px; }
.logo__accent { background-color: var(--primary-color); color: var(--text-color); padding: 2px 8px; border-radius: 6px; margin-left: 2px; }
.header__menu { margin-left: auto; }
.header__menu ul { list-style: none; display: flex; gap: 15px; }
.header__menu a { color: var(--text-muted); font-weight: 500; font-size: 16px; text-decoration: none; display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 6px; transition: all 0.3s ease; }
.header__menu a:hover, .header__menu a.active { color: var(--text-color); background-color: rgba(255,255,255,0.1); }
.header__menu .material-icons { font-size: 20px; }
.header__search { position: relative; }
.header__search form { display: flex; }
.header__search input { background: var(--dark-bg); border: 1px solid var(--border-color); color: var(--text-color); padding: 10px 40px 10px 15px; border-radius: 20px; outline: none; transition: border-color 0.3s ease; min-width: 250px; }
.header__search input:focus { border-color: var(--primary-color); }
.search__button { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 5px; display: flex; align-items: center; justify-content: center; }
.search__button:hover { color: var(--primary-color); }
.header__mobile-btn { display: none; color: var(--text-color); cursor: pointer; }

/* --- Category List --- */
.categories-section { margin-bottom: 30px; }
.category-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 20px; }
.category-list__item a { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; background-color: var(--card-bg); border-radius: 6px; text-decoration: none; transition: all 0.3s ease; }
.category-list__item a:hover { background-color: var(--primary-color); }
.category-list__title { color: var(--text-color); font-weight: 500; }
.category-list__count { color: var(--text-muted); font-size: 14px; }
.category-list__item a:hover .category-list__title, .category-list__item a:hover .category-list__count { color: var(--text-color); }

/* --- Video Grid & DLE Content Fix --- */
.video-grid,
#dle-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* Уменьшаем минимальную ширину */
    gap: 20px;
}
#dle-content:has(.full-story-page) {
	display: block;
}

/* --- Video Card (shortstory.tpl) --- */
.video-card { background-color: var(--card-bg); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; transition: transform 0.3s ease, box-shadow 0.3s ease; border: 1px solid transparent; }
.video-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.5); border-color: var(--primary-color); }
.video-card__thumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }
.video-card__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.video-card:hover .video-card__thumb img { transform: scale(1.05); }
.video-card__overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s ease; z-index: 2; }
.video-card:hover .video-card__overlay { opacity: 1; }
.video-card__overlay .material-icons { font-size: 64px; color: #fff; }
.video-card__duration { position: absolute; bottom: 8px; right: 8px; background-color: rgba(0, 0, 0, 0.8); color: var(--text-color); padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; z-index: 3; }
.video-card__edit { position: absolute; top: 8px; left: 8px; z-index: 3; }
.video-card__edit a { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; background-color: rgba(229, 9, 20, 0.8); color: #fff; border-radius: 50%; text-decoration: none; transition: background-color 0.3s ease; }
.video-card__edit a:hover { background-color: var(--primary-color); }
.video-card__edit .material-icons { font-size: 18px; }
.video-card__info { padding: 15px; flex-grow: 1; display: flex; flex-direction: column; }
.video-card__title { font-size: 16px; font-weight: 500; line-height: 1.4; margin-bottom: 12px; flex-grow: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.video-card__title a { color: var(--text-color); text-decoration: none; }
.video-card__title a:hover { color: var(--primary-color); }
.video-card__meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-muted); }
.meta-item { display: flex; align-items: center; gap: 5px; }
.meta-item .material-icons { font-size: 16px; }

/* --- Pagination --- */
.pagination { text-align: center; margin: 40px 0; }

.pagination-in {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  flex-wrap: wrap; /* <-- ДОБАВЬТЕ ЭТУ СТРОКУ */
  justify-content: center; /* <-- И ЭТУ ДЛЯ КРАСОТЫ */
}

.pagination-in a, .pagination-in span { display: flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 15px; border: 1px solid var(--border-color); background-color: var(--card-bg); color: var(--text-muted); border-radius: 6px; text-decoration: none; font-weight: 500; transition: all 0.3s ease; }
.pagination-in a:hover { border-color: var(--primary-color); color: var(--text-color); background-color: rgba(229, 9, 20, 0.5); }
.pagination-in span { background-color: var(--primary-color); border-color: var(--primary-color); color: var(--text-color); font-weight: 700; }

/* --- SEO Block & Footer --- */
.seo-block { margin-top: 40px; padding: 25px 30px; background-color: var(--card-bg); border-radius: 8px; line-height: 1.7; border-top: 3px solid var(--primary-color); }
.seo-block .seo-block__title { font-size: 22px; color: var(--text-color); margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.seo-block .section-title { border-left: none; padding-left: 0; }
.seo-block h3 { font-size: 18px; color: var(--text-color); margin-top: 20px; margin-bottom: 8px; }
.seo-block p { color: var(--text-muted); margin-bottom: 15px; }
.seo-block strong { color: var(--text-color); font-weight: 500; }
.footer { background-color: #101010; padding: 20px 0; margin-top: 30px; border-top: 1px solid var(--border-color); }
.footer__inner { display: flex; align-items: center; flex-wrap: wrap; gap: 15px 30px; }
.footer__counter { margin-left: auto; }

/* --- СТИЛИ ДЛЯ FULLSTORY.TPL (ОДНА КОЛОНКА) --- */
.full-story-page { max-width: 1000px; margin: 0 auto; }
.fs-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.fs-header h1 { font-size: 28px; line-height: 1.4; }
.fs-edit a { color: var(--text-muted); margin-top: 5px; }
.fs-edit a:hover { color: var(--primary-color); }

.fs-player-box {
  margin-bottom: 15px;
  border-radius: 8px;
  overflow: hidden;
  /* --- ДОБАВЬТЕ ЭТИ СТРОКИ --- */
  aspect-ratio: 16 / 9;
  width: 100%;
  background-color: #000; /* Черный фон, пока плеер грузится */
}

.fs-meta-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; background-color: var(--card-bg); padding: 10px 15px; border-radius: 8px; margin-bottom: 25px; }
.fs-meta-info { display: flex; flex-wrap: wrap; gap: 10px 20px; color: var(--text-muted); font-size: 14px; }
.fs-rating { display: flex; gap: 5px; }
.rate-btn { display: flex; align-items: center; gap: 6px; background-color: rgba(255,255,255,0.1); border: none; color: var(--text-muted); padding: 8px 12px; border-radius: 20px; cursor: pointer; transition: all 0.3s ease; }
.rate-btn:hover { color: var(--text-color); background-color: rgba(255,255,255,0.2); }
.rate-btn .material-icons { font-size: 18px; }
.fs-box { background-color: var(--card-bg); border-radius: 8px; margin-bottom: 25px; overflow: hidden; }
.fs-box__title { font-size: 20px; padding: 15px; border-bottom: 1px solid var(--border-color); }
.fs-box__content { padding: 15px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

.gallery-grid a {
  display: block;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  aspect-ratio: 16 / 9; /* <-- ДОБАВЬТЕ ЭТУ СТРОКУ */
  background-color: #333; /* <-- И ЭТУ, для красивого плейсхолдера */
}

.gallery-grid img { width: 100%; height: 100%; object-fit: cover; transition: all 0.3s ease; }
.gallery-grid a:hover img { transform: scale(1.05); opacity: 0.8; }
.fs-tags-item { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.fs-tags-item:last-child { margin-bottom: 0; }
.fs-tags-item b { color: var(--text-color); flex-shrink: 0; }
.fs-tags-wrapper { display: flex; flex-wrap: wrap; gap: 5px; }
.fs-tags-wrapper a { display: inline-block; background-color: var(--dark-bg); color: var(--text-muted); padding: 5px 10px; border-radius: 4px; text-decoration: none; transition: all 0.3s ease; }
.fs-tags-wrapper a:hover { background-color: var(--primary-color); color: var(--text-color); }
.fs-divider { border: none; height: 1px; background-color: var(--border-color); margin: 20px 0; }
.full-text { line-height: 1.7; color: var(--text-muted); }
.fs-download-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-download { display: inline-flex; align-items: center; gap: 10px; background-color: var(--primary-color); color: var(--text-color); padding: 12px 20px; border-radius: 6px; text-decoration: none; font-weight: 500; transition: background-color 0.3s ease; }
.btn-download:hover { background-color: #b80710; }
.btn-download.btn-orange { background-color: #ff9900; }
.btn-download.btn-orange:hover { background-color: #e68a00; }

/* --- ФИНАЛЬНЫЕ СТИЛИ ДЛЯ ВЫПАДАЮЩЕГО МЕНЮ РЕДАКТИРОВАНИЯ --- */
#dropmenuiv {
	background-color: #2a2a2a !important;
	border: 1px solid #444 !important;
	box-shadow: 0 5px 15px rgba(0,0,0,0.5) !important;
	border-radius: 6px !important;
	padding: 5px !important;
}
#dropmenuiv > div {
	padding: 0 !important;
}
#dropmenuiv a, #dropmenuiv a:link, #dropmenuiv a:visited {
	color: #ccc !important;
	font-size: 14px !important;
	font-weight: normal !important;
	padding: 8px 12px !important;
	border-radius: 4px;
	display: block !important;
	transition: all 0.2s ease !important;
	text-decoration: none !important;
}
#dropmenuiv a:hover {
	background-color: var(--primary-color) !important;
	color: #fff !important;
}
#dropmenuiv .dle_menu_separator {
	border-top: 1px solid #444 !important;
	margin: 5px !important;
	height: 1px !important;
	padding: 0 !important;
}

/* --- Responsiveness (Media Queries) --- */
@media (max-width: 992px) {
	.header__menu { display: none; }
	.header__mobile-btn { display: block; order: 3; }
	.header__search { margin-left: auto; }
}
@media (max-width: 768px) {
	.video-grid, #dle-content, .category-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
	.header__search input { min-width: auto; width: 100%; }
	.header__logo { font-size: 22px; }
	.fs-header h1 { font-size: 22px; }
}
@media (max-width: 480px) {
	.video-grid, #dle-content, .category-list { grid-template-columns: 1fr; }
	.footer__inner { flex-direction: column; text-align: center; }
	.footer__counter { margin-left: 0; }
}

/* ВСТАВЬТЕ КОД СЮДА */
.top-videos {
  margin-top: 40px;
}



/* --- Fix for LiveInternet Counter CLS --- */
.footer__counter {
  min-width: 88px;
  min-height: 31px;
}

/* Fix CLS for video cards with critical CSS */
.video-card { display: flex; flex-direction: column; }
.video-card__thumb { position: relative; aspect-ratio: 16 / 9; }
.video-card__thumb img { width: 100%; height: 100%; object-fit: cover; }



/* Отступ для страницы поиска */
.search-page-header {
  margin-bottom: 30px;
}


/* --- Quick Search Results --- */
#quick_search_results {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  margin-top: 5px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  z-index: 101;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
  overflow: hidden;
  display: none; /* Скрипт сам сделает его видимым */
}

#quick_search_results .qs_item {
  padding: 10px 15px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  transition: all 0.3s ease;
}

#quick_search_results .qs_item:last-child {
  border-bottom: none;
}

#quick_search_results .qs_item:hover {
  background-color: var(--primary-color);
  color: var(--text-color);
  cursor: pointer;
}

/* --- Site Search Block Styles (Corrected) --- */
.site-search-wrapper {
  margin-bottom: 30px;
  padding: 20px;
  background-color: var(--card-bg);
  border-radius: 8px;
}

.site-search-wrapper table {
  width: 100%;
}

.site-search-wrapper .search {
  width: 100%;
  padding: 10px 15px;
  background: var(--dark-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: 6px;
  margin-bottom: 10px;
}

.site-search-wrapper .button {
  padding: 10px 15px;
  border: none;
  background-color: var(--primary-color);
  color: var(--text-color);
  border-radius: 6px;
  cursor: pointer;
  margin-right: 5px;
}

.site-search-wrapper .search_info {
  color: var(--text-muted);
  margin-top: 15px;
  border-top: 1px solid var(--border-color);
  padding-top: 15px;
}

/* Исправляем отображение иконки для кнопки Вверх */
.mat-icon {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
}

/* Оформляем саму кнопку Вверх */
#gotop {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #e50914; /* Красный цвет под твой логотип */
    color: #ffffff;
    width: 45px;
    height: 45px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

#gotop:hover {
    opacity: 1;
}