/*
 * Jackrabbit – Video Player Styles
 * Consolidates all video/clip/player, sidebar, play-by-play,
 * drawing overlay, and presentation mode CSS.
 */

/* ============================================
   Video Player Container (vp-*)
   ============================================ */
.vp-wrapper {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--card-border);
}

.vp-video-container {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  position: relative;
}

.vp-video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  background: #000;
}

/* Controls row */
.vp-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.vp-btn-play { font-size: 1.1em; }

.vp-separator {
  width: 1px;
  height: 1.5em;
  background: var(--border-color);
  margin: 0 0.25rem;
}

.vp-time {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.vp-time-current { min-width: 7em; }
.vp-time-inout { color: var(--primary); font-weight: 500; }

/* Timeline scrubber */
.vp-timeline {
  width: 100%;
  margin-top: 0.5rem;
  accent-color: var(--primary);
  height: 6px;
  cursor: pointer;
  border: none;
  outline: none;
}

/* Mark in/out highlights */
.vp-controls .highlight-in  { box-shadow: 0 0 6px 2px rgba(5, 150, 105, 0.5); border-color: var(--btn-success-bg); }
.vp-controls .highlight-out { box-shadow: 0 0 6px 2px rgba(var(--danger-rgb), 0.5); border-color: var(--danger); }

/* Fullscreen */
.vp-wrapper:fullscreen,
.vp-wrapper:-webkit-full-screen {
  background: #000;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.vp-wrapper:fullscreen .vp-video { max-height: 85vh; width: 100%; object-fit: contain; }
.vp-wrapper:fullscreen .vp-controls { background: rgba(28, 25, 23, 0.85); margin-top: 0; padding: 0.5rem 1rem; }
.vp-wrapper:fullscreen .vp-timeline { margin-top: 0; }

/* ============================================
   Video Player Layout (sidebar + main)
   ============================================ */
.vp-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1rem 0;
  max-width: 100%;
}
.vp-layout-main { flex: 1; min-width: 0; }

.vp-sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

.vp-sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.vp-sidebar-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.vp-sidebar-body { overflow-y: auto; flex: 1; padding: 0.5rem; }

/* ============================================
   Clip List Items
   ============================================ */
.vp-clip-item {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 4px solid transparent;
}
.vp-clip-item:hover { background: var(--bg-tertiary); transform: translateX(2px); }
.vp-clip-item.active { background: var(--primary-light); box-shadow: var(--shadow-md); }
html.dark-mode .vp-clip-item.active { background: var(--primary-transparent); }

.vp-clip-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.vp-clip-team { font-weight: 600; font-size: 0.95rem; }
.vp-clip-time { font-size: 0.85rem; color: var(--text-muted); font-family: monospace; }
.vp-clip-info { display: flex; flex-direction: column; gap: 0.25rem; }
.vp-clip-state { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--text-color); }
.vp-clip-half, .vp-clip-down, .vp-clip-distance { font-weight: 500; }
.vp-clip-separator { color: var(--text-muted); font-size: 0.8rem; }
.vp-clip-play-name { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.25rem; }
.vp-clip-result { font-size: 0.85rem; font-weight: 500; }
.vp-clip-score-badge {
  display: inline-block;
  padding: 0.15em 0.5em;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--btn-primary-text);
}

/* Expanded play card in active clip */
.vp-clip-playcard { display: none; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border-color); }
.vp-clip-item.active .vp-clip-playcard { display: block; }
.vp-clip-playcard svg { width: 100%; height: auto; max-height: 200px; }

/* Clip play card (inline) */
.clip-play-card { padding: 0.5rem; border-top: 1px solid var(--border-color); background: var(--bg-secondary); }
.clip-play-diagram { text-align: center; }
.clip-play-diagram svg { max-width: 100%; height: auto; display: block; }

/* ============================================
   Play-by-Play
   ============================================ */

