/* ──────────────────── Reset & Base ──────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0f;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.08);
  --text-primary: #f0f0f5;
  --text-secondary: #8a8a9a;
  --text-muted: #55556a;
  --accent: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.35);
  --accent-2: #06b6d4;
  --gradient: linear-gradient(135deg, #8b5cf6, #06b6d4);
  --controls-bg: rgba(10, 10, 18, 0.85);
  --radius: 12px;
  --radius-lg: 20px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

/* ──────────────────── App Layout ──────────────────── */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Background glow blobs */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.3;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: var(--accent);
  top: -150px;
  right: -100px;
  animation: float 12s ease-in-out infinite alternate;
}

.bg-glow-2 {
  width: 400px;
  height: 400px;
  background: var(--accent-2);
  bottom: -100px;
  left: -80px;
  animation: float 15s ease-in-out infinite alternate-reverse;
}

@keyframes float {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(40px, -30px) scale(1.1); }
}

/* ──────────────────── Header ──────────────────── */
.header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  padding: 20px 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

/* ──────────────────── Main ──────────────────── */
.main {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 32px 40px;
}

/* ──────────────────── Drop Zone ──────────────────── */
.drop-zone {
  width: 100%;
  max-width: 680px;
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 56px 44px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: rgba(139, 92, 246, 0.3);
  background: linear-gradient(145deg, rgba(139, 92, 246, 0.06), rgba(6, 182, 212, 0.03));
  transform: scale(1.01);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.drop-zone.drag-over {
  box-shadow: 0 0 40px var(--accent-glow), 0 12px 40px rgba(0, 0, 0, 0.4);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.drop-icon-wrapper {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.drop-zone:hover .drop-icon-wrapper {
  background: rgba(139, 92, 246, 0.14);
  border-color: rgba(139, 92, 246, 0.25);
  transform: scale(1.05);
}

.drop-icon {
  width: 32px;
  height: 32px;
  color: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent-glow));
}

.drop-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.drop-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.drop-hint {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 2px;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}

.browse-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 28px;
  background: var(--gradient);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.browse-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.browse-btn:active {
  transform: translateY(0) scale(0.98);
}

/* ──────────────────── Player Container ──────────────────── */
.player-container {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeInUp 0.5s ease both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.player-wrapper {
  position: relative;
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px var(--accent-glow);
  aspect-ratio: 16 / 9;
}

/* Hidden video element — must remain "visible" for WebGL texture decoding */
#videoPlayer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ──────────────────── VR Canvas ──────────────────── */
.vr-canvas {
  position: absolute;
  inset: 0;
  cursor: grab;
  z-index: 1;
}

.vr-canvas:active {
  cursor: grabbing;
}

.vr-canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ──────────────────── Drag Hint ──────────────────── */
.drag-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 999px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.8s ease;
}

.drag-hint.fade-out {
  opacity: 0;
}

/* ──────────────────── Play/Pause Indicator ──────────────────── */
.play-pause-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.7);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
}

.play-pause-indicator.show {
  animation: indicatorPop 0.6s ease forwards;
}

@keyframes indicatorPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  30%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
}

.play-pause-indicator svg {
  width: 28px;
  height: 28px;
  color: #fff;
}

/* ──────────────────── Controls ──────────────────── */
.controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 0 16px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 100%);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s, transform 0.3s;
}

.player-wrapper:hover .controls,
.player-wrapper.controls-visible .controls {
  opacity: 1;
  transform: translateY(0);
}

/* ──────────────────── Progress Bar ──────────────────── */
.progress-container {
  position: relative;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  cursor: pointer;
  touch-action: none;
  margin-bottom: 10px;
  transition: height var(--transition);
}

.progress-container:hover {
  height: 7px;
}

.progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  pointer-events: none;
}

.progress-filled {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--gradient);
  border-radius: 999px;
  pointer-events: none;
}

.progress-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
  box-shadow: 0 0 8px var(--accent-glow);
}

.progress-container:hover .progress-thumb {
  opacity: 1;
}

