﻿:root {
  --radius: 1rem;
  --shadow: 0 14px 40px rgba(15, 23, 42, 0.14);
  --ease: 240ms ease;

  --bg-main: linear-gradient(135deg, #f8fafc, #f1f5f9 35%, #e0f2fe 100%);
  --bg-fx-a: radial-gradient(circle at 15% 15%, rgba(251, 146, 60, 0.35), transparent 35%);
  --bg-fx-b: radial-gradient(circle at 85% 10%, rgba(14, 165, 233, 0.25), transparent 40%);
  --shell: rgba(255, 255, 255, 0.72);
  --shell-border: rgba(15, 23, 42, 0.12);
  --text: #0f172a;
  --muted: #334155;
  --field-bg: rgba(255, 255, 255, 0.8);
  --field-border: rgba(30, 41, 59, 0.2);
  --active: #0369a1;
  --active-2: #d946ef;
  --card-bg: rgba(255, 255, 255, 0.86);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: Poppins, 'Segoe UI', Tahoma, sans-serif;
  transition: color var(--ease), background var(--ease);
}

.app-bg {
  background-image: var(--bg-fx-a), var(--bg-fx-b), var(--bg-main);
  min-height: 100vh;
}

.shell {
  border: 1px solid var(--shell-border);
  background: var(--shell);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

header.shell {
  position: relative;
  z-index: 220;
}

main {
  position: relative;
  z-index: 10;
}

.eyebrow {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--active);
}

.hero-title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.04;
  font-weight: 700;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 0.75rem;
  object-fit: cover;
  border: 1px solid var(--shell-border);
}

.hero-tagline {
  margin: 0.4rem 0 0;
  font-size: clamp(0.95rem, 2.2vw, 1.1rem);
  color: color-mix(in srgb, var(--active) 78%, #0f172a 22%);
  letter-spacing: 0.01em;
}

.tab-btn,
.control-btn,
.action-btn,
.linkish {
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.78rem;
  transition: transform var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.control-btn.is-favorite,
.action-btn.is-favorite {
  border-color: color-mix(in srgb, #16a34a 70%, transparent);
  color: #166534;
  background: color-mix(in srgb, #dcfce7 68%, white 32%);
}

.bi {
  font-size: 0.9em;
}

.tab-btn:hover,
.tab-btn.active,
.control-btn:hover,
.action-btn:hover,
.linkish:hover {
  border-color: color-mix(in srgb, var(--active) 70%, transparent);
  color: var(--active);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--active-2) 35%, transparent) inset;
  transform: translateY(-1px);
}

.control-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.tab-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.field {
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text);
  border-radius: 0.8rem;
  padding: 0.62rem 0.86rem;
  font-size: 0.9rem;
  line-height: 1.2;
  outline: none;
}

.field:focus {
  border-color: var(--active);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--active) 20%, transparent);
}

.loading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 0.6rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
}

.loading-overlay {
  position: absolute;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  border: 1px solid var(--shell-border);
  background: color-mix(in srgb, var(--shell) 92%, white 8%);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  min-width: min(90vw, 320px);
  text-align: center;
  pointer-events: none;
}

section {
  position: relative;
}

.spinner {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 999px;
  border: 3px solid color-mix(in srgb, var(--active) 25%, white);
  border-top-color: var(--active);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.ts-wrapper.single .ts-control {
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--text);
  border-radius: 0.8rem;
  min-height: 42px;
  padding: 0.42rem 0.72rem;
  font-size: 0.9rem;
  box-shadow: none;
}

.ts-wrapper {
  position: relative;
  display: block;
  width: 100%;
}

/* Remove extra outer box that TomSelect inherits from .field on wrapper */
.ts-wrapper.field,
.field.ts-wrapper {
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.ts-wrapper.single .ts-control input {
  color: var(--text);
}

.ts-dropdown {
  border: 1px solid var(--field-border);
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  border-radius: 0.75rem;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 9999;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.22);
  backdrop-filter: none;
}

.filter-select-wrapper .ts-control {
  min-height: 44px !important;
  display: flex !important;
  align-items: center !important;
}

.filter-select-wrapper .ts-dropdown {
  margin-top: 0;
}

