/**
 * NELB Video Player - Modern CSS Styles
 * Lightweight, responsive, dark theme
 */

/* Base container */
.nelb-player {
  position: relative;
  width: 100%;
  background: #000;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

.nelb-player * {
  box-sizing: border-box;
}

/* Video element */
.nelb-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* Poster overlay */
.nelb-poster {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  background-color: #000;
  z-index: 5;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.nelb-poster.nelb-hidden {
  opacity: 0;
  pointer-events: none;
}

/* Big play button */
.nelb-big-play {
  width: 80px;
  height: 80px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.nelb-big-play:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.5);
}

.nelb-big-play svg {
  width: 36px;
  height: 36px;
  fill: currentColor;
  margin-left: 4px;
}

/* Loading spinner */
.nelb-loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.2s ease;
}

.nelb-loader.active {
  opacity: 1;
}

.nelb-loader svg {
  width: 100%;
  height: 100%;
}

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

.nelb-spin {
  animation: nelb-spin 1s linear infinite;
}

/* Gradient overlay for controls */
.nelb-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 150px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 8;
}

.nelb-player.nelb-controls-visible .nelb-gradient,
.nelb-player:not(.nelb-playing) .nelb-gradient {
  opacity: 1;
}

/* Controls container */
.nelb-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 12px 12px;
  z-index: 15;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.nelb-player.nelb-controls-visible .nelb-controls,
.nelb-player:not(.nelb-playing) .nelb-controls {
  opacity: 1;
  transform: translateY(0);
}

/* Progress bar */
.nelb-progress-container {
  position: relative;
  height: 20px;
  padding: 8px 0;
  cursor: pointer;
  margin-bottom: 8px;
}

.nelb-progress-bar {
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: visible;
  transition: height 0.15s ease;
}

.nelb-progress-container:hover .nelb-progress-bar {
  height: 6px;
}

.nelb-progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  transition: width 0.1s ease;
}

.nelb-progress-played {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #e50914;
  border-radius: 2px;
  transition: width 0.05s linear;
}

.nelb-progress-handle {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background: #e50914;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.nelb-progress-container:hover .nelb-progress-handle {
  transform: translate(-50%, -50%) scale(1);
}

/* Progress tooltip */
.nelb-progress-tooltip {
  position: absolute;
  bottom: 100%;
  left: 0;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  margin-bottom: 8px;
}

.nelb-progress-tooltip.active {
  opacity: 1;
}

/* Controls row */
.nelb-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nelb-controls-left,
.nelb-controls-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Control buttons */
.nelb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.nelb-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

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

.nelb-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.nelb-speed-btn {
  width: auto;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

/* Volume container */
.nelb-volume-container {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nelb-volume-slider {
  width: 0;
  overflow: hidden;
  transition: width 0.2s ease;
}

.nelb-volume-container:hover .nelb-volume-slider {
  width: 80px;
}

.nelb-volume-track {
  position: relative;
  width: 70px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  cursor: pointer;
  margin: 0 5px;
}

.nelb-volume-level {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #fff;
  border-radius: 2px;
  width: 100%;
}

.nelb-volume-handle {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  left: 100%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Time display */
.nelb-time {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 0 8px;
  white-space: nowrap;
}

.nelb-time-separator {
  opacity: 0.6;
}

/* Speed menu */
.nelb-speed-menu {
  position: absolute;
  bottom: 70px;
  right: 12px;
  background: rgba(20, 20, 20, 0.95);
  border-radius: 8px;
  padding: 8px 0;
  min-width: 100px;
  z-index: 20;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.nelb-speed-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nelb-speed-option {
  display: block;
  width: 100%;
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nelb-speed-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nelb-speed-option.active {
  color: #e50914;
  font-weight: 600;
}

/* Seek indicator (double tap) */
.nelb-seek-indicator {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  animation: nelb-seek-fade 0.5s ease forwards;
  z-index: 12;
}

.nelb-seek-backward {
  left: 15%;
}

.nelb-seek-forward {
  right: 15%;
}

.nelb-seek-indicator svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

@keyframes nelb-seek-fade {
  0% { opacity: 1; transform: translateY(-50%) scale(1); }
  100% { opacity: 0; transform: translateY(-50%) scale(1.3); }
}

/* Fullscreen styles */
.nelb-player.nelb-fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
}

.nelb-player.nelb-fullscreen .nelb-video {
  width: 100%;
  height: 100%;
}

.nelb-player.nelb-fullscreen .nelb-controls {
  padding: 0 24px 24px;
}

.nelb-player.nelb-fullscreen .nelb-btn {
  width: 48px;
  height: 48px;
}

.nelb-player.nelb-fullscreen .nelb-btn svg {
  width: 28px;
  height: 28px;
}

.nelb-player.nelb-fullscreen .nelb-time {
  font-size: 15px;
}

/* Mobile styles */
@media (max-width: 640px) {
  .nelb-controls {
    padding: 0 8px 8px;
  }

  .nelb-btn {
    width: 36px;
    height: 36px;
  }

  .nelb-btn svg {
    width: 20px;
    height: 20px;
  }

  .nelb-backward-btn,
  .nelb-forward-btn {
    display: none;
  }

  .nelb-volume-container:hover .nelb-volume-slider {
    width: 60px;
  }

  .nelb-volume-track {
    width: 50px;
  }

  .nelb-time {
    font-size: 12px;
    padding: 0 4px;
  }

  .nelb-big-play {
    width: 64px;
    height: 64px;
  }

  .nelb-big-play svg {
    width: 28px;
    height: 28px;
  }

  .nelb-speed-menu {
    bottom: 60px;
    right: 8px;
  }
}

/* Touch device optimizations */
@media (hover: none) {
  .nelb-volume-slider {
    display: none;
  }

  .nelb-progress-handle {
    transform: translate(-50%, -50%) scale(1);
  }

  .nelb-progress-bar {
    height: 6px;
  }
}

/* Accessibility */
.nelb-player:focus-visible {
  outline: 2px solid #e50914;
  outline-offset: 2px;
}

.nelb-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Hide native controls when custom player is active */
.nelb-video::-webkit-media-controls {
  display: none !important;
}

.nelb-video::-webkit-media-controls-enclosure {
  display: none !important;
}
