/* ===========================================================================
   Shared video-card styles (used by resources.html, ai.html, training.html)
   Cards are rendered from a YouTube playlist by assets/js/youtube-playlist.js.
   =========================================================================== */

.video-card {
  border-radius: 16px;
  overflow: hidden;
  border: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: white;
  /* Fill the column so cards in a row line up despite variable-length titles/descriptions. */
  height: 100%;
  display: flex;
  flex-direction: column;
}
.video-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(37, 99, 235, 0.2);
}
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  flex: 0 0 auto;
}
.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.video-content {
  padding: 24px;
  text-align: center;
  background: white;
  flex: 1 1 auto;
}
.video-content h5 {
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 8px;
  font-size: 18px;
}
.video-content p {
  color: #6b7280;
  font-size: 14px;
  margin: 0;
}
/* Upload date + multi-line description. Scoped with .video-content so they win
   over the generic ".video-content p" rule above. */
.video-content .video-date {
  color: #9aa7b4;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}
.video-content .video-desc {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.5;
  margin: 8px 0 0;
  /* Preserve the description's line breaks (sections/bullets) like YouTube does,
     instead of collapsing them into one paragraph; left-align for readability. */
  white-space: pre-line;
  text-align: left;
  /* Clamp so cards stay uniform; --video-desc-lines lets a page ask for more room. */
  display: -webkit-box;
  -webkit-line-clamp: var(--video-desc-lines, 3);
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Clicking a truncated description (or its "Show more" toggle) expands it to full. */
.video-content .video-desc.expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}
.video-desc-toggle {
  /* Own line + shrink-wrapped click target, centered, so it doesn't sit next to the badge. */
  display: block;
  width: fit-content;
  margin: 10px auto 0;
  color: #2563eb;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.video-desc-toggle:hover {
  text-decoration: underline;
}

/* When a description contains a "Prompt:" marker, the text after it renders as a
   distinct callout (the actual prompt used) — set apart from the explanation. */
.video-prompt {
  margin-top: 14px;
  padding: 12px 14px;
  background: #f0f4ff;
  border-left: 3px solid #2563eb;
  border-radius: 8px;
  text-align: left;
}
.video-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.video-prompt-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #2563eb;
}
.video-prompt-copy {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: #2563eb;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s ease, color 0.15s ease;
}
.video-prompt-copy:hover {
  background: rgba(37, 99, 235, 0.12);
}
.video-prompt-copy.copied {
  color: #16a34a;
}
.video-prompt-text {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  color: #1f2937;
  white-space: pre-wrap;
  word-break: break-word;
  /* Cap the height so a long prompt scrolls instead of blowing up the card. */
  max-height: 150px;
  overflow-y: auto;
  padding-right: 4px;
}
.video-badge {
  display: inline-block;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: white;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 12px;
}
.video-episode {
  display: inline-block;
  background: linear-gradient(135deg, #1a1a1a 0%, #374151 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

/* Type-to-filter search box (rendered above the grid when search: true) */
.video-search {
  position: relative;
  max-width: 520px;
  margin: 0 auto 36px;
}
.video-search i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: #9aa7b4;
  font-size: 14px;
  pointer-events: none;
}
.video-search input {
  width: 100%;
  height: 48px;
  padding: 0 18px 0 44px;
  border: 1px solid rgba(30, 54, 78, 0.15);
  border-radius: 26px;
  font-size: 15px;
  color: #172433;
  background: #ffffff;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.video-search input::placeholder {
  color: #9aa7b4;
}
.video-search input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.video-search-empty {
  display: none;
  width: 100%;
  text-align: center;
  color: #6b7280;
  font-size: 15px;
  padding: 24px 0;
}

/* Loading / empty / error states */
.video-status {
  width: 100%;
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
}
.video-status .spinner {
  width: 42px;
  height: 42px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: video-spin 0.8s linear infinite;
}
@keyframes video-spin {
  to { transform: rotate(360deg); }
}
.video-status a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}
.video-status a:hover {
  text-decoration: underline;
}
