@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600;800;900&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-color: #060711;
  --card-bg: rgba(18, 22, 41, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --accent-color: #8a2be2;
  --accent-glow: #b026ff;
  --accent-cyan: #00f0ff;
  --text-main: #f1f1f7;
  --text-muted: #8e94a5;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(138, 43, 226, 0.15) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(0, 240, 255, 0.1) 0%, transparent 45%);
  background-attachment: fixed;
}

/* Header UI */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 8%;
  background: rgba(6, 7, 17, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo span {
  color: var(--accent-cyan);
  text-shadow: 0 0 15px rgba(0, 240, 255, 0.6);
}

.logo-icon {
  font-size: 1.7rem;
  filter: drop-shadow(0 0 10px var(--accent-glow));
}

/* Search + Filters wrapper */
.search-and-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.5rem 1rem;
  transition: all 0.3s ease;
  width: 280px;
}

.search-bar:focus-within {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
  width: 320px;
}

.search-bar svg { stroke: var(--text-muted); }
.search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  width: 100%;
  font-size: 0.9rem;
}

/* Filter Dropdown Toggle Button */
.filter-dropdown-wrapper {
  position: relative;
}

.filter-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 0.55rem 1.1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-toggle-btn:hover, .filter-toggle-btn.active {
  background: rgba(138, 43, 226, 0.3);
  border-color: var(--accent-glow);
  box-shadow: 0 0 15px rgba(176, 38, 255, 0.3);
}

.filter-toggle-btn svg { stroke: var(--accent-cyan); }

/* Filter Popover Window */
.filter-popover {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 340px;
  background: rgba(15, 18, 37, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 1.2rem;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7), 0 0 20px rgba(138, 43, 226, 0.2);
  display: none;
  flex-direction: column;
  gap: 1.2rem;
  z-index: 200;
}

.filter-popover.show {
  display: flex;
}

.popover-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  font-weight: 700;
}

.popover-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover, .filter-chip.active {
  background: var(--accent-color);
  border-color: var(--accent-glow);
  box-shadow: 0 0 10px rgba(176, 38, 255, 0.4);
}

/* Container & Grid */
.main-container { padding: 2.5rem 8%; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 2rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-8px);
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 240, 255, 0.2);
}

.card-poster {
  position: relative;
  width: 100%;
  height: 300px;
  overflow: hidden;
}

.card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card:hover .card-poster img { transform: scale(1.08); }

.rating-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(6, 7, 17, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffc107;
}

.card-body {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Modal Window */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: #0f1225;
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  box-shadow: 0 0 40px rgba(138, 43, 226, 0.3);
  display: flex;
  gap: 2rem;
}

.modal-close {
  position: absolute;
  top: 15px; right: 20px;
  background: none; border: none;
  color: var(--text-muted); font-size: 1.8rem;
  cursor: pointer; transition: 0.2s;
}
.modal-close:hover { color: #fff; }

.modal-poster img {
  width: 220px;
  border-radius: 16px;
  object-fit: cover;
}

.modal-info h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.modal-synopsis {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 1rem 0;
}

/* Дополнительные стили для модалки и деталей */
.modal-orig-title {
  font-size: 0.9rem;
  color: var(--accent-cyan);
  margin-bottom: 1.2rem;
  opacity: 0.8;
}

.modal-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 20px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 1rem;
  border-radius: 14px;
  margin-bottom: 1.2rem;
  font-size: 0.88rem;
}

.detail-item {
  color: var(--text-main);
}

.detail-label {
  color: var(--text-muted);
  font-weight: 500;
}

/* Кнопка Загрузить Ещё */
.load-more-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 3.5rem;
}

.load-more-btn {
  background: var(--card-bg);
  border: 1px solid var(--accent-glow);
  color: var(--text-main);
  padding: 0.9rem 2.5rem;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(176, 38, 255, 0.2);
}

.load-more-btn:hover {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-glow));
  box-shadow: 0 0 25px rgba(176, 38, 255, 0.5);
  transform: translateY(-3px);
}

/* Красный Cyberpunk / UIX Плеер */
.player-container-red {
  background: rgba(15, 15, 22, 0.85);
  border: 1px solid rgba(255, 0, 85, 0.3);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 0 35px rgba(255, 0, 85, 0.15);
  backdrop-filter: blur(16px);
  margin-top: 20px;
}

.player-controls-bar {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.selector-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.selector-group label {
  color: #ff0055;
  font-weight: 600;
  font-size: 0.9rem;
}

.selector-group select {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 0, 85, 0.4);
  color: #fff;
  padding: 8px 16px;
  border-radius: 10px;
  outline: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

.selector-group select:focus {
  border-color: #ff0055;
  box-shadow: 0 0 12px rgba(255, 0, 85, 0.5);
}

.video-screen-wrapper {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#cyberPlayer {
  width: 100%;
  max-height: 520px;
  display: block;
  outline: none;
}

/* Сетка серий */
.episodes-bar {
  margin-top: 20px;
}

.episodes-title {
  color: #fff;
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 5px;
}

.ep-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #ccc;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ep-btn:hover {
  background: rgba(255, 0, 85, 0.15);
  border-color: rgba(255, 0, 85, 0.5);
  color: #fff;
}

.ep-btn.active {
  background: linear-gradient(135deg, #ff0055, #b3003b);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
}

.no-ep {
  color: #888;
  font-size: 0.9rem;


/* P2P WebTorrent Overlay */
.video-screen-wrapper {
  position: relative;
}

.p2p-status-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 10, 15, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  gap: 15px;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 0, 85, 0.2);
  border-top-color: #ff0055;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}