/* src/css/player.css */

.player-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.video-container {
  position: relative;
  flex: 1;
  background: #000;
  overflow: hidden;
  touch-action: none;
  border-radius: 16px;
}

@media (max-width: 767px) {
  .video-container {
    border-radius: 0;
  }
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.video-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Center Play Button */
.center-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  pointer-events: auto;
  display: none;
  animation: scaleIn 0.25s ease;
}

.center-play-btn button {
  width: 72px;
  height: 72px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.center-play-btn button:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.4);
}

.center-play-btn svg {
  width: 32px;
  height: 32px;
  stroke-width: 2.2px;
  margin-left: 5px;
  /* Optical adjustment for triangle */
}

@keyframes scaleIn {
  from {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
  }

  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

/* Top Bar */
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 2rem;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
  opacity: 0;
  transform: translateY(-16px);
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 2;
}

.top-bar.show {
  opacity: 1;
  transform: translateY(0);
}

.channel-info-top h2 {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
  color: white;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.channel-info-top span {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Bottom Bar */
.bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.8rem 1.2rem 1.1rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.96) 0%, rgba(0, 0, 0, 0.85) 70%, transparent 100%);
  opacity: 0;
  transform: translateY(18px);
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 2;
}

.bottom-bar.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(148, 163, 184, 0.35);
  cursor: pointer;
  position: relative;
  margin-bottom: 1rem;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--highlight), #ec4899);
  width: 0%;
  border-radius: inherit;
  position: relative;
  transition: width 0.08s linear;
  will-change: width;
}

.progress-fill::after {
  content: '';
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.progress-bar:hover .progress-fill::after,
.bottom-bar.show:hover .progress-fill::after {
  opacity: 1;
}

/* Video Controls */
.video-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 48px;
  width: 100%;
}

.controls-left,
.controls-right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  height: 100%;
}

/* Base control button - MODERN MINIMAL */
.control-btn {
  background: transparent;
  border: none;
  color: #f8fafc;
  width: 48px;
  min-width: 48px;
  height: 48px;
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  position: relative;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}

.control-btn:active {
  transform: scale(0.95);
}

.control-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-width: 2.2px;
}

/* Pill-style button - MODERN GLASS */
.control-btn-pill {
  width: auto;
  min-width: 64px;
  padding: 0 0.9rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.control-btn-pill:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Favorite button */
#favBtn .fav-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#favBtn.fav-active .fav-icon {
  fill: #f43f5e;
  stroke: #f43f5e;
  filter: drop-shadow(0 0 6px rgba(244, 63, 94, 0.6));
  transform: scale(1.1);
}

#favBtn.fav-active:hover .fav-icon {
  transform: scale(1.2);
}

/* Volume Control */
.volume-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.5rem;
  height: 48px;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.volume-control:hover {
  background: rgba(255, 255, 255, 0.08);
}

.volume-control .control-btn {
  background: transparent;
  border: none;
  width: 36px;
  min-width: 36px;
  height: 36px;
}

.volume-control .control-btn:hover {
  background: rgba(30, 58, 138, 0.5);
  box-shadow: none;
  transform: none;
}

/* Volume slider - FIXED */
.volume-slider {
  width: 80px;
  height: 4px;
  background: rgba(148, 163, 184, 0.4);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
}

/* WebKit/Chrome/Safari */
.volume-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  background: transparent;
  border-radius: 999px;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  position: relative;
  margin-top: -4px;
  border: none;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.volume-slider::-webkit-slider-thumb:active {
  transform: scale(1.05);
}

/* Firefox */
.volume-slider::-moz-range-track {
  width: 100%;
  height: 4px;
  background: transparent;
  border-radius: 999px;
}

.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.volume-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
}

.volume-slider::-moz-range-progress {
  background: linear-gradient(90deg, var(--highlight), #ec4899);
  height: 4px;
  border-radius: 999px;
}

/* Gesture Feedback */
.gesture-feedback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  padding: 2rem 2.5rem;
  border-radius: 20px;
  font-size: 2rem;
  font-weight: 700;
  color: white;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 5;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.gesture-feedback.show {
  opacity: 1;
}

/* Indicators */
.indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  padding: 1.5rem 1rem;
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  z-index: 3;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.indicator.show {
  opacity: 1;
}

.indicator.left {
  left: 2rem;
}

.indicator.right {
  right: 2rem;
}

.indicator svg {
  width: 32px;
  height: 32px;
  color: white;
}

.indicator-bar {
  width: 40px;
  height: 160px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
}

.indicator-bar div {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(to top, var(--highlight), #ec4899);
  border-radius: 20px;
  transition: height 0.1s linear;
}

/* Cinematic Loading Screen - Premium Tivy UX */
.video-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.5s ease;
}

.loading-background {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, #0a0a0c, #050507);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px);
}

.loading-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  text-align: center;
}

/* Spinner Rings - High-end modern feel */
.loading-logo-container {
  position: relative;
  width: 130px;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner-rings {
  position: absolute;
  inset: -15px;
}

.loading-spinner-rings span {
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  border-top-color: var(--highlight);
  animation: loading-spin var(--duration) linear infinite;
  opacity: 0.8;
}

.loading-spinner-rings span:nth-child(1) {
  --duration: 1.2s;
  border-top-color: var(--highlight);
}

.loading-spinner-rings span:nth-child(2) {
  --duration: 0.8s;
  inset: 12px;
  border-top-color: #ec4899;
}

.loading-spinner-rings span:nth-child(3) {
  --duration: 1.5s;
  inset: 24px;
  border-top-color: #3b82f6;
}

#loadingLogo,
.loading-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  object-fit: contain;
  animation: loading-pulse 2s ease-in-out infinite;
  z-index: 3;
}

