/* =========================================================================
   REPLAY PLAYER — Split workspace layout
   =========================================================================
   Left: editorial canvas with playback transport at the bottom.
   Right: student metadata, integrity analysis, and event context.
   Inspired by professional DAW/video-editor chrome. */

/* -- Workspace grid ---------------------------------------------------- */
.replay-workspace {
  display: grid;
  grid-template-columns: 1fr 340px;
  height: calc(100vh - 10rem);
  width: 1200px;
  max-width: 100%;
  margin: 0 auto;
  gap: 1px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-large);
  overflow: hidden;
}

/* -- Left: Canvas ------------------------------------------------------ */
.replay-canvas {
  display: flex;
  flex-direction: column;
  background: var(--md-sys-color-surface-container-lowest);
  min-height: 0;
}
.replay-canvas__header {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 15%, transparent);
}
.replay-canvas__title {
  font: 700 1.5rem/1.3 var(--md-sys-typescale-font-headline);
  color: var(--md-sys-color-on-surface);
  margin: 0;
  letter-spacing: -0.01em;
}
.replay-canvas__subtitle {
  font: italic 400 0.9375rem/1.4 var(--md-sys-typescale-font-body);
  color: var(--md-sys-color-on-surface-variant);
  margin: 0.25rem 0 0;
}
.replay-canvas__actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.replay-canvas__body {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem 3rem;
}
.replay-canvas__editor {
  max-width: 40rem;
  margin: 0 auto;
  pointer-events: none;
  background: transparent !important;
  font: 400 1.125rem/1.75 var(--md-sys-typescale-font-body);
  color: var(--md-sys-color-on-surface);
  white-space: pre-wrap;
  min-height: 40vh;
}

/* -- Transport controls ------------------------------------------------ */
.replay-transport {
  flex-shrink: 0;
  border-top: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 15%, transparent);
  background: var(--md-sys-color-glass);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  backdrop-filter: blur(24px) saturate(140%);
  padding: 0.75rem 2rem 1rem;
}
.replay-transport__scrubber {
  margin-bottom: 0.5rem;
}
.replay-transport__scrubber input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--md-sys-color-surface-container-highest);
  border-radius: var(--md-sys-shape-corner-full);
  transition: height 0.2s ease;
  cursor: pointer;
}
.replay-transport__scrubber input[type="range"]:hover {
  height: 8px;
}
.replay-transport__scrubber input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--md-sys-color-surface-container-lowest);
  box-shadow:
    0 2px 6px -2px rgba(25, 28, 30, 0.08),
    0 0 0 2px var(--md-sys-color-primary);
  cursor: grab;
  transition: transform 0.15s;
}
.replay-transport__scrubber input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--md-sys-color-surface-container-lowest);
  box-shadow:
    0 2px 6px -2px rgba(25, 28, 30, 0.08),
    0 0 0 2px var(--md-sys-color-primary);
  cursor: grab;
}
.replay-transport__scrubber input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.15);
  cursor: grabbing;
}

.replay-transport__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.replay-transport__left,
.replay-transport__right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.replay-transport__play {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.replay-transport__play:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--md-sys-color-primary) 30%, transparent);
}
.replay-transport__play:active {
  transform: scale(0.95);
}

.replay-transport__speed {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--md-sys-color-surface-container-low);
  padding: 0.25rem 0.625rem;
  border-radius: var(--md-sys-shape-corner-medium);
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 20%, transparent);
}
.replay-transport__speed-label {
  font: 700 0.625rem/1 var(--md-sys-typescale-font-label);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--md-sys-color-on-surface-variant);
}
.replay-transport__speed select {
  background: transparent;
  color: var(--md-sys-color-primary);
  border: none;
  font: 700 0.8125rem/1 var(--md-sys-typescale-font-label);
  cursor: pointer;
  padding: 0;
}

.replay-transport__time {
  font: 700 0.875rem/1 var(--md-sys-typescale-font-mono, monospace);
  color: var(--md-sys-color-primary);
}

