/* ==========================================================================
   Online Services — Custom Video Player + Watch Page
   Location: assets/css/video-player.css
   Enqueued on template-online-services.php and single-lgm_service.php.

   Player chrome is intentionally near-black (not the site's off-white)
   since that's what makes any video player read as premium — Netflix,
   YouTube, and Spotify all do the same. The dark-navy + metallic-gold
   brand pairing shows up in the accent color (progress bar, active
   states, badges) rather than as the player's base surface, and fully
   takes over everywhere outside the player itself (tabs, sidebar,
   playlist). Same scoped-token pattern as header.css/history.css/
   prayer.css.
   ========================================================================== */

:root {
  --lgm-player-navy: #0B1F3A;
  --lgm-player-navy-light: #16314F;
  --lgm-player-gold: #C8A951;
  --lgm-player-black: #0A0E14;
  --lgm-player-surface: #12161F;
}

/* ==========================================================================
   Hero / page header
   ========================================================================== */

.lgm-watch-hero {
  padding-block: var(--lgm-space-xl) var(--lgm-space-lg);
  background: linear-gradient(135deg, var(--lgm-player-navy) 0%, var(--lgm-player-navy-light) 100%);
  color: var(--lgm-white);
  text-align: center;
}

.lgm-watch-hero h1 {
  color: var(--lgm-white);
  margin-bottom: 6px;
}

.lgm-watch-hero p {
  color: rgba(255, 255, 255, 0.8);
  max-width: var(--lgm-text-width);
  margin-inline: auto;
}

.lgm-watch-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--lgm-radius-pill);
  background: var(--lgm-red);
  color: var(--lgm-white);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: var(--lgm-space-sm);
}

.lgm-watch-live-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lgm-white);
  animation: lgmLivePulse 1.4s ease-in-out infinite;
}

@keyframes lgmLivePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ==========================================================================
   Watch page layout
   ========================================================================== */

.lgm-watch-section {
  background: var(--lgm-off-white);
  padding-block: var(--lgm-space-xl) var(--lgm-space-2xl);
}

.lgm-watch-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--lgm-space-lg);
  align-items: start;
}

.lgm-watch-main {
  min-width: 0;
}

.lgm-watch-title {
  margin: var(--lgm-space-md) 0 4px;
}

.lgm-watch-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--lgm-medium-grey);
  font-size: 0.9rem;
  margin-bottom: var(--lgm-space-md);
}

.lgm-watch-meta strong {
  color: var(--lgm-dark-grey);
}

.lgm-watch-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: var(--lgm-space-lg);
}

.lgm-watch-downloads .lgm-btn {
  font-size: 0.78rem;
  padding: 10px 18px;
}

/* ==========================================================================
   Player shell
   ========================================================================== */

.lgm-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--lgm-player-black);
  border-radius: var(--lgm-radius-lg);
  overflow: hidden;
  box-shadow: var(--lgm-shadow-card);
  outline: none;
}

.lgm-player-media {
  position: absolute;
  inset: 0;
}

.lgm-player-video,
.lgm-player-youtube-target {
  width: 100%;
  height: 100%;
  display: block;
  background: var(--lgm-player-black);
}

/* The YouTube IFrame API REPLACES the target <div> above with its own
   <iframe> (it doesn't render inside it) — so this can't be scoped to
   .lgm-player-youtube-target (that class disappears with the div it
   was on). Targeting "iframe" as a descendant of the stable parent
   class instead sizes it correctly regardless of the API's internal
   DOM-replacement behavior. */
.lgm-player-media--youtube iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.lgm-player-media--youtube .lgm-player-video {
  display: none;
}
.lgm-player-media:not(.lgm-player-media--youtube) .lgm-player-youtube-target {
  display: none;
}

.lgm-player-click-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: pointer;
}

.lgm-player-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: none;
}

.lgm-player-spinner::after {
  content: "";
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--lgm-player-gold);
  animation: lgmSpin 0.8s linear infinite;
}

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

.lgm-player-live-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--lgm-radius-pill);
  background: var(--lgm-red);
  color: var(--lgm-white);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.lgm-player:not([data-is-live="1"]) .lgm-player-live-badge,