.loading-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.5), rgba(79, 70, 229, 0.5));
}

.loading-info h3 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.6rem;
  letter-spacing: -0.5px;
  text-shadow: 0 0 20px rgba(244, 63, 94, 0.3);
  animation: loading-fade-in 0.8s ease-out;
}

.loading-info p {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.95rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 2px;
  animation: loading-fade-in 1.2s ease-out;
}

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

@keyframes loading-pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
    filter: brightness(1);
  }

  50% {
    transform: scale(1.05);
    opacity: 1;
    filter: brightness(1.2) drop-shadow(0 0 10px rgba(244, 63, 94, 0.3));
  }
}

@keyframes loading-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 767px) {
  .loading-info h3 {
    font-size: 1.3rem;
  }

  .loading-logo-container {
    width: 100px;
    height: 100px;
  }

  #loadingLogo,
  .loading-placeholder {
    width: 64px;
    height: 64px;
  }
}

/* Mobile Responsive - Portrait Mode */
@media (max-width: 767px) and (orientation: portrait) {
  .top-bar {
    padding: 1rem;
  }

  .channel-info-top h2 {
    font-size: 1.1rem;
  }

  .channel-info-top span {
    font-size: 0.85rem;
  }

  .bottom-bar {
    padding: 0.7rem 1rem 0.9rem;
  }

  .progress-bar {
    margin-bottom: 0.8rem;
  }

  .video-controls {
    gap: 0.4rem;
  }

  .controls-left,
  .controls-right {
    gap: 0.35rem;
  }

  .control-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .control-btn svg {
    width: 16px;
    height: 16px;
  }

  #favBtn .fav-icon {
    width: 22px;
    height: 22px;
  }

  .control-btn-pill {
    min-width: 60px;
    padding: 0 0.85rem;
    font-size: 0.8rem;
  }

  /* HIDE volume in portrait - use device buttons */
  .volume-control {
    display: none;
  }

  .center-play-btn button {
    width: 56px;
    height: 56px;
  }

  .center-play-btn svg {
    width: 22px;
    height: 22px;
  }

  .indicator.left {
    left: 1rem;
  }

  .indicator.right {
    right: 1rem;
  }

  .indicator-bar {
    width: 35px;
    height: 130px;
  }
}

/* Mobile Landscape Mode - SHOW VOLUME */
@media (max-width: 767px) and (orientation: landscape) {
  .top-bar {
    padding: 0.75rem 1rem;
  }

  .channel-info-top h2 {
    font-size: 1rem;
  }

  .channel-info-top span {
    font-size: 0.8rem;
  }

  .bottom-bar {
    padding: 0.6rem 1rem 0.8rem;
  }

  .progress-bar {
    margin-bottom: 0.7rem;
  }

  .video-controls {
    gap: 0.5rem;
  }

  .controls-left,
  .controls-right {
    gap: 0.4rem;
  }

  .control-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
  }

  .control-btn svg {
    width: 15px;
    height: 15px;
  }

  #favBtn .fav-icon {
    width: 20px;
    height: 20px;
  }

  .control-btn-pill {
    min-width: 55px;
    padding: 0 0.75rem;
    font-size: 0.75rem;
  }

  /* SHOW volume in landscape - more horizontal space */
  .volume-control {
    display: flex;
    padding: 0 0.6rem;
    height: 38px;
  }

  .volume-control .control-btn {
    width: 32px;
    min-width: 32px;
    height: 32px;
  }

  .volume-slider {
    width: 70px;
  }

  .indicator.left {
    left: 1rem;
  }

  .indicator.right {
    right: 1rem;
  }

  .indicator-bar {
    width: 32px;
    height: 110px;
  }
}

/* Fullscreen Mode - ALWAYS SHOW VOLUME */
.video-container:fullscreen .volume-control,
.video-container:-webkit-full-screen .volume-control,
.video-container:-moz-full-screen .volume-control,
.video-container:-ms-fullscreen .volume-control {
  display: flex !important;
}

/* PLAYER FAVORITES OVERLAY - MODERN GLASS */
.player-fav-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  background: rgba(10, 10, 12, 0.7);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.player-fav-overlay.show {
  transform: translateX(0);
}

.player-fav-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.player-fav-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: white;
  margin: 0;
}

.player-fav-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.player-fav-list::-webkit-scrollbar {
  width: 4px;
}

.player-fav-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

/* MINI CLOSE BUTTON */
.close-btn-mini {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-btn-mini:hover {
  background: var(--highlight);
  border-color: var(--highlight);
  transform: rotate(90deg);
}

.close-btn-mini svg {
  width: 16px;
  height: 16px;
}

/* FAVORITE ITEM IN PLAYER */
.player-fav-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.player-fav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateX(-4px);
}

.player-fav-item.active {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.2), rgba(236, 72, 153, 0.1));
  border-color: var(--highlight);
}

.player-fav-item img,
.player-fav-item .placeholder {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.05);
}

.player-fav-item .info {
  flex: 1;
  min-width: 0;
}

.player-fav-item .name {
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-fav-item .meta {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 767px) {
  .player-fav-overlay {
    width: 85%;
  }
}