/* video.css — Video container, player, portrait mode, speed/volume/play controls */

#video-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#main-content {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: center;
}

#right-column {
  width: 0;
  min-width: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 20px);
  overflow: hidden;
  opacity: 0;
  transition: min-width 0.4s ease, width 0.4s ease, opacity 0.3s ease 0.15s;
}

#main-content.has-shot-log #right-column {
  width: 280px;
  min-width: 280px;
  opacity: 1;
}

@media (max-width: 1100px) {
  #left-column {
    flex: 0 1 800px;
  }

  #main-content.has-shot-log #right-column {
    width: 240px;
    min-width: 240px;
  }

  #shot-log-table th:nth-child(1),
  #shot-log-table td:nth-child(1) {
    padding-left: 0.4rem;
  }

  #shot-log-table th:nth-child(2),
  #shot-log-table td:nth-child(2),
  #shot-log-table th:nth-child(3),
  #shot-log-table td:nth-child(3) {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }
}

@media (max-width: 900px) {
  #left-column {
    flex: 0 1 700px;
  }

  #main-content.has-shot-log #right-column {
    width: 200px;
    min-width: 200px;
  }

  #shot-log-table th:nth-child(2),
  #shot-log-table td:nth-child(2) {
    display: none;
  }

  #shot-log-table th:nth-child(1),
  #shot-log-table td:nth-child(1) {
    padding-left: 0.25rem;
  }
}

#right-column #shot-log {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  max-height: none;
}

@media (max-width: 768px) {
  #main-content {
    flex-direction: column;
  }

  #right-column {
    width: 100%;
  }
}

#video-container {
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  max-height: 60vh;
  margin-bottom: calc(-1rem + 10px);
  border: 1px solid var(--border);
  position: relative;
}

#video-player {
  display: block;
  width: 100%;
  max-height: 760px;
}

#preview-overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  display: none;
}

/* Portrait video — overflow visible so controls can float outside */
#video-container.portrait-video {
  overflow: visible;
  border: none;
  background: transparent;
}

#video-container.portrait-video #video-player {
  border-radius: 10px;
  border: 1px solid var(--border);
}

#video-container.portrait-video #play-pause-btn {
  left: auto;
  right: calc(100% + 8px);
  bottom: 0px;
}

#video-container.portrait-video #stage-actions.video-overlay {
  left: auto;
  right: calc(100% + 8px);
  bottom: 0;
  align-items: flex-end;
}

#video-container.portrait-video #speed-overlay {
  left: calc(100% + 8px);
  right: auto;
  top: 0;
  align-items: flex-start;
}

#video-container.portrait-video #volume-overlay {
  right: auto;
  left: calc(100% + 8px);
  bottom: 0;
}

/* Play/Pause Button */

#play-pause-btn {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 10;
  width: 39px;
  height: 39px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#play-pause-btn:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

/* Speed Controls */

#speed-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

#speed-btn {
  width: 39px;
  height: 39px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

#speed-btn svg {
  display: block;
  width: 21px;
  height: 21px;
}

#speed-overlay:hover #speed-btn {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

#speed-bubble {
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-top: none;
  font-size: 0.8rem;
  font-weight: 400;
  padding: 2px 0;
  border-radius: 0 0 7px 7px;
  margin-top: -1px;
  line-height: 1.2;
  white-space: nowrap;
  width: 39px;
  text-align: center;
}

#speed-overlay:hover #speed-bubble {
  display: none;
}

#speed-btn.has-bubble {
  border-radius: 7px 7px 0 0;
  border-bottom-color: transparent;
}

#speed-overlay:hover #speed-btn.has-bubble {
  border-radius: 7px;
  border-bottom-color: var(--text-muted);
}

#speed-dropdown {
  display: none;
  flex-direction: column;
  padding-top: 4px;
  min-width: 64px;
}

#speed-overlay:hover #speed-dropdown {
  display: flex;
}

#speed-dropdown-inner {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
}

.speed-option {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.1s, color 0.1s;
}

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

.speed-option.speed-active {
  color: var(--accent);
  font-weight: 600;
}

/* Volume Controls */

#volume-overlay {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 10;
}

#volume-track {
  width: 39px;
  height: 39px;
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-radius: 7px;
  position: relative;
  cursor: pointer;
  transition: width 0.2s ease;
}

#volume-track::before {
  content: '';
  position: absolute;
  left: -10px;
  right: -10px;
  top: -10px;
  bottom: -10px;
  pointer-events: auto;
  z-index: -1;
}

#volume-overlay:hover #volume-track {
  width: 140px;
}

#volume-bar-bg {
  position: absolute;
  left: 20px;
  right: 25px;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

#volume-bar-fill {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  background: var(--text);
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, width 0.05s ease;
}

#volume-overlay:hover #volume-bar-bg,
#volume-overlay:hover #volume-bar-fill {
  opacity: 1;
}

#volume-btn {
  width: 39px;
  height: 39px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  position: absolute;
  left: 0;
  top: 0;
}

#volume-overlay:hover #volume-btn {
  display: none;
}

#volume-overlay:not(:hover) #volume-btn {
  left: 0 !important;
}

#volume-btn svg {
  display: block;
  width: 18px;
  height: 18px;
}

#volume-handle {
  display: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-hover);
  position: absolute;
  left: 25px;
  top: 50%;
  transform: translateY(-50%);
  cursor: grab;
  pointer-events: auto;
  transition: left 0.05s ease;
  align-items: center;
  justify-content: center;
}

#volume-handle::before {
  content: '';
  position: absolute;
  left: -8px;
  right: -8px;
  top: -8px;
  bottom: -8px;
  pointer-events: auto;
  z-index: -1;
}

#volume-overlay:hover #volume-handle {
  display: flex;
}

#volume-handle:active {
  cursor: grabbing;
}

#handle-icon {
  color: var(--text);
  pointer-events: none;
}

/* Wide-monitor: reclaim wasted horizontal margin once a video is loaded.
   Scoped to large viewports so the responsive shrink rules above are untouched. */
@media (min-width: 1400px) {
  body.has-video main {
    max-width: 1800px;
  }

  body.has-video #left-column {
    flex: 0 1 1280px;
  }

  body.has-video #main-content.has-shot-log #right-column {
    width: 300px;
    min-width: 300px;
  }
}