.lgm-player .lgm-player-live-badge[hidden] {
  display: none;
}

/* Big center play/pause icon — fades in when paused/hovered, mirrors
   Netflix/YouTube's affordance rather than relying on the small
   control-bar button alone. */
.lgm-player-center-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(11, 31, 58, 0.65);
  color: var(--lgm-white);
  font-size: 1.6rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease-out, transform 250ms ease-out;
}

.lgm-player.is-paused .lgm-player-center-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ==========================================================================
   Control bar
   ========================================================================== */

.lgm-player-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 28px 16px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0) 100%);
  transition: opacity 250ms ease-out, transform 250ms ease-out;
}

.lgm-player--controls-hidden .lgm-player-controls,
.lgm-player--controls-hidden .lgm-player-live-badge {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
}

.lgm-player--controls-hidden .lgm-player-media {
  cursor: none;
}

.lgm-player-progress-row {
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.lgm-player-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
  pointer-events: none;
}

.lgm-player-buffered-bar,
.lgm-player-played-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 2px;
}

.lgm-player-buffered-bar {
  background: rgba(255, 255, 255, 0.35);
  width: 0;
}

.lgm-player-played-bar {
  background: var(--lgm-player-gold);
  width: 0;
}

.lgm-player-seek {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 16px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.lgm-player-seek::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--lgm-player-gold);
  box-shadow: 0 0 0 4px rgba(200, 169, 81, 0.25);
  margin-top: 0;
  transition: transform 150ms ease-out;
}

.lgm-player-seek:hover::-webkit-slider-thumb {
  transform: scale(1.2);
}

.lgm-player-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--lgm-player-gold);
}

.lgm-player-buttons-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lgm-player-buttons-left,
.lgm-player-buttons-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lgm-player-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--lgm-white);
  font-size: 1rem;
  width: 38px;
  height: 38px;
  border-radius: var(--lgm-radius-sm);
  cursor: pointer;
  transition: background-color 150ms ease-out, transform 150ms ease-out;
  justify-content: center;
}

.lgm-player-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.lgm-player-btn.is-active,
.lgm-player-btn[aria-pressed="true"] {
  color: var(--lgm-player-gold);
}

.lgm-player-btn-label {
  font-size: 0.78rem;
  font-weight: 700;
  padding-right: 4px;
}

.lgm-player-btn-labeled {
  width: auto;
  padding: 0 10px;
}

.lgm-player-time {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  padding: 0 6px;
  white-space: nowrap;
}

.lgm-player-volume-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lgm-player-volume-slider {
  width: 0;
  opacity: 0;
  appearance: none;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  cursor: pointer;
  transition: width 200ms ease-out, opacity 200ms ease-out, margin-left 200ms ease-out;
}

.lgm-player-volume-group:hover .lgm-player-volume-slider,
.lgm-player-volume-slider:focus-visible {
  width: 80px;
  opacity: 1;
  margin-left: 4px;
}

.lgm-player-volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--lgm-white);
}

/* ---- Dropdown menus (speed / quality) ---- */

.lgm-player-menu-wrap {
  position: relative;
}

.lgm-player-dropdown {
  position: absolute;
  bottom: 46px;
  right: 0;
  display: none;
  flex-direction: column;
  min-width: 110px;
  background: rgba(18, 22, 31, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--lgm-radius-sm);
  overflow: hidden;
  box-shadow: var(--lgm-shadow-lg);
}

.lgm-player-dropdown.is-open {
  display: flex;
}

.lgm-player-dropdown button {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.85);
  text-align: left;
  padding: 9px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}

.lgm-player-dropdown button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lgm-player-dropdown button.is-active {
  color: var(--lgm-player-gold);
  font-weight: 700;
}

/* ==========================================================================
   Theater mode / fullscreen / mini-player states
   ========================================================================== */

.lgm-player--theater {
  aspect-ratio: auto;
  height: min(80vh, 720px);
}

.lgm-player--fullscreen {
  border-radius: 0;
}