.progress-tooltip {
  position: absolute;
  bottom: 20px;
  background: var(--controls-bg);
  color: var(--text-primary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.progress-container:hover .progress-tooltip {
  opacity: 1;
}

/* ──────────────────── Controls Row ──────────────────── */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.control-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

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

.control-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--accent);
}

/* ──────────────────── VR Badge ──────────────────── */
.vr-badge {
  display: flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--gradient);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ──────────────────── Enter VR Button ──────────────────── */
.vr-button-container {
  display: flex;
  align-items: center;
}

.enter-vr-btn {
  width: 40px;
  height: 38px;
  position: relative;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.enter-vr-btn svg {
  width: 22px;
  height: 22px;
}

.enter-vr-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.enter-vr-btn.vr-active {
  background: rgba(139, 92, 246, 0.25);
  color: #8b5cf6;
  box-shadow: 0 0 16px var(--accent-glow);
  animation: vrPulse 2s ease-in-out infinite;
}

.enter-vr-btn.vr-disabled {
  color: var(--text-muted);
  cursor: pointer;
}

.enter-vr-btn.vr-disabled:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
}

@keyframes vrPulse {
  0%, 100% { box-shadow: 0 0 8px var(--accent-glow); }
  50%      { box-shadow: 0 0 20px var(--accent-glow), 0 0 40px rgba(139, 92, 246, 0.15); }
}

/* ──────────────────── Volume ──────────────────── */
.volume-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.volume-slider {
  width: 0;
  opacity: 0;
  transition: width 0.3s, opacity 0.3s;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

.volume-group:hover .volume-slider {
  width: 80px;
  opacity: 1;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
}

.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

/* ──────────────────── Time Display ──────────────────── */
.time-display {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  margin-left: 8px;
  white-space: nowrap;
}

/* ──────────────────── Video Info ──────────────────── */
.video-info {
  padding: 0 4px;
}

.video-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ──────────────────── Utilities ──────────────────── */
.hidden {
  display: none !important;
}

/* ──────────────────── Fullscreen ──────────────────── */
.player-wrapper:fullscreen,
.player-wrapper:-webkit-full-screen {
  border-radius: 0;
}

.player-wrapper:fullscreen .controls,
.player-wrapper:-webkit-full-screen .controls {
  padding: 0 24px 20px;
}

/* ──────────────────── Responsive ──────────────────── */
@media (max-width: 640px) {
  .header {
    padding: 16px 20px;
  }

  .main {
    padding: 0 16px 24px;
  }

  .drop-zone {
    padding: 48px 24px;
  }

  .drop-title {
    font-size: 1.2rem;
  }

  .player-container {
    max-width: 100%;
  }

  .control-btn {
    width: 34px;
    height: 34px;
  }

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

  .vr-badge {
    font-size: 0.6rem;
    padding: 3px 8px;
  }
}

/* ──────────────────── URL Input (Premium Redesign) ──────────────────── */
.url-input-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 520px;
  margin-top: 28px;
}

.url-divider {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 16px;
}

.url-divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.url-divider-line:first-child {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1));
}

.url-divider-line:last-child {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), transparent);
}

.url-divider-text {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.url-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 5px 5px 5px 14px;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.url-input-wrapper:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}

.url-input-wrapper:focus-within {
  border-color: rgba(139, 92, 246, 0.5);
  background: rgba(139, 92, 246, 0.03);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1), 0 0 20px rgba(139, 92, 246, 0.12);
}

.url-input-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
}

.url-input-wrapper:focus-within .url-input-icon {
  color: var(--accent);
  background: rgba(139, 92, 246, 0.1);
}

.url-input-icon svg {
  width: 16px;
  height: 16px;
}

.url-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 10px 12px;
  min-width: 0;
}

.url-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.play-url-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  background: var(--gradient);
  color: #fff;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
  box-shadow: 0 2px 10px var(--accent-glow);
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

.play-url-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.play-url-btn:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 18px var(--accent-glow);
  filter: brightness(1.1);
}

.play-url-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 1px 6px var(--accent-glow);
}