/* Desktop situation header (top of sidebar) */
.pbp-situation { padding: 0.75rem 1rem; background: var(--bg-secondary); border-bottom: 1px solid var(--border-color); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.pbp-possession { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.35rem; font-size: 0.85rem; font-weight: 600; color: var(--text-color); }
.pbp-team-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pbp-details { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: var(--text-muted); flex-wrap: wrap; }
.pbp-down-distance { font-weight: 600; color: var(--text-color); }
.pbp-separator { color: var(--text-muted); opacity: 0.5; }
.pbp-score { font-weight: 600; }
.pbp-score-active { text-decoration: underline; text-underline-offset: 2px; }
.pbp-score-dash { color: var(--text-muted); }
.pbp-half { font-style: italic; }

/* Mobile situation section */
.pbp-mobile-section { display: none; }
.pbp-mobile-bar { display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.75rem; background: var(--bg-secondary); border-radius: var(--radius-md); font-size: 0.8rem; font-weight: 500; flex-wrap: wrap; }
.pbp-mob-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pbp-mobile-play-card { margin-top: 0.5rem; }
.pbp-mobile-diagram { background: var(--card-bg); border-radius: var(--radius-md); padding: 0.5rem; border: 1px solid var(--border-color); }
.pbp-mobile-play-name { font-size: 0.85rem; font-weight: 600; text-align: center; margin-top: 0.35rem; }
.pbp-card-formation { font-size: 0.75rem; color: var(--text-muted); font-style: italic; padding: 0.25rem 0.5rem; }

/* Mobile play navigator (prev / current / next) */
.pbp-mobile-play-nav { display: flex; align-items: stretch; gap: 0.35rem; margin-top: 0.5rem; }
.pbp-play-nav-card { flex: 1; min-width: 0; padding: 0.35rem 0.5rem; background: var(--bg-secondary); border-radius: var(--radius-md); cursor: pointer; font-size: 0.7rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: background 0.15s, box-shadow 0.15s; display: flex; align-items: center; gap: 0.25rem; }
.pbp-play-nav-card:hover:not(.disabled) { background: var(--bg-tertiary); }
.pbp-play-nav-card.prev { justify-content: flex-start; }
.pbp-play-nav-card.next { justify-content: flex-end; text-align: right; }
.pbp-play-nav-card.current { flex: 2; background: var(--primary-light); color: var(--text-color); font-weight: 600; font-size: 0.8rem; white-space: normal; cursor: default; justify-content: center; text-align: center; border: 1px solid var(--primary); padding: 0.5rem; }
html.dark-mode .pbp-play-nav-card.current { background: var(--primary-transparent); }
.pbp-play-nav-card.disabled { opacity: 0.3; cursor: default; }
.pbp-play-nav-arrow { flex-shrink: 0; font-size: 0.85rem; }
.pbp-play-nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

@media (max-width: 1024px) {
  .pbp-mobile-section { display: block; margin-top: 0.5rem; }
  .game-video-main { position: sticky; top: 0; z-index: 10; background: var(--bg-primary); padding-bottom: 0.25rem; }
  .game-video-sidebar { max-height: none; }
  .game-video-clip-list { max-height: 50vh; overflow-y: auto; }
}
@media (min-width: 1025px) { .pbp-mobile-section { display: none; } }

/* ============================================
   Drawing Overlay
   ============================================ */
.drawing-overlay-canvas {
  position: absolute;
  top: 0; left: 0;
  z-index: 10;
  cursor: crosshair;
  touch-action: none;
}

.drawing-toolbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.6rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.drawing-tool-btn {
  width: 2rem; height: 2rem;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  cursor: pointer;
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.drawing-tool-btn:hover { border-color: var(--primary); }
.drawing-tool-btn.active { border-color: var(--primary); box-shadow: 0 0 6px var(--primary); }

.drawing-tool-btn svg {
  pointer-events: none;
}

.drawing-color-swatch {
  width: 1.5rem; height: 1.5rem;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.drawing-color-swatch:hover { transform: scale(1.15); }
.drawing-color-swatch.active { border-color: var(--primary); box-shadow: 0 0 4px var(--primary); }

.drawing-toolbar-sep { width: 1px; height: 1.5rem; background: var(--border-color); margin: 0 0.25rem; }

/* ============================================
   Presentation Mode
   ============================================ */
.presentation-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
}
.presentation-toolbar-title { font-weight: 600; color: var(--text-color); margin-left: 0.5rem; }

.presentation-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  padding: 1rem 0;
}
.presentation-video-panel { flex: 3; min-width: 0; }
.presentation-play-panel {
  flex: 2;
  min-width: 280px;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--card-border);
  padding: 1rem;
  max-height: 80vh;
  overflow-y: auto;
}