.lgm-player--mini {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(360px, 90vw);
  aspect-ratio: 16 / 9;
  height: auto;
  z-index: 9500;
  border-radius: var(--lgm-radius-md);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.lgm-player--mini .lgm-player-controls {
  padding: 10px 8px 6px;
}

.lgm-player--mini .lgm-player-buttons-row > *:not(.lgm-player-buttons-left) {
  display: none;
}

.lgm-player--mini .lgm-player-buttons-left > *:not(.lgm-player-btn-play) {
  display: none;
}

.lgm-player-mini-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  display: none;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: var(--lgm-white);
  border: none;
  cursor: pointer;
}

.lgm-player--mini .lgm-player-mini-close {
  display: flex;
}

/* ==========================================================================
   Tabs — Transcript / Sermon Notes / Bible References / Comments
   ========================================================================== */

.lgm-watch-tabs {
  margin-top: var(--lgm-space-xl);
}

.lgm-watch-tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 2px solid var(--lgm-border);
  margin-bottom: var(--lgm-space-lg);
}

.lgm-watch-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 18px;
  margin-bottom: -2px;
  color: var(--lgm-medium-grey);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: color var(--lgm-transition-fast), border-color var(--lgm-transition-fast);
}

.lgm-watch-tab-btn:hover {
  color: var(--lgm-player-navy);
}

.lgm-watch-tab-btn.is-active {
  color: var(--lgm-player-navy);
  border-bottom-color: var(--lgm-player-gold);
}

.lgm-watch-tab-panel {
  display: none;
}

.lgm-watch-tab-panel.is-active {
  display: block;
}

/* Transcript */

.lgm-transcript-list {
  max-height: 480px;
  overflow-y: auto;
  border-radius: var(--lgm-radius-md);
  border: 1px solid var(--lgm-border);
}

.lgm-transcript-row {
  display: flex;
  gap: 14px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--lgm-border);
  transition: background-color var(--lgm-transition-fast);
}

.lgm-transcript-row:last-child {
  border-bottom: none;
}

.lgm-transcript-row:hover {
  background: var(--lgm-light-blue);
}

.lgm-transcript-row.is-active {
  background: rgba(200, 169, 81, 0.14);
}

.lgm-transcript-time {
  flex: none;
  width: 56px;
  color: var(--lgm-player-gold);
  font-weight: 700;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.lgm-transcript-text {
  color: var(--lgm-dark-grey);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* Sermon Notes / Bible References */

.lgm-watch-notes {
  max-width: 760px;
  line-height: 1.8;
  color: var(--lgm-dark-grey);
}

.lgm-bible-refs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.lgm-bible-ref-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--lgm-radius-pill);
  background: var(--lgm-light-blue);
  color: var(--lgm-player-navy);
  font-weight: 600;
  font-size: 0.9rem;
}

.lgm-bible-ref-pill i {
  color: var(--lgm-player-gold);
}

/* Comments (wraps WordPress core comments_template() output) */

.lgm-watch-comments .comment-form input[type="text"],
.lgm-watch-comments .comment-form input[type="email"],
.lgm-watch-comments .comment-form input[type="url"],
.lgm-watch-comments .comment-form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--lgm-border);
  border-radius: var(--lgm-radius-sm);
  font-family: var(--lgm-font-body);
  margin-bottom: 12px;
}

.lgm-watch-comments .comment-form textarea {
  min-height: 120px;
}

.lgm-watch-comments .comment-form-cookies-consent {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--lgm-medium-grey);
}

.lgm-watch-comments ol.comment-list {
  list-style: none;
  margin: 0 0 var(--lgm-space-lg);
  padding: 0;
}

.lgm-watch-comments .comment {
  padding: var(--lgm-space-md) 0;
  border-bottom: 1px solid var(--lgm-border);
}

.lgm-watch-comments .comment-author {
  font-weight: 700;
  color: var(--lgm-player-navy);
}

.lgm-watch-comments .comment-metadata {
  color: var(--lgm-medium-grey);
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.lgm-watch-comments ol.children {
  list-style: none;
  margin-left: var(--lgm-space-lg);
  padding: 0;
}

/* ==========================================================================
   Sidebar — Related / Watch Later / History
   ========================================================================== */

.lgm-watch-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--lgm-space-lg);
}

