/* Shared download-job progress overlay + completion promo popup.
   Used by wwwroot/js/download-job.js on every downloader page - one
   stylesheet instead of the popup CSS being duplicated per-page. */

.dlj-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: dlj-fadeIn 0.25s ease;
}

.dlj-overlay[hidden] { display: none; }

.dlj-card {
  background: var(--dlj-bg, #fff);
  color: var(--dlj-fg, #222);
  border-radius: 14px;
  padding: 24px;
  max-width: 480px;
  width: 92%;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  animation: dlj-slideUp 0.3s ease;
}

@media (prefers-color-scheme: dark) {
  .dlj-card { --dlj-bg: #1f2430; --dlj-fg: #eee; }
}

.dlj-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.dlj-title {
  font-weight: 600;
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dlj-meta {
  color: #888;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.dlj-percent-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.dlj-percent {
  font-size: 1.8rem;
  font-weight: 700;
}

.dlj-stage {
  font-size: 0.95rem;
  color: #555;
}

@media (prefers-color-scheme: dark) {
  .dlj-stage { color: #ccc; }
}

.dlj-bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(127, 127, 127, 0.25);
  overflow: hidden;
  margin-bottom: 12px;
}

.dlj-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4285f4, #34a853);
  transition: width 0.4s ease;
  width: 0%;
}

.dlj-bar-fill.dlj-indeterminate {
  width: 40% !important;
  animation: dlj-indeterminate 1.4s ease-in-out infinite;
}

/*
 * Merging/converting reports no bytes, so the fill holds its real position
 * while a stripe travels across it. The width stays honest - only the texture
 * moves - which distinguishes "still working" from "frozen" without claiming
 * progress that hasn't happened.
 */
.dlj-bar-fill.dlj-working {
  background-image: linear-gradient(90deg, #4285f4, #34a853),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.25) 0 10px, rgba(255, 255, 255, 0) 10px 20px);
  background-blend-mode: overlay;
  background-size: 100% 100%, 28px 100%;
  animation: dlj-working-stripes 0.9s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .dlj-bar-fill { transition: none; }
  .dlj-bar-fill.dlj-indeterminate { animation: none; width: 60% !important; }
  .dlj-bar-fill.dlj-working { animation: none; }
}

.dlj-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 14px;
}

@media (prefers-color-scheme: dark) {
  .dlj-stats { color: #bbb; }
}

.dlj-hint {
  font-size: 0.8rem;
  color: #999;
  margin-bottom: 14px;
}

.dlj-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.dlj-btn {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}

.dlj-btn-primary { background: #4CAF50; color: #fff; }
.dlj-btn-primary:hover { background: #3e8e41; }
.dlj-btn-secondary { background: #eee; color: #333; }
.dlj-btn-secondary:hover { background: #ddd; }
.dlj-btn-danger { background: #e53935; color: #fff; }
.dlj-btn-danger:hover { background: #c62828; }

.dlj-error-message {
  color: #c62828;
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.dlj-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Completion promo popup - visual design carried over from the pre-existing
   .download-success-popup (see Pages/download-video-from-url.cshtml history)
   so every downloader page now gets the same, previously-inconsistent promo
   experience, triggered by a real Completed event instead of a click/blob-URL
   heuristic. */
.download-success-popup {
  position: fixed;
  inset: 0;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2100;
  animation: dlj-fadeIn 0.3s ease;
}

.download-success-popup[hidden] { display: none; }

.download-success-content {
  background: white;
  border-radius: 12px;
  padding: 25px;
  max-width: 450px;
  width: 90%;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  text-align: center;
  animation: dlj-slideUp 0.4s ease;
}

.download-success-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
}

.download-success-icon {
  width: 40px;
  height: 40px;
  color: #4CAF50;
  margin-right: 10px;
}

.download-success-content h3 { margin: 0; color: #333; font-size: 1.5rem; }
.download-success-message { color: #666; margin-bottom: 20px; }

.ext-widget-container { background: #f8f9fa; border-radius: 8px; padding: 15px; margin: 20px 0; }
.ext-widget-text { margin: 0 0 15px 0; color: #444; font-weight: 500; }
.ext-widget-buttons { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.ext-widget-btn { display: flex; align-items: center; background: #4285f4; color: white !important; padding: 8px 12px; border-radius: 6px; text-decoration: none; font-size: 0.9rem; transition: background 0.2s; }
.ext-widget-btn:hover { background: #3367d6; }
.ext-widget-icon { width: 20px; height: 20px; margin-right: 8px; }

.mobile-app-promo { margin: 20px 0; }
.mobile-app-promo p { margin-bottom: 10px; color: #555; }
.app-store-buttons { display: flex; justify-content: center; gap: 10px; }
.app-store-btn img { height: 40px; border-radius: 5px; }

.close-popup-btn {
  background: #4CAF50; color: white; border: none; padding: 10px 20px;
  border-radius: 6px; cursor: pointer; font-size: 1rem; transition: background 0.2s; margin-top: 10px;
}
.close-popup-btn:hover { background: #3e8e41; }

/* ------------------------------------------------------------------
   Merged completion - opt-in via DownloadJob.configure({ completion:
   "merged" }). The overlay becomes the success screen; the separate
   promo popup is never opened. Nothing here affects pages that keep the
   classic completion, because .dlj-success and .dlj-feedback-btn stay
   hidden for them.
   ------------------------------------------------------------------ */
.dlj-success { text-align: center; margin: 2px 0 12px; }
.dlj-success[hidden] { display: none; }

.dlj-success-check { display: block; width: 76px; height: 76px; margin: 0 auto 10px; }
.dlj-success-check circle {
  fill: rgba(52, 168, 83, 0.1); stroke: #22a55b; stroke-width: 3;
  stroke-dasharray: 152; stroke-dashoffset: 152;
  animation: dlj-draw 0.6s ease forwards;
}
.dlj-success-check path {
  fill: none; stroke: #22a55b; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40;
  animation: dlj-draw 0.35s 0.5s ease forwards;
}
.dlj-success-title { margin: 0 0 4px; font-size: 1.35rem; font-weight: 800; }
.dlj-success-text { margin: 0; font-size: 0.92rem; color: #667085; }

.dlj-overlay.dlj-complete .dlj-percent-row,
.dlj-overlay.dlj-complete .dlj-hint { display: none; }
.dlj-overlay.dlj-complete .dlj-header { justify-content: center; }
.dlj-overlay.dlj-complete .dlj-meta { text-align: center; }
.dlj-overlay.dlj-complete .dlj-bar-fill { background: linear-gradient(90deg, #22a55b, #4ade80); }

.dlj-btn-feedback { background: #eef2ff; color: #3949c7; }
.dlj-btn-feedback:hover { background: #e0e7ff; }
.dlj-feedback-btn[hidden] { display: none; }

/* The rating section the feedback button scrolls to. */
.dlj-feedback-highlight { animation: dlj-pulse 2.4s ease 1; border-radius: 18px; }

@keyframes dlj-draw { to { stroke-dashoffset: 0; } }
@keyframes dlj-pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 111, 240, 0.55); }
  60% { box-shadow: 0 0 0 20px rgba(61, 111, 240, 0); }
  100% { box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dlj-success-check circle, .dlj-success-check path { animation: none; stroke-dashoffset: 0; }
  .dlj-feedback-highlight { animation: none; outline: 3px solid #3d6ff0; outline-offset: 6px; }
}

@keyframes dlj-fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dlj-slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dlj-indeterminate {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}
@keyframes dlj-working-stripes {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 0 0, 28px 0; }
}
