/* ==========================================================================
   FIMONLINE v2.0 — Cinema Watch Page & Multi-Engine Video Player
   ========================================================================== */

.watch-topbar {
  position: sticky;
  top: 0;
  z-index: 950;
  height: calc(58px + var(--safe-top));
  padding: var(--safe-top) 4% 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(8, 9, 12, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
}

.watch-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 600;
  flex-shrink: 0;
  transition: background 0.2s;
}

.watch-back-btn:hover {
  background: var(--accent-crimson);
}

.watch-topbar-title {
  min-width: 0;
  flex: 1;
  text-align: center;
}

.watch-topbar-title h1 {
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-topbar-title p {
  font-size: 0.76rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 4% 80px;
}

/* Player Stage */
.player-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 74vh;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
}

.player-stage video,
.player-stage iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}

.player-status-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(8, 9, 12, 0.88);
  color: #fff;
  text-align: center;
  padding: 24px;
  z-index: 6;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent-crimson);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* Player Control Bar */
.player-toolbar {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.server-live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-emerald);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.server-live-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* Watch Layout Grid */
.watch-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 24px;
  align-items: start;
}

.watch-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
}

.watch-movie-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.watch-movie-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.watch-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.watch-overview {
  color: #cfd4e2;
  font-size: 0.93rem;
  line-height: 1.65;
}

.watch-overview.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn-link-more {
  margin-top: 8px;
  color: var(--accent-crimson-bright);
  font-size: 0.84rem;
  font-weight: 700;
}

/* Episodes Panel */
.panel-heading {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.range-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 2px;
}

.range-tabs::-webkit-scrollbar {
  display: none;
}

.range-btn {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.range-btn.active {
  background: var(--accent-crimson);
  border-color: var(--accent-crimson);
  color: #fff;
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.ep-btn {
  padding: 10px 4px;
  border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
  transition: all 0.18s;
}

.ep-btn:hover {
  border-color: var(--accent-crimson);
  background: rgba(229, 9, 20, 0.16);
}

.ep-btn.current {
  background: var(--accent-crimson);
  border-color: var(--accent-crimson);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-crimson-glow);
}

.related-section {
  margin-top: 40px;
}

/* Mobile Watch Layout: Sticky Player + Episodes First */
@media (max-width: 980px) {
  .watch-grid {
    grid-template-columns: 1fr;
  }
  .episodes-panel {
    order: 1;
  }
  .info-panel {
    order: 2;
  }
}

@media (max-width: 768px) {
  .watch-back-btn span {
    display: none;
  }
  .watch-back-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
  }
  .watch-shell {
    padding: 0 0 40px;
  }
  .player-stage {
    position: sticky;
    top: calc(58px + var(--safe-top));
    z-index: 900;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .player-toolbar {
    margin: 10px 12px 0;
    padding: 10px 12px;
  }
  .watch-grid {
    margin-top: 12px;
    padding: 0 12px;
    gap: 14px;
  }
  .watch-panel {
    background: transparent;
    border: none;
    padding: 8px 4px;
  }
  .related-section {
    padding: 0 12px;
  }
}