.filter-select-wrapper .ts-dropdown .option {
  padding: 0.45rem 0.7rem;
}

.ts-dropdown .dropdown-input-wrap {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.98);
  padding: 0.45rem;
  border-bottom: 1px solid var(--field-border);
}

.ts-dropdown .dropdown-input {
  width: 100%;
  border: 1px solid var(--field-border);
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  border-radius: 0.55rem;
  padding: 0.42rem 0.55rem;
  outline: none;
}

.ts-dropdown .option {
  background: rgba(255, 255, 255, 0.98);
  color: #0f172a;
}

.ts-dropdown .active,
.ts-dropdown .option.active {
  background: rgba(219, 234, 254, 0.92);
  color: #0b3b66;
}

/* Custom Video.js Theme */
.video-js {
  border-radius: 0.75rem;
  overflow: hidden;
  background-color: #000;
}

.video-js .vjs-control-bar {
  background: linear-gradient(to top, rgba(15, 23, 42, 0.9), transparent);
  height: 4em;
  padding: 0 0.5em;
}

/* Move buttons to the right in live mode */
.vjs-live .vjs-control-bar {
  display: flex !important;
}

.vjs-live .vjs-volume-panel {
  margin-right: auto; /* Pushes everything after volume to the right */
}

.video-js .vjs-big-play-button {
  background-color: rgba(3, 105, 161, 0.8);
  border-radius: 50%;
  width: 2em;
  height: 2em;
  line-height: 2em;
  margin-top: -1em;
  margin-left: -1em;
  border: none;
}

.video-js:hover .vjs-big-play-button {
  background-color: var(--active);
  transform: scale(1.1);
}

.video-js .vjs-play-control,
.video-js .vjs-fullscreen-control,
.video-js .vjs-picture-in-picture-toggle,
.video-js .vjs-volume-panel {
  color: #f8fafc;
}

.video-js .vjs-play-control:hover,
.video-js .vjs-fullscreen-control:hover,
.video-js .vjs-picture-in-picture-toggle:hover {
  color: var(--active);
}

.video-js .vjs-slider {
  background-color: rgba(255, 255, 255, 0.2);
}

.video-js .vjs-volume-level,
.video-js .vjs-play-progress {
  background-color: var(--active);
}

.vjs-live .vjs-progress-control,
.vjs-live .vjs-time-control,
.vjs-live .vjs-duration,
.vjs-live .vjs-current-time,
.vjs-live .vjs-remaining-time,
.vjs-live .vjs-seek-to-live-control,
.vjs-live .vjs-playback-rate {
  display: none !important;
}

.video-js.vjs-live .vjs-progress-control {
  visibility: hidden !important;
}

.card {
  border: 1px solid var(--shell-border);
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  transform: translateY(8px);
  opacity: 0;
  animation: card-in 420ms ease forwards;
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
  display: flex;
  flex-direction: column;
  min-height: 340px;
}

.clickable-card {
  cursor: pointer;
}

.clickable-card:hover {
  transform: translateY(-4px) !important;
  border-color: var(--active);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
  z-index: 50;
}

.clickable-card:active {
  transform: translateY(-2px) scale(0.98) !important;
}

.clickable-card:hover .play-btn {
  background: var(--active);
  color: white;
  border-color: var(--active);
}

@keyframes card-in {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.status-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  z-index: 5;
}

.status-badge.online {
  background: rgba(22, 163, 74, 0.85);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-badge.offline {
  background: rgba(220, 38, 38, 0.85);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-badge.unknown {
  background: rgba(30, 41, 59, 0.7);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.pulse {
  width: 6px;
  height: 6px;
  background-color: #4ade80;
  border-radius: 50%;
  display: inline-block;
  animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
  0% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(74, 222, 128, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0);
  }
}

.playing-overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 105, 161, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  z-index: 10;
  pointer-events: none;
}

.playing-overlay .bi {
  font-size: 1.8rem;
  margin-bottom: 0.2rem;
  animation: wave 1.2s ease-in-out infinite;
}

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.7); }
}

.is-playing {
  border-color: var(--active) !important;
  box-shadow: 0 0 0 2px var(--active);
}