.pres-section { margin-bottom: 0.75rem; }
.pres-label { display: block; font-weight: 600; font-size: 0.85rem; color: var(--text-color); margin-bottom: 0.35rem; }
.pres-play-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 0.35rem;
}
.pres-play-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.4rem 0.6rem; cursor: pointer;
  font-size: 0.85rem; transition: background 0.15s;
  border-bottom: 1px solid var(--border-color);
}
.pres-play-item:last-child { border-bottom: none; }
.pres-play-item:hover { background: var(--bg-secondary); }
.pres-play-item.active { background: var(--primary-light); }
html.dark-mode .pres-play-item.active { background: var(--primary-transparent); }
.pres-play-icon { font-size: 1rem; }
.pres-play-name { font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pres-play-formation { font-size: 0.75rem; color: var(--text-muted); font-style: italic; }
.pres-no-plays { padding: 0.75rem; color: var(--text-muted); font-size: 0.85rem; text-align: center; }
.pres-editor-container { min-height: 300px; background: var(--bg-secondary); border-radius: var(--radius-md); overflow: hidden; }

.sidebar-header-actions { display: flex; align-items: center; gap: 0.25rem; }

/* ============================================
   Legacy video player aliases
   ============================================ */
.video-player-container { width: 100%; max-width: 900px; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-lg); padding: var(--spacing-lg); box-shadow: var(--shadow-md); margin: 0 auto var(--spacing-xl) auto; box-sizing: border-box; }
.video-controls { display: flex; align-items: center; gap: var(--spacing-md); margin-top: var(--spacing-sm); flex-wrap: wrap; }
.video-control-btn { font-size: 1.1em; border: none; outline: none; }
.video-play-pause { font-size: 1.2em; }
.video-time-display { color: var(--text-color); font-family: monospace; font-size: 0.9em; font-weight: 500; margin-left: var(--spacing-xs); }
.video-timeline { width: 100%; margin-top: var(--spacing-sm); accent-color: var(--primary); border: none; outline: none; }

/* Legacy game-video layout aliases */
.game-video-player-layout { display: flex; gap: 1.5rem; align-items: flex-start; padding: 1rem 0; }
.game-video-main { flex: 1; min-width: 0; }
.game-video-player-container { background: var(--card-bg); border-radius: var(--radius-lg); padding: 1rem; box-shadow: var(--card-shadow); border: 1px solid var(--card-border); }
#game-video-container { width: 100%; border-radius: var(--radius-md); overflow: hidden; background: #000; position: relative; }
#game-video-container video { width: 100%; height: auto; display: block; }
.game-video-controls { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-top: 1rem; padding: 0.5rem; background: var(--bg-secondary); border-radius: var(--radius-md); }
.game-video-sidebar { width: 320px; min-width: 320px; background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--card-shadow); border: 1px solid var(--card-border); display: flex; flex-direction: column; max-height: 80vh; }
.game-video-sidebar-header { padding: 1rem; border-bottom: 1px solid var(--border-color); background: var(--bg-secondary); border-radius: var(--radius-lg) var(--radius-lg) 0 0; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.game-video-sidebar-header h3 { margin: 0; font-size: 1rem; font-weight: 600; flex: 1; }
.game-video-clip-list { overflow-y: auto; flex: 1; padding: 0.5rem; }
.game-clip-item { padding: 0.75rem; margin-bottom: 0.5rem; background: var(--bg-secondary); border-radius: var(--radius-md); cursor: pointer; transition: all 0.15s; border-left: 4px solid transparent; }
.game-clip-item:hover { background: var(--bg-tertiary); transform: translateX(2px); }
.game-clip-item.active { background: var(--primary-light); box-shadow: var(--shadow-md); }
html.dark-mode .game-clip-item.active { background: var(--primary-transparent); }
.game-clip-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.game-clip-team { font-weight: 600; font-size: 0.95rem; }
.game-clip-time { font-size: 0.85rem; color: var(--text-muted); font-family: monospace; }
.game-clip-info { display: flex; flex-direction: column; gap: 0.25rem; }
.game-clip-state { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--text-color); }
.game-clip-half, .game-clip-down, .game-clip-distance { font-weight: 500; }
.game-clip-separator { color: var(--text-muted); font-size: 0.8rem; }

