:root {
  --primary-color: #5db1fa;
  --text-color: #333;
  --light-text: #fff;
  --muted-text: #6c757d;
  --background-color: #f8f9fa;
  --border-radius: 8px;
  --action-blue: #2687db;
  --header-height: 60px;
  --transition-duration: 0.6s;
  --transition-easing: cubic-bezier(0.23, 1, 0.32, 1);
}
:root {
  --action-blue: #2687DB;
}
.reel-header {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 11;
  display: flex;
  align-items: center;
}
.reel-header .coach-profile-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.reel-header .coach-avatar-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 10px;
}
.reel-header .coach-name {
  font-size: 1rem;
}
.reel-sound-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 11;
  background-color: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
}
.reel-sound-toggle:hover {
  background-color: rgba(0, 0, 0, 0.7);
}
.reel-actions {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 25px;
  z-index: 10;
}
.reel-action-btn {
  background: rgba(38, 135, 219, 0.8);
  border: 1px solid transparent;
  border-radius: 50%;
  color: white;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  position: relative;
}
.reel-action-btn:hover {
  background: rgba(38, 135, 219, 1);
}
.reel-action-btn.active {
  background-color: rgba(255, 255, 255, 0.9);
  color: var(--action-blue);
}
.reel-action-btn .like-count, .reel-action-btn .save-count {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 0.85rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
/* Base Styles */
* {
  box-sizing: border-box;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.content-wrapper {
  padding-top: var(--header-height) !important;
  min-height: 100vh;
 
}
/* Shared Reel Component Styles */
.reel-aspect-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  aspect-ratio: 9 / 16;
}
.reel-video-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius);
  overflow: hidden;
}
.reel-video-container {
  width: 100%;
  height: 100%;
  position: relative;
}
.reel-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  cursor: pointer;
}
.reel-placeholder {
  width: 100%;
  height: 100%;
  background-color: #111;
}
.reel-overlay-gradient-bottom, .reel-overlay-gradient-top {
  position: absolute;
  left: 0;
  width: 100%;
  pointer-events: none;
}
.reel-overlay-gradient-bottom {
  bottom: 0;
  height: 40%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 100%);
}
.reel-overlay-gradient-top {
  top: 0;
  height: 25%;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 100%);
}
.reel-info {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 15px;
  z-index: 5;
}
.coach-profile-top {
  margin-bottom: 12px;
}
.coach-profile-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: white;
}
.coach-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 10px;
  border: 2px solid white;
}
.coach-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.coach-name {
  font-size: 0.85rem;
  font-weight: 400;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
.reel-title {
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  font-weight: 400;
  color: white;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
.reel-description {
  font-size: 0.8rem;
  color: #bbbbbb;
  margin-bottom: 0.3rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
.show-more {
  color: var(--primary-color);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  display: inline;
}
.reel-hashtags {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}
.reel-actions {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 30px;
  z-index: 20;
}
.action-icon {
  background-color: rgba(38, 135, 219, 0.8);
  border: 1px solid var(--action-blue);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 5px;
}
.action-icon.active {
  background-color: rgba(255, 255, 255, 0.9);
  color: var(--action-blue);
}
.action-icon .like-count, .action-icon .save-count {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 0.85rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
/* ======================================================================== */
/* DESKTOP STYLES (Default) */
/* ======================================================================== */
#reels-list-view, .reels-close-button {
  display: none;
}
#reels-panel-overlay {
  position: relative;
  height: calc(100vh - var(--header-height));
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
#reels-panel-overlay .reels-container {
  position: relative;
  height: 100%;
  width: 100%;
  overflow: hidden; /* Prevents scroll on desktop for JS animation */
  display: flex;
  justify-content: center;
  align-items: center;
}
#reels-panel-overlay .reel-slide {
  position: absolute;
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: transform var(--transition-duration) var(--transition-easing);
}
#reels-panel-overlay .reel-aspect-container {
  max-height: calc(100vh - var(--header-height) - 40px);
  max-width: calc((100vh - var(--header-height) - 40px) * 9 / 16);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.reel-navigation {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 15px;
  z-index: 100;
}
.nav-button {
  background-color: var(--action-blue);
  border: 1px solid var(--action-blue);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
}
.nav-button.hidden {
  opacity: 0;
  pointer-events: none;
}
/* ======================================================================== */
/* MOBILE STYLES */
/* ======================================================================== */


/* --- Compact header inside reel-info on mobile --- */
@media (max-width: 767.98px) {
  body.reels-compact-mobile .reel-info > .reel-header {
    position: static !important;
    top: auto !important;
    left: auto !important;
    z-index: auto !important;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px 0;
  }
  body.reels-compact-mobile .reel-header .coach-avatar-img {
    width: 32px; height: 32px; border-radius: 50%; margin: 0;
  }
  body.reels-compact-mobile .reel-header .coach-name {
    font-size: 0.95rem;
  }
}


@media (max-width: 959px) {
  .coach-name, .reel-title {
    font-size: 0.9rem !important;
  }
  .content-wrapper {
    padding-top: 0;
  }
  .reel-navigation {
    display: none !important;
  }
  /* Mobile List View */
  #reels-list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  #reels-list-view .reel-slide {
    position: relative;
    cursor: pointer;
  }
  #reels-list-view .reel-aspect-container {
    width: 100%;
    height: auto;
    max-height: 85vh;
  }
  #reels-list-view .reel-video {
    object-fit: cover;
  }
  /* Mobile Panel Overlay (Hidden by default) */
  #reels-panel-overlay {
    display: none;
  }
  /* Styles for when the panel is ACTIVE */
  body.reels-viewer-active {
    overflow: hidden;
  }
  body.reels-viewer-active #reels-panel-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 10000; /* Changed from 99998 */
  }
  body.reels-viewer-active #reels-list-view, body.reels-viewer-active .site-header, body.reels-viewer-active .site-footer, body.reels-viewer-active .mobile-menu {
    display: none !important;
  }
  #reels-panel-overlay .reels-container {
    height: 100%;
    width: 100%;
    display: block;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-width: none;
  }
  #reels-panel-overlay .reels-container::-webkit-scrollbar {
    display: none;
  }
  #reels-panel-overlay .reel-slide {
    position: relative;
    height: 100%;
    width: 100%;
    scroll-snap-align: start;
    transition: none;
    transform: none !important;
    opacity: 1;
  }
  #reels-panel-overlay .reel-aspect-container {
    border-radius: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    box-shadow: none;
  }
  #reels-panel-overlay .reel-video {
    object-fit: cover;
  }
  #reels-panel-overlay .reel-info {
    bottom: 80px;
    right: 80px;
    padding: 10px;
  }
  #reels-panel-overlay .reel-actions {
    top: 30%;
    transform: translateY(50%);
    gap: 20px;
  }
  .reels-close-button {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 20px;
    left: 15px;
    z-index: 10001; /* Changed from 100000 */
    background: rgba(0, 0, 0, 0.4);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
  }
}
/* Z-index fix for login modal */
.ui-modal-wrapper, .swal2-container, .login-modal-overlay {
  z-index: 10002 !important;
}



/* Quick fade-in so the list doesn't flash during DOM build */
#reels-list-view { opacity: 0; transition: opacity .15s ease; }
#reels-list-view.is-ready { opacity: 1; }

/* GPU acceleration for smoother mobile scrolling */
@media (max-width: 767.98px) {
  .reel-slide {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
  }
  .reel-video {
    will-change: contents;
  }
  /* Reduce paint on scroll */
  #reels-list-view {
    contain: layout style;
  }
}

/* Optional: micro-skeleton while CSS paints (safe to keep even if unused) */
.reel-skeleton {
  border-radius: 16px;
  height: 64vw;              /* ~9:16 in a pinch */
  max-height: 60vh;
  background: linear-gradient(90deg, #2a2a2a 25%, #333 37%, #2a2a2a 63%);
  background-size: 400% 100%;
  animation: reelsShimmer 1.1s infinite;
  margin: 12px 0;
}
@keyframes reelsShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