.is-playing .play-btn {
  background: var(--active) !important;
  color: white !important;
}

.player-brand-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2147483647; /* Use max z-index for fullscreen */
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.3s ease, transform 0.2s ease, background 0.2s ease;
}

.player-brand-overlay:hover {
  opacity: 1;
  transform: scale(1.05);
  background: rgba(15, 23, 42, 0.8);
}

.player-brand-logo {
  width: 22px;
  height: 22px;
  border-radius: 4px;
}

.player-brand-name {
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Skeleton Loading */
.skeleton-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--shell-border);
  overflow: hidden;
  height: 280px;
}

.skeleton-media {
  height: 160px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-text {
  height: 14px;
  background: #e2e8f0;
  margin: 12px;
  border-radius: 4px;
  width: 70%;
}

.skeleton-text.short {
  width: 40%;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Fix for favicon console spam - hiding broken images until handled */
img.card-media[src^="https://www.google.com/s2/favicons"]:not([src*="sz=128"]) {
  display: none;
}

.player-card.sticky {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: min(340px, 90vw);
  z-index: 1000;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
  animation: sticky-in 0.3s ease-out;
  border: 1px solid var(--active);
}

@keyframes sticky-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.player-card.sticky #playerTitle {
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-card.sticky .player-actions {
  display: none;
}

.player-card.sticky .player-brand-overlay {
  transform: scale(0.7);
  top: 4px;
  left: 4px;
}

.kbd {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  box-shadow: 0 2px 0 #cbd5e1;
  color: #334155;
  display: inline-block;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  padding: 4px 8px;
  min-width: 24px;
  text-align: center;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0.5rem;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--ease), color var(--ease), opacity var(--ease), background var(--ease);
  border-radius: 0.75rem;
  width: 40px;
  height: 40px;
}

.icon-btn:hover {
  color: var(--active);
  transform: translateY(-2px);
  background: rgba(3, 105, 161, 0.08);
}

.icon-btn.is-favorite {
  color: #ef4444;
}

.icon-btn.is-favorite:hover {
  background: rgba(239, 68, 68, 0.08);
}

.card-media {
  width: 100%;
  height: 160px;
  object-fit: contain;
  object-position: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 58, 138, 0.85));
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
  position: relative;
}

.card-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent);
  pointer-events: none;
}

.clickable-card:hover .card-media {
  transform: scale(1.08);
}

.page-jump-input {
  width: 82px;
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
  text-align: center;
  height: 38px;
}

.pagination-bar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pagination-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--shell-border);
}

.pagination-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pagination-group {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.4);
  padding: 2px;
  border-radius: 999px;
  border: 1px solid var(--field-border);
}

.pagination-group .control-btn {
  border: none;
  background: transparent;
}

.pagination-group .control-btn:hover:not(:disabled) {
  background: var(--active);
  color: white;
}

.pagination-jump-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#pageInfo {
  font-weight: 700;
  color: var(--active);
  padding: 0 0.75rem;
}

.page-jump-input::-webkit-outer-spin-button,
.page-jump-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.page-jump-input[type=number] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.filters-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr;
}

.filter-search {
  grid-column: 1 / -1;
}

.filter-clear-btn {
  justify-content: center;
  border-color: color-mix(in srgb, var(--active) 36%, var(--field-border));
  background: color-mix(in srgb, #dbeafe 62%, white 38%);
  color: #0b3b66;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.34rem 0.72rem;
}

.filters-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.3rem;
  min-height: 0;
}

.filters-actions.is-hidden {
  display: none !important;
}

@media (min-width: 768px) {
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .filters-grid {
    grid-template-columns: minmax(320px, 2fr) repeat(4, minmax(150px, 1fr));
    align-items: center;
  }

  .filter-search {
    grid-column: auto;
  }
}

