/* Reset and base styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: #000;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Splash screen */
.vp-splash {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: #000;
}

.vp-splash img {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
}

/* Main wrapper */
.vp-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #000;
  position: relative;
}

.vp-video-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vp-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.vp-video-placeholder {
  display: none;
}

/* Poster overlay */
.vp-poster {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.vp-poster[hidden] {
  display: none;
}

.vp-poster img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Big play button */
.vp-big-play {
  position: absolute;
  top: 75%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 68px;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  z-index: 10;
}

.vp-big-play:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: translate(-50%, -50%) scale(1.08);
}

.vp-big-play:active {
  transform: translate(-50%, -50%) scale(0.95);
}

.vp-big-play[hidden] {
  display: none;
}

/* Duration overlay */
.vp-duration {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  z-index: 5;
}

/* Percent viewed overlay */
.vp-percent {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  z-index: 5;
}

/* Loading spinner */
.vp-loading {
  position: absolute;
  top: 75%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
}

.vp-loading[hidden] {
  display: none;
}

.vp-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: vp-spin 0.8s linear infinite;
}

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

/* Controls bar */
.vp-controls {
  display: flex;
  align-items: center;
  height: 24px;
  padding: 0 6px;
  gap: 6px;
  flex-shrink: 0;
}

.vp-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.15s ease, opacity 0.15s ease;
}

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

.vp-btn:active {
  background: rgba(255, 255, 255, 0.2);
}

.vp-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.vp-btn:disabled:hover {
  background: none;
}

.vp-btn svg {
  display: block;
}

.vp-btn svg[hidden],
.i-play[hidden],
.i-pause[hidden],
.i-vol[hidden],
.i-muted[hidden] {
  display: none;
}

/* Progress bar */
.vp-progress {
  flex: 1;
  height: 4px;
  background: #444;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.vp-progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #666;
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

.vp-progress-played {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: #AAC2E0;
  border-radius: 2px;
  width: 0%;
  z-index: 1;
  transition: width 0.1s linear;
}

/* Unplayed segments (red highlights) */
.vp-unplayed {
  position: absolute;
  top: 0;
  height: 100%;
  background: rgba(255, 0, 0, 0.4);
  pointer-events: none;
  border-radius: 2px;
  z-index: 2;
}

/* Time display */
.vp-time {
  font-size: 11px;
  min-width: 80px;
  text-align: center;
  user-select: none;
}

/* Speed control */
.vp-speed {
  position: relative;
}

.vp-speed-btn {
  font-size: 12px;
  min-width: 36px;
  font-weight: 500;
}

.vp-speed-menu {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 6px;
  padding: 4px 0;
  margin-bottom: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 100;
  min-width: 60px;
}

.vp-speed-option {
  display: block;
  width: 100%;
  padding: 8px 16px;
  background: none;
  border: none;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s ease;
}

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

.vp-speed-option.active {
  color: #AAC2E0 !important;
}

/* Error display */
.vp-error {
  margin: 2rem;
  padding: 1.5rem;
  background: #ffe5e5;
  color: #a33;
  border-radius: 8px;
  text-align: center;
}

.vp-error h3 {
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.vp-error p {
  font-size: 0.95rem;
  opacity: 0.9;
}

/* Fullscreen styles */
.vp-wrapper:fullscreen {
  width: 100%;
  height: 100%;
}

.vp-wrapper:fullscreen .vp-video-area {
  flex: 1;
}

.vp-wrapper:fullscreen .vp-controls {
  display: none;
}

.vp-wrapper:-webkit-full-screen .vp-controls {
  display: none;
}

/* Touch device optimizations */
@media (hover: none) {
  .vp-btn:hover {
    background: none;
  }

  .vp-btn:active {
    background: rgba(255, 255, 255, 0.2);
  }

  .vp-progress {
    height: 8px;
  }
}
