/* Styles for source/yt-md UI */
body {
  font-family: Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial;
  margin: 2rem;
}

.gradient {
  min-height: 100vh;
  background-image: linear-gradient(
    60deg,
    hsl(297deg 75% 76%) 0%,
    hsl(281deg 90% 80%) 14%,
    hsl(266deg 100% 82%) 23%,
    hsl(251deg 100% 84%) 31%,
    hsl(235deg 100% 84%) 37%,
    hsl(222deg 100% 81%) 43%,
    hsl(214deg 100% 78%) 49%,
    hsl(209deg 100% 76%) 55%,
    hsl(205deg 100% 74%) 61%,
    hsl(202deg 100% 73%) 68%,
    hsl(199deg 92% 72%) 76%,
    hsl(196deg 83% 71%) 86%,
    hsl(193deg 74% 71%) 100%
  );
  background-attachment: fixed;
  background-repeat: no-repeat;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.88);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(10, 15, 40, 0.18);
  backdrop-filter: blur(6px);
}

.row {
  display: flex;
  gap: 8px;
}

input[type="text"] {
  flex: 1;
  padding: 8px 10px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}

button {
  padding: 10px 14px;
  background: linear-gradient(90deg, #2aa2c6 0%, #1781a8 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(23, 129, 168, 0.18);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
  font-weight: 600;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(23, 129, 168, 0.22);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(23, 129, 168, 0.16);
}

.example {
  margin-top: 6px;
}

.example p {
  background: #f0f4f7;
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
  margin: 4px 0;
  overflow: auto;
  padding: 6px 8px;
  text-wrap: nowrap;
  white-space: pre;
}

pre {
  background: #0f1720;
  color: #e6eef3;
  padding: 12px;
  border-radius: 6px;
  margin-top: 12px;
  overflow: auto;
}

code {
  white-space: pre-wrap;
}

.controls {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button .btn-icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin-right: 8px;
  fill: currentColor;
}

/* Preview container showing an inline thumbnail preview */
.preview-container {
  max-width: 600px;
  margin: 18px auto 0 auto;
  padding: 12px;
  border-radius: 10px;
  text-align: center;
  background-image: linear-gradient(
    60deg,
    rgba(0, 0, 0, 0.25),
    rgba(0, 0, 0, 0.12)
  );
}

/* Use class-based selectors so markup tag changes (figure vs div) don't affect styling */
.yt-thumbnail a {
  display: inline-block;
  text-decoration: none;
  color: inherit;
}

.yt-thumbnail img {
  max-width: 100%;
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* Fade-in animation for preview entrance */
.preview-container.fade-in {
  animation: ytFadeIn 0.28s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

@keyframes ytFadeIn {
  0% {
    opacity: 0;
    transform: translateY(6px) scale(0.995);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Styling for caption text */
.yt-caption {
  margin-top: 10px;
  color: #eef6fb;
  font-weight: 600;
  font-size: 0.95rem;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.preview-placeholder {
  max-width: 600px;
  margin: 18px auto 0 auto;
  padding: 18px;
  border-radius: 10px;
  text-align: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.04));
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #083047;
  font-weight: 600;
  opacity: 0.95;
}

/* Subtle spinner used in the Generate button */
.yt-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: rgba(255, 255, 255, 0.95);
  animation: yt-spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes yt-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Slightly dim the button when loading */
.btn-loading {
  opacity: 0.9;
}