.card-body {
  padding: 0.9rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-body p {
  color: var(--muted);
}

.pill {
  display: inline-block;
  border: 1px solid var(--field-border);
  border-radius: 999px;
  padding: 0.2rem 0.56rem;
  font-size: 0.68rem;
  margin-right: 0.2rem;
  margin-top: 0.25rem;
}

.action-row {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.8rem;
}

.action-btn {
  flex: 1;
  border-radius: 0.65rem;
}

.action-btn.secondary {
  opacity: 0.92;
}

.action-btn.play-btn {
  flex: 1;
}

.fav-icon-btn {
  flex: 0 0 54px;
  justify-content: center;
  padding-inline: 0.45rem;
}

.fav-icon-btn .bi {
  font-size: 1rem;
}

.player-card {
  position: sticky;
  top: 12px;
}

.player-card.cinema {
  position: fixed;
  z-index: 1000;
  inset: 1rem;
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}

.player-card.cinema #playerWrapper {
  height: 100%;
  max-height: calc(100vh - 12rem);
  border-radius: 0;
}

.player-card.cinema .p-4 {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

#qualityWrap .field {
  transition: all 0.2s;
}

#qualityWrap .field:hover {
  background: white;
}

#playerWrapper {
  background: #020617;
}

.video-js {
  width: 100%;
  min-height: 300px;
}

.video-js video::picture-in-picture,
.video-js .vjs-tech::picture-in-picture {
  width: 460px;
  height: 260px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pricing-shell {
  border: 1px solid var(--shell-border);
}

.pricing-head p {
  margin-top: 0.35rem;
}

.pricing-grid {
  margin-top: 0.95rem;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr;
}

.pricing-card {
  border: 1px solid var(--field-border);
  background: color-mix(in srgb, var(--field-bg) 90%, white 10%);
  border-radius: 0.9rem;
  padding: 0.95rem;
}

.pricing-card.featured {
  border-color: rgba(7, 89, 133, 0.45);
  background:
    radial-gradient(circle at 14% 12%, rgba(14, 165, 233, 0.24), transparent 45%),
    radial-gradient(circle at 88% 90%, rgba(217, 70, 239, 0.2), transparent 42%),
    linear-gradient(145deg, rgba(239, 246, 255, 0.98), rgba(224, 242, 254, 0.92));
  box-shadow:
    0 0 0 1px rgba(14, 116, 144, 0.22) inset,
    0 14px 28px rgba(14, 116, 144, 0.18);
}

.pricing-tier {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.pricing-price {
  margin: 0.3rem 0 0;
  font-size: 1.75rem;
  line-height: 1.1;
}

.pricing-price span {
  font-size: 0.88rem;
  color: var(--muted);
}

.pricing-list {
  margin: 0.75rem 0 0.85rem;
  padding-left: 1.05rem;
  color: var(--muted);
}

.pricing-list li {
  margin: 0.27rem 0;
}

@media (min-width: 900px) {
  .pricing-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.linkish {
  text-decoration: none;
}

.modal {
  width: min(560px, calc(100vw - 1.4rem));
  border: none;
  border-radius: 1rem;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(3px);
}

.modal-card {
  background: var(--card-bg);
  border: 1px solid var(--shell-border);
  color: var(--text);
  border-radius: 1rem;
  padding: 1.1rem;
}

.modal-card p {
  color: var(--muted);
  line-height: 1.65;
}

.modal-card h3 {
  margin-bottom: 0.5rem;
}

.modal-section {
  margin: 0.35rem 0 0.55rem;
}

.modal-list {
  list-style: none;
  margin: 0 0 0.65rem 0;
  padding: 0;
  color: var(--muted);
  line-height: 1.55;
}

.modal-list li {
  position: relative;
  margin: 0.34rem 0;
  padding-left: 1.05rem;
}

.modal-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.36rem;
  height: 0.36rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--active) 72%, #38bdf8 28%);
}

.modal-note {
  margin: 0.3rem 0 0.8rem;
  font-size: 0.94rem;
}

@media (max-width: 1024px) {
  .player-card {
    position: relative;
    top: auto;
  }
}

@media (max-width: 768px) {
  .video-js {
    min-height: 230px;
  }

  .player-card.cinema {
    inset: 0.25rem;
  }

  .player-card.cinema #playerWrapper {
    height: calc(100vh - 10.8rem);
  }

  .player-actions {
    gap: 0.4rem;
  }

  .player-actions .control-btn {
    padding: 0.38rem 0.58rem;
    font-size: 0.7rem;
  }
}