.lgm-watch-panel-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  color: var(--lgm-player-navy);
  margin-bottom: var(--lgm-space-sm);
}

.lgm-watch-panel-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: var(--lgm-space-sm);
}

.lgm-watch-panel-tab {
  flex: 1;
  background: var(--lgm-light-grey);
  border: none;
  border-radius: var(--lgm-radius-sm);
  padding: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--lgm-medium-grey);
  cursor: pointer;
}

.lgm-watch-panel-tab.is-active {
  background: var(--lgm-player-navy);
  color: var(--lgm-white);
}

/* Related videos + playlist cards (server-rendered, real links) */

.lgm-related-list,
.lgm-watch-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lgm-related-item,
.lgm-watch-list-item {
  display: flex;
  gap: 12px;
  text-decoration: none;
  padding: 8px;
  border-radius: var(--lgm-radius-sm);
  transition: background-color var(--lgm-transition-fast);
}

.lgm-related-item:hover,
.lgm-watch-list-item:hover {
  background: var(--lgm-light-grey);
}

.lgm-related-item.is-active {
  background: rgba(200, 169, 81, 0.14);
}

.lgm-related-thumb,
.lgm-watch-list-thumb {
  position: relative;
  flex: none;
  width: 120px;
  aspect-ratio: 16 / 9;
  border-radius: var(--lgm-radius-sm);
  background-color: var(--lgm-player-navy);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.lgm-related-thumb .lgm-related-live-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--lgm-red);
  color: var(--lgm-white);
  font-size: 0.6rem;
  font-weight: 700;
}

.lgm-related-thumb .lgm-related-duration {
  position: absolute;
  bottom: 4px;
  right: 4px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--lgm-white);
  font-size: 0.65rem;
  font-variant-numeric: tabular-nums;
}

.lgm-watch-list-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.4);
}

.lgm-watch-list-progress span {
  display: block;
  height: 100%;
  background: var(--lgm-player-gold);
}

.lgm-related-title,
.lgm-watch-list-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--lgm-heading-color);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lgm-related-speaker {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--lgm-medium-grey);
  font-weight: 400;
}

.lgm-watch-list-empty {
  padding: var(--lgm-space-md);
  text-align: center;
  color: var(--lgm-medium-grey);
  font-size: 0.85rem;
  background: var(--lgm-light-grey);
  border-radius: var(--lgm-radius-sm);
}

/* ==========================================================================
   Playlist grid (Online Services hub page — past services below the
   featured/live player)
   ========================================================================== */

.lgm-services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--lgm-space-md);
}

.lgm-service-card {
  display: block;
  text-decoration: none;
  background: var(--lgm-white);
  border-radius: var(--lgm-radius-md);
  overflow: hidden;
  box-shadow: var(--lgm-shadow-sm);
  transition: transform var(--lgm-transition-fast), box-shadow var(--lgm-transition-fast);
}

.lgm-service-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--lgm-shadow-md);
}

.lgm-service-card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background-color: var(--lgm-player-navy);
  background-size: cover;
  background-position: center;
}

.lgm-service-card-thumb .lgm-related-live-badge,
.lgm-service-card-thumb .lgm-related-duration {
  position: absolute;
}

.lgm-service-card-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  background: rgba(11, 31, 58, 0);
  transition: background-color var(--lgm-transition-fast);
}

.lgm-service-card:hover .lgm-service-card-thumb::after {
  background: rgba(11, 31, 58, 0.15);
}

.lgm-service-card-body {
  padding: 14px;
}

.lgm-service-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--lgm-heading-color);
  margin: 0 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lgm-service-card-meta {
  font-size: 0.78rem;
  color: var(--lgm-medium-grey);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 991px) {
  .lgm-watch-layout {
    grid-template-columns: 1fr;
  }

  .lgm-services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .lgm-player--theater {
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 575px) {
  .lgm-services-grid {
    grid-template-columns: 1fr;
  }

  .lgm-player-btn {
    width: 34px;
    height: 34px;
  }

  .lgm-player--mini {
    right: 10px;
    bottom: 10px;
    width: min(280px, 80vw);
  }

  .lgm-related-thumb,
  .lgm-watch-list-thumb {
    width: 96px;
  }
}
