*,
*::before,
*::after { box-sizing: border-box; }

:root{
  --bg: radial-gradient(circle at top, #141b2b 0, #050609 45%, #010203 100%);
  --panel: #25232e;
  --panel2: #312f3b;
  --border: #343246;
  --header: #191820;
  --text: #f5f5f5;
  --muted: rgba(255,255,255,.75);
  --blue: #4b8dff;
  --danger: #ff2d55;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* -------------------- HEADER (SITE) -------------------- */
.site-header {
  background: var(--header);
  border-bottom: 1px solid #282633;
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.site-logo {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.04em;
}
.site-logo span { color: #119b1d; }
.site-nav { display: flex; align-items: center; gap: 10px; }

/* -------------------- HEADER (ADMIN) -------------------- */
.admin-body{
  background: radial-gradient(circle at top, #121624 0, #050609 48%, #020308 100%);
  color: var(--text);
}
.admin-header{
  background: var(--header);
  border-bottom: 1px solid #282633;
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  height:64px;
}
.admin-logo{
  font-weight:900;
  font-size:20px;
}
.admin-logo span{ color: var(--blue); }
.admin-nav{ display:flex; align-items:center; gap:10px; }
.admin-nav-link{
  font-size:14px;
  opacity:.85;
}
.admin-nav-link:hover{ opacity:1; }
.admin-main{ padding-top:24px; padding-bottom:40px; }

/* -------------------- BUTTONS -------------------- */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  border:1px solid transparent;
  padding:8px 16px;
  font-size:14px;
  cursor:pointer;
  background:transparent;
  color:inherit;
  transition:.18s ease;
  white-space:nowrap;
}
.btn-sm{ padding:6px 12px; font-size:13px; }
.btn-xs{ padding:4px 10px; font-size:12px; }

.btn-primary{
  background: linear-gradient(135deg, #4361ee, #4cc9f0);
  border-color: rgba(76, 201, 240, 0.4);
  color:#fff;
  box-shadow: 0 0 18px rgba(67, 97, 238, 0.35);
}
.btn-primary:hover{ transform: translateY(-1px); }

.btn-outline{
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.03);
}
.btn-outline:hover{ background: rgba(255,255,255,0.07); }

.btn-ghost{
  border-color: transparent;
  background: rgba(255,255,255,0.03);
}
.btn-ghost:hover{ background: rgba(255,255,255,0.07); }

.btn-danger{
  border-color: rgba(255, 45, 85, 0.55);
  background: rgba(255, 45, 85, 0.10);
  color:#ff94ad;
}
.btn-danger:hover{ background: rgba(255, 45, 85, 0.18); }

/* -------------------- FORMS -------------------- */
.form-input,
.form-textarea{
  width:100%;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.14);
  background: rgba(4, 8, 16, 0.9);
  color: var(--text);
  padding:8px 10px;
  font-size:14px;
  outline:none;
  transition:.16s ease;
}
.form-input:focus,
.form-textarea:focus{
  border-color: rgba(76, 201, 240, 0.75);
  box-shadow: 0 0 0 1px rgba(76, 201, 240, 0.45);
  background: rgba(7, 11, 20, 0.98);
}
.form-textarea{ resize: vertical; min-height: 80px; }

.form-group{ display:flex; flex-direction:column; gap:6px; }
.form-label{ font-size:13px; opacity:.85; }

.form-actions{
  margin-top:18px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

/* -------------------- ALERTS -------------------- */
.alert{
  border-radius:10px;
  padding:10px 12px;
  font-size:13px;
  margin-bottom:12px;
}
.alert-error{
  border:1px solid rgba(255, 99, 132, 0.7);
  background: rgba(255, 99, 132, 0.1);
  color:#ff99aa;
}

/* -------------------- ADMIN CARDS / TABLE -------------------- */
.admin-card{
  background: var(--panel);
  border:1px solid var(--border);
  border-radius:18px;
  box-shadow: 0 14px 45px rgba(0,0,0,0.65);
  padding:20px;
  margin-bottom:24px;
}
.admin-card-header{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.admin-title{
  margin:0;
  font-size:22px;
  font-weight:900;
}
.admin-subtitle{
  margin:0;
  font-size:13px;
  opacity:.75;
}

.admin-table-wrapper{ overflow-x:auto; }
.admin-table{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
}
.admin-table th,
.admin-table td{
  padding:10px 8px;
  border-bottom:1px solid rgba(255,255,255,0.06);
  text-align:left;
  vertical-align:middle;
}
.admin-table th{
  font-size:13px;
  opacity:.75;
  font-weight:700;
}
.admin-table tr:hover td{ background: rgba(255,255,255,0.02); }
.admin-table tr:last-child td{ border-bottom:none; }

.admin-actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.admin-empty{
  text-align:center;
  padding:18px 0;
  opacity:.75;
}

/* -------------------- ADMIN FORM GRID -------------------- */
.form-card{ max-width:1100px; margin:0 auto; }
.admin-form{ margin-top:12px; }

.form-grid{
  display:grid;
  gap:18px;
}
@media (min-width: 900px){
  .form-grid{ grid-template-columns: 1.2fr 1fr; }
}
.form-column{ display:flex; flex-direction:column; gap:14px; }
.form-row{ display:grid; gap:12px; }
@media (min-width: 680px){
  .form-row{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* -------------------- LOGIN -------------------- */
.login-body{ background: var(--bg); color: var(--text); }
.login-page{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px 16px;
}
.login-box{
  background: var(--panel);
  border:1px solid var(--border);
  border-radius:18px;
  box-shadow: 0 20px 55px rgba(0,0,0,0.75);
  width: 360px;
  padding: 26px 24px 22px;
}
.login-logo{
  font-weight:900;
  font-size:20px;
  text-align:center;
}
.login-logo span{ color: var(--blue); }
.login-title{
  margin: 10px 0 18px;
  text-align:center;
  font-size: 18px;
  font-weight: 800;
  opacity:.95;
}

/* -------------------- ICON BUTTONS + FAV COUNT -------------------- */
.icon-btn{
  position:relative;
  background: rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.10);
  color:#fff;
  border-radius:12px;
  padding:8px 10px;
  cursor:pointer;
  transition:.18s ease;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:40px;
}
.icon-btn:hover{ background: rgba(255,255,255,0.10); transform: translateY(-1px); }
.icon{ font-size:16px; }

.fav-count{
  position:absolute;
  top:-6px;
  right:-6px;
  display:none;
  min-width:18px;
  height:18px;
  padding:0 5px;
  border-radius:999px;
  background: var(--danger);
  color:#fff;
  font-size:11px;
  font-weight:900;
  align-items:center;
  justify-content:center;
  box-shadow: 0 6px 16px rgba(0,0,0,.55);
}

/* -------------------- MODAL SEARCH -------------------- */
.modal{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,0.55);
  display:none;
  align-items:flex-start;
  justify-content:center;
  padding:90px 16px 16px;
  z-index:1000;
}
.modal.is-open{ display:flex; }
.modal-lock{ overflow:hidden; }

.modal-card{
  width: min(720px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.85);
  padding: 16px;
}
.modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:12px;
}
.modal-title{ font-weight:900; font-size:16px; opacity:.95; }
.modal-form{
  display:grid;
  grid-template-columns: 1fr auto;
  gap:10px;
}
.modal-input{ height:42px; }
.modal-hint{ margin-top:10px; font-size:12px; opacity:.7; }

/* -------------------- CATALOG -------------------- */
.catalog-wrapper{ padding-top:24px; padding-bottom:40px; }
.block{ margin-bottom:26px; }
.block-title{ margin:0 0 14px; font-size:18px; font-weight:900; }
.empty{ opacity:.75; padding:12px 0; }

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

.card{
  background: var(--panel);
  border:1px solid var(--border);
  border-radius:18px;
  overflow:hidden;
  cursor:pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.card:hover{
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(0,0,0,0.8);
}

.poster-wrap{ position:relative; }

.card img{
  width:100%;
  height:250px;
  object-fit:cover;
  display:block;
}
.card-noimg{
  height:250px;
  display:flex;
  align-items:center;
  justify-content:center;
  opacity:.65;
  border-bottom:1px solid rgba(255,255,255,0.06);
}

.card-title{
  padding:10px 12px 12px;
  font-size:15px;
  margin:0;
  text-align:center;
  font-weight:800;
}

/* 18+ badge on poster */
.age-badge-poster{
  position:absolute;
  top:8px;
  left:8px;
  background: rgba(220, 38, 38, 0.95);
  color:#fff;
  font-weight:900;
  font-size:12px;
  padding:4px 8px;
  border-radius:8px;
  z-index:5;
  box-shadow: 0 4px 12px rgba(0,0,0,.6);
}

/* -------------------- SERIES PAGE -------------------- */
.series-page{ padding-top:30px; padding-bottom:40px; }

.series-hero-card{
  display:grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap:24px;
  background: var(--panel);
  border-radius:18px;
  border:1px solid var(--border);
  padding:20px;
  box-shadow: 0 18px 45px rgba(0,0,0,0.7);
  position:relative;
}
@media (max-width:860px){
  .series-hero-card{ grid-template-columns: minmax(0, 1fr); }
}

.series-hero-left{ display:flex; flex-direction:column; gap:14px; }

.series-hero-poster{
  width:100%;
  border-radius:12px;
  display:block;
  box-shadow: 0 16px 40px rgba(0,0,0,0.9);
  object-fit:cover;
}

.series-poster-placeholder{
  width:100%;
  height:340px;
  border-radius:12px;
  border:1px dashed rgba(255,255,255,0.3);
  display:flex;
  align-items:center;
  justify-content:center;
  opacity:.6;
  font-size:13px;
}

.series-ratings{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:stretch;
}
.rating-chip{
  background: var(--panel2);
  border-radius:10px;
  padding:8px 10px;
  min-width:110px;
}
.rating-chip-label{ font-size:11px; opacity:0.75; }
.rating-chip-value{ font-size:18px; font-weight:900; margin-top:2px; }

/* IMDb chip прижат к правой границе */
.imdb-chip{ margin-left:auto; }

.series-hero-right{
  position:relative;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.series-fav-btn{
  position:absolute;
  top:0;
  right:0;
  border:1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  width:42px;
  height:42px;
  border-radius:14px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transition:.18s ease;
  font-size:18px;
}
.series-fav-btn:hover{ background: rgba(255,255,255,0.12); transform: translateY(-1px); }
.series-fav-btn.is-active{
  background: rgba(255, 45, 85, 0.18);
  border-color: rgba(255, 45, 85, 0.35);
}

.series-title{
  margin:0;
  font-size:28px;
  font-weight:900;
  padding-right:52px; /* место под сердце */
}

.series-meta-block{ display:flex; flex-direction:column; gap:6px; }
.series-meta-row{ display:flex; align-items:center; gap:8px; opacity:0.95; }
.series-meta-icon{ width:18px; text-align:center; opacity:0.9; }

.series-age-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:2px 8px;
  border-radius:999px;
  background: rgba(255, 71, 87, 0.16);
  border: 1px solid rgba(255, 71, 87, 0.7);
  font-size:12px;
  color:#ff7675;
}

.series-meta-strong{ font-size:16px; font-weight:800; }
.series-desc-strong{ font-size:16px; font-weight:700; line-height:1.8; opacity:0.98; }

/* -------------------- PLAYER + 18+ OVERLAY -------------------- */
.series-player-section{ margin-top:24px; }

.series-player{
  background: var(--panel);
  border:1px solid var(--border);
  border-radius:18px;
  padding:16px 16px 18px;
}
.series-player .card-title{
  text-align:center;
  margin:0;
  font-weight:900;
  padding:0;
}

.series-player-sources{
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
  margin-top:12px;
}

.player-source-btn{
  min-width:110px;
}

.player-source-btn.is-active{
  background: linear-gradient(135deg, #4361ee, #4cc9f0);
  border-color: rgba(76, 201, 240, 0.40);
  color:#fff;
  box-shadow: 0 0 18px rgba(67, 97, 238, 0.25);
}

.series-player-empty{
  padding: 28px 14px;
  text-align:center;
  color: var(--muted);
}

.series-player-wrapper{
  position:relative;
  margin-top:10px;
  border-radius:16px;
  overflow:hidden;
  box-shadow: 0 18px 45px rgba(0,0,0,0.9);
  background:#000;
}
.series-player-iframe{
  width:100%;
  min-height:360px;
  border:none;
  display:block;
}
@media (min-width:900px){
  .series-player-iframe{ min-height:430px; }
}

.series-player.has-age-overlay .series-player-iframe{
  filter: blur(4px) brightness(0.5);
  pointer-events:none;
}

.age-overlay{
  position:absolute;
  inset:0;
  background: radial-gradient(circle at top, rgba(10, 10, 20, 0.8), rgba(0, 0, 0, 0.96));
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:5;
}

.age-overlay-inner{
  text-align:center;
  max-width:360px;
  padding:24px 20px 20px;
  border-radius:16px;
  background: rgba(10, 10, 20, 0.96);
  border:1px solid rgba(255,255,255,0.12);
  box-shadow: 0 18px 55px rgba(0,0,0,0.9);
}

.age-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:44px;
  height:44px;
  border-radius:999px;
  border:2px solid rgba(255, 71, 87, 0.9);
  color:#ff7675;
  font-weight:900;
  margin-bottom:10px;
}

.age-overlay-inner p{ margin:0 0 8px; font-size:14px; }
.age-text-small{ font-size:12px; opacity:0.75; margin-bottom:14px; }

.age-overlay-hidden{
  opacity:0;
  pointer-events:none;
  transition: opacity 0.25s ease;
}

/* =====================================================
   ДОБАВЛЕНО: SKELETON LOADER (не конфликтует с твоим CSS)
   Используется, если ты добавишь блоки .skeleton-content/.real-content
===================================================== */

/* Чтобы обёртки не ломали grid: дети становятся элементами grid */
.real-content,
.skeleton-content{
  display: contents;
}

/* Пока идёт "загрузка" — показываем skeleton, прячем контент */
.is-loading .real-content{ display:none; }
.is-loading .skeleton-content{ display: contents; }

/* Если не loading — skeleton скрыт */
.skeleton-content{ display:none; }

/* Skeleton blocks */
.skeleton{
  background: rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}
.skeleton::after{
  content:"";
  position:absolute;
  inset:0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.12),
    transparent
  );
  animation: skeleton-shimmer 1.2s infinite;
}
@keyframes skeleton-shimmer{
  100%{ transform: translateX(100%); }
}

/* Skeleton card helpers */
.skeleton-card{
  cursor: default;
}
.skeleton-card:hover{
  transform: none;
  box-shadow: none;
}
.skeleton-poster{ height:250px; border-radius: 0; }
.skeleton-title{
  height: 16px;
  margin: 12px;
  border-radius: 8px;
}

/* ===================== FILTERS TOGGLE ===================== */
.filters-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.filters-title{
  font-weight:900;
  font-size:16px;
  opacity:.95;
}
.filters-panel{
  display:none;
}
.filters-panel.is-open{
  display:block;
}

/* ===================== BLOCK HEAD (title + button) ===================== */
.block-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}
.block-sub{
  font-size:12px;
  opacity:.75;
}

/* ===================== PAGINATION ===================== */
.pagination{
  margin-top:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
}
.page-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:38px;
  height:38px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.03);
  font-weight:800;
}
.page-btn:hover{ background: rgba(255,255,255,0.07); }
.page-btn.is-active{
  background: linear-gradient(135deg, #4361ee, #4cc9f0);
  border-color: rgba(76, 201, 240, 0.4);
  color:#fff;
}
.page-btn.is-disabled{
  opacity:.35;
  pointer-events:none;
}
.page-dots{ opacity:.6; padding:0 4px; }

/* ===================== RATING COLORS ===================== */
.rating-chip-value.is-low{ color:#ff6b6b; }
.rating-chip-value.is-high{ color:#57f287; }

/* ===================== ADMIN SIDEBAR ===================== */
.admin-layout{
  display:flex;
  min-height:100vh;
}

.admin-sidebar{
  width:260px;
  background: var(--header);
  border-right: 1px solid #282633;
  position:sticky;
  top:0;
  align-self:flex-start;
  height:100vh;
  padding:14px 12px;
  transition: width .2s ease;
  z-index:60;
}

.admin-sidebar.is-collapsed{ width:78px; }

.admin-sidebar-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:6px 6px 12px;
}

.admin-burger{ min-width:40px; }

.admin-side-nav{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:6px;
}

.admin-side-link{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-sidebar-head .js-admin-sidebar-toggle{ display:none; }


.admin-side-link{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  font-weight:800;
  font-size:14px;
  opacity:.92;
}
.admin-side-link:hover{ background: rgba(255,255,255,0.07); opacity:1; }
.admin-side-link.is-active{
  background: linear-gradient(135deg, rgba(67,97,238,.35), rgba(76,201,240,.18));
  border-color: rgba(76,201,240,0.35);
}

.admin-sidebar.is-collapsed .admin-side-link{
  justify-content:center;
  gap:0;
  font-size:18px;
}
.admin-sidebar.is-collapsed .admin-side-link{ padding:10px; }
.admin-sidebar.is-collapsed .admin-side-link::after{ content:""; }

/* content */
.admin-content{ flex:1; min-width:0; }

/* ===================== FAVORITES / CATALOG FULL HEIGHT ===================== */
.catalog-wrapper{
  min-height: calc(100vh - 64px);
}

@media (max-width: 900px){
  .admin-sidebar{
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-110%);
    transition: transform .2s ease;
    width: 260px;
  }
  .admin-sidebar.is-open{ transform: translateX(0); }

  /* на мобилке не используем "сжатие" */
  .admin-sidebar.is-collapsed{ width: 260px; }
}