/* Clip list (shared partial) */
.clip-list { display: flex; flex-direction: column; gap: 0; padding: var(--spacing-sm); }
.clip-list-item {
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.9rem;
}
.clip-list-item:first-child { border-top: 1px solid var(--card-border); }
.clip-list-item:hover { background: var(--bg-secondary); }
.clip-list-item .clip-team { font-weight: 600; }
.clip-list-item .clip-time { font-family: monospace; font-weight: 500; color: var(--text-muted); }
.empty-clip-message { text-align: center; padding: var(--spacing-xl); color: var(--text-muted); }

/* #clip-list-column legacy */
#clip-list-column { background: var(--player-bg); }
#clip-list-column li { background: var(--clip-bg); cursor: pointer; }
#clip-list-column li a { color: inherit; text-decoration: none; display: block; width: 100%; height: 100%; }
#clip-list-column li:hover { box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.53); background: var(--bg-tertiary); }
html.dark-mode #clip-list-column li:hover { background: var(--bg-tertiary); box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.8); }

/* Play autocomplete suggestions (video tagging) */
.play-suggestions {
  position: absolute;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  width: 100%;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  top: 100%;
  margin-top: 4px;
}
.play-suggestion-item {
  padding: 8px; cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  display: flex; gap: 12px; align-items: center;
  color: var(--text-color);
}
.play-suggestion-item:last-child { border-bottom: none; }
.play-suggestion-item:hover { background: var(--bg-secondary); }
.play-suggestion-preview { width: 80px; height: 80px; flex-shrink: 0; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--bg-secondary); }
.play-suggestion-info { flex: 1; }
.play-suggestion-name { font-weight: bold; margin-bottom: 4px; }
.play-suggestion-meta { font-size: 0.85em; color: var(--text-muted); }

/* Clip metadata form extras */
.clip-formation-name { font-weight: 600; color: var(--text-muted); }
.modal-form-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.modal-play-diagram { text-align: center; padding: 0.5rem; background: var(--bg-secondary); border-radius: var(--radius-sm); border: 1px solid var(--border-color); }
.modal-play-diagram svg { width: 200px; height: 150px; display: block; margin: 0 auto; }

/* Keyboard shortcuts modal */
.shortcuts-modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center; justify-content: center;
}
.shortcuts-modal-content { background: var(--card-bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); max-width: 400px; width: 90%; border: 1px solid var(--card-border); }
.shortcuts-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-color); }
.shortcuts-modal-header h3 { margin: 0; font-size: 1.25rem; }
.shortcuts-modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; }
.shortcut-item { display: flex; align-items: center; gap: 1rem; padding: 0.5rem; border-radius: var(--radius-md); background: var(--bg-secondary); }
.shortcut-item kbd { display: inline-block; padding: 0.25rem 0.75rem; font-family: monospace; font-size: 0.9rem; font-weight: 600; background: var(--bg-primary); border: 2px solid var(--border-color); border-radius: var(--radius-sm); box-shadow: 0 2px 0 var(--border-color); min-width: 3rem; text-align: center; }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
  .vp-layout, .game-video-player-layout, .presentation-layout { flex-direction: column; }
  .vp-sidebar, .game-video-sidebar { width: 100%; min-width: 0; max-height: none; }
  .presentation-play-panel { max-height: none; }
}

@media (max-width: 768px) {
  .vp-layout, .game-video-player-layout { padding: 0.5rem 0; }
  .vp-wrapper, .game-video-player-container { padding: 0.5rem; border-radius: var(--radius-md); }
  .vp-controls, .game-video-controls { gap: 0.25rem; padding: 0.25rem 0.5rem; }
  .vp-controls .icon-btn { width: 2rem; height: 2rem; font-size: 0.9em; min-width: 44px; min-height: 44px; }
  .vp-time { font-size: 0.8rem; margin-left: 0; width: 100%; justify-content: center; margin-top: 0.25rem; }
  .vp-separator { display: none; }
  .vp-sidebar, .game-video-sidebar { max-height: none; }
  .game-video-clip-list { max-height: 40vh; }
  .vp-clip-item, .game-clip-item { padding: 0.5rem; }
  .vp-sidebar .vp-clip-playcard { display: none !important; }
  .vp-sidebar .pbp-situation { display: none; }
  .presentation-layout { padding: 0.5rem 0; }
  .pres-play-list { max-height: 150px; }
  .pres-editor-container { min-height: 200px; }
  .clip-list-item { padding: var(--spacing-xs) var(--spacing-sm); font-size: 0.85rem; }
}