.replay-transport__progress {
  font: 500 0.75rem/1 var(--md-sys-typescale-font-label);
  color: var(--md-sys-color-on-surface-variant);
}

.replay-transport__preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  font: 500 0.8125rem/1 var(--md-sys-typescale-font-label);
  color: var(--md-sys-color-on-surface-variant);
}

/* -- Right: Sidebar ---------------------------------------------------- */
.replay-sidebar {
  background: var(--md-sys-color-surface-container-low);
  border-left: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 15%, transparent);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Student card */
.replay-sidebar__card {
  padding: 1.25rem;
  background: var(--md-sys-color-surface-container-lowest);
  margin: 1rem;
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.replay-sidebar__student {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.replay-sidebar__avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: color-mix(in srgb, var(--md-sys-color-primary) 8%, var(--md-sys-color-surface));
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 0.875rem/1 var(--md-sys-typescale-font-headline);
  color: var(--md-sys-color-primary);
}
.replay-sidebar__name {
  font: 700 0.9375rem/1.3 var(--md-sys-typescale-font-headline);
  color: var(--md-sys-color-on-surface);
  margin: 0;
}
.replay-sidebar__email {
  font: 400 0.75rem/1.3 var(--md-sys-typescale-font-label);
  color: var(--md-sys-color-on-surface-variant);
  margin: 0;
}
.replay-sidebar__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 12%, transparent);
}
.replay-sidebar__stat-label {
  display: block;
  font: 700 0.5625rem/1 var(--md-sys-typescale-font-label);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 0.25rem;
}
.replay-sidebar__stat-value {
  display: block;
  font: 700 1.125rem/1.3 var(--md-sys-typescale-font-headline);
  color: var(--md-sys-color-primary);
}

/* Integrity score badge */
.replay-sidebar__integrity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--md-sys-shape-corner-large);
  border-left: 4px solid var(--md-sys-color-tertiary);
  background: color-mix(in srgb, var(--md-sys-color-tertiary) 5%, var(--md-sys-color-surface));
  color: var(--md-sys-color-tertiary);
}
.replay-sidebar__integrity--alert {
  border-left-color: var(--md-sys-color-error);
  background: color-mix(in srgb, var(--md-sys-color-error) 5%, var(--md-sys-color-surface));
  color: var(--md-sys-color-error);
}
.replay-sidebar__integrity-label {
  display: block;
  font: 700 0.5625rem/1 var(--md-sys-typescale-font-label);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.replay-sidebar__integrity-value {
  display: block;
  font: 700 1.25rem/1.3 var(--md-sys-typescale-font-headline);
}

/* Analysis signals */
.replay-sidebar__signals,
.replay-sidebar__meta {
  padding: 1rem 1.25rem;
}
.replay-sidebar__section-title {
  font: 700 0.75rem/1 var(--md-sys-typescale-font-headline);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--md-sys-color-on-surface);
  margin: 0 0 0.75rem;
}
.replay-sidebar__signal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0;
  font: 400 0.8125rem/1.4 var(--md-sys-typescale-font-label);
  color: var(--md-sys-color-on-surface-variant);
  border-bottom: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 8%, transparent);
}
.replay-sidebar__signal:last-child {
  border-bottom: none;
}
.replay-sidebar__signal-value {
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
}

.replay-sidebar__tamper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
  font: 600 0.75rem/1.3 var(--md-sys-typescale-font-label);
  border-radius: var(--md-sys-shape-corner-medium);
}
.replay-sidebar__notes {
  margin-top: 0.75rem;
}
.replay-sidebar__note {
  font: 400 0.75rem/1.5 var(--md-sys-typescale-font-label);
  color: var(--md-sys-color-on-surface-variant);
  margin: 0 0 0.25rem;
  padding-left: 0.75rem;
  border-left: 2px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 30%, transparent);
}

/* -- Responsive -------------------------------------------------------- */
@media (max-width: 960px) {
  .replay-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .replay-sidebar {
    border-left: none;
    border-top: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 15%, transparent);
    max-height: 50vh;
  }
  .replay-canvas__body {
    padding: 1.5rem;
  }
}
