/* Base variables and styles */
.wwp-transcript {
  --gap: 15px;
  --bg: #0b0b0b;
  --fg: #e7e7e7;
  --muted: #9aa0a6;
  --accent: #7ac7ff;
  --border-color: #282828;
  --module-bg: #101010;
  width: 100%;
}

/* Main Header */
.wwp-tr-header {
  margin: 0 0 var(--gap) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 38px;
}

.wwp-tr-header h3 {
  margin: 0;
  font: 600 1.1rem/1.2 system-ui, sans-serif;
  color: var(--fg);
}

.wwp-tr-toggle-btn {
  background: #1f1f1f;
  border: 1px solid var(--border-color);
  color: var(--fg);
  cursor: pointer;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

.wwp-tr-toggle-btn:hover {
  background: #2a2a2a;
}

.wwp-tr-toggle-btn svg {
  transition: transform 0.2s ease-in-out;
}

/* Main content layout */
.wwp-tr-content-wrapper {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--gap);
  align-items: stretch; /* This makes the transcript module match the video height */
}

.wwp-tr-player {
  flex: 1 1 65%;
  min-width: 0;
  transition: flex-basis 0.3s ease-in-out;
}

.wwp-tr-player video,
.wwp-tr-player .wwp-tr-vimeo-wrap {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
}

/* Transcript Module */
.wwp-tr-transcript-module {
  flex: 1 1 35%;
  max-width: 400px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  background: var(--module-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: opacity 0.3s, transform 0.3s, min-width 0.3s, max-width 0.3s, padding 0.3s, flex-basis 0.3s;
  opacity: 1;
  transform: translateX(0);
  /* Set a max-height relative to viewport width to approximate video height */
  /* A 16:9 video in a 65% width container has a height of ~36.5vw ( (65 * 9) / 16 ). 40vw gives some leeway. */
  max-height: 40vw;
}

@media (min-width: 1100px) {
  .wwp-tr-transcript-module {
    /* On larger screens, cap the height to a reasonable fixed size, like 420px */
    max-height: 420px;
  }
}


.wwp-tr-search {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

.wwp-tr-search input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #151515;
  color: var(--fg);
}

.wwp-tr-body {
  overflow-y: auto; /* This ensures the scrollbar appears when needed */
  padding: 8px;
  flex-grow: 1; /* This makes the body fill the available vertical space */
  min-height: 0; /* Crucial for allowing the element to shrink and scroll */
}

.wwp-tr-compact .wwp-tr-line {
  padding: 6px 4px;
}

/* Individual transcript line styling */
.wwp-tr-line {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 12px;
  padding: 10px 6px;
  border-radius: 6px;
  color: var(--fg);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 2;
  transition: background-color 0.2s ease-in-out;
}

.wwp-tr-line:hover {
  background: #1f1f1f;
}

/* Enhanced active line highlight */
.wwp-tr-line.active {
  background-color: rgba(122, 199, 255, 0.15); /* Use accent color with opacity */
  outline: 1px solid rgba(122, 199, 255, 0.25);
}
.wwp-tr-line.active .wwp-tr-text {
  color: #fff; /* Make text brighter */
}
.wwp-tr-line.active .wwp-tr-ts {
  color: var(--accent); /* Make timestamp accent color */
}


.wwp-tr-ts {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: 0.85rem;
}

.wwp-tr-text {
  color: var(--fg);
}

/* --- Collapsed State --- */
.wwp-transcript.transcript-closed .wwp-tr-content-wrapper {
  gap: 0; /* Remove the gap to allow the player to go full-width */
}

.wwp-transcript.transcript-closed .wwp-tr-player {
  flex-basis: 100%;
}

.wwp-transcript.transcript-closed .wwp-tr-transcript-module {
  flex-basis: 0;
  min-width: 0;
  max-width: 0;
  opacity: 0;
  padding: 0;
  border: none;
  transform: translateX(20px);
  overflow: hidden;
}

.wwp-transcript.transcript-closed .wwp-tr-toggle-btn svg {
  transform: rotate(180deg);
}

/* --- Responsive styles for smaller screens --- */
@media (max-width: 768px) {
  .wwp-tr-content-wrapper {
    flex-direction: column;
  }

  .wwp-tr-transcript-module {
    max-width: 100%;
    width: 100%;
    min-height: 300px; /* Re-introduce min-height for stacked view */
    max-height: 40vh; /* Use viewport height for max-height in stacked view */
  }
}


