/* ============ Parse Result Styles ============ */
.parse-result {
  display: none;
  width: 100%;
  max-width: 640px;
  margin-top: 20px;
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Loading ── */
.parse-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.parse-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

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

/* ── Error ── */
.parse-error {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  background: rgba(255, 82, 82, 0.06);
  border: 1px solid rgba(255, 82, 82, 0.18);
  border-radius: 14px;
  color: #FF5252;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

/* ── Result Header ── */
.result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.result-elapsed {
  margin-left: auto;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ── Card ── */
.result-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-card {
  display: flex;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.result-card:hover {
  border-color: rgba(108, 92, 231, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* ── Cover thumbnail ── */
.result-cover-wrap {
  position: relative;
  width: 160px;
  min-height: 120px;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg-surface);
}

.result-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.result-source-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  text-transform: capitalize;
  letter-spacing: 0.3px;
  pointer-events: none;
  z-index: 2;
}

.result-source-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #00E676;
  flex-shrink: 0;
}

.result-ext-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  pointer-events: none;
  z-index: 2;
}

/* ── Info section ── */
.result-info {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.result-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  margin: 0;
}

.result-err {
  font-size: 12px;
  color: #FF5252;
  padding: 4px 8px;
  background: rgba(255, 82, 82, 0.06);
  border-radius: 6px;
}

.result-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* ── Link rows ── */
.result-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.result-link-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.result-link-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 36px;
}

.result-link-url {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: monospace;
  background: var(--bg-surface);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.result-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.result-copy-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(108, 92, 231, 0.06);
}

.result-copy-btn.copied {
  border-color: #00C853;
  color: #00C853;
  background: rgba(0, 200, 83, 0.06);
}

/* ── Action buttons row ── */
.result-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

.result-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.2s, transform 0.15s, box-shadow 0.2s;
  white-space: nowrap;
  border: none;
}

.result-dl-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

.result-dl-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.result-dl-video {
  background: var(--btn-fill);
  color: #fff;
}

.result-dl-cover {
  background: rgba(108, 92, 231, 0.1);
  color: #6C5CE7;
  border: 1px solid rgba(108, 92, 231, 0.2);
}

[data-theme="dark"] .result-dl-cover {
  background: rgba(108, 92, 231, 0.15);
  color: #A78BFA;
  border-color: rgba(108, 92, 231, 0.3);
}

.result-dl-audio {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

/* ── No cover fallback ── */
.result-no-cover .result-info {
  padding: 16px 20px;
}

/* ── Download progress (inside button) ── */
.result-dl-btn.downloading {
  pointer-events: none;
  position: relative;
  overflow: hidden;
  min-width: 140px;
  justify-content: center;
}

.result-dl-btn.downloading:hover {
  transform: none;
  box-shadow: none;
  filter: none;
}

.dl-progress-wrap {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
}

.dl-progress-bar {
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  border-radius: inherit;
  transition: width 0.2s ease;
}

.result-dl-cover.downloading .dl-progress-bar {
  background: rgba(108, 92, 231, 0.15);
}

.result-dl-audio.downloading .dl-progress-bar {
  background: rgba(0, 0, 0, 0.06);
}

.dl-progress-text {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.result-dl-btn.dl-done {
  background: #00C853 !important;
  color: #fff !important;
  border-color: #00C853 !important;
}

@keyframes dl-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* ── shake animation ── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

#url-input.shake {
  animation: shake 0.4s ease;
}

/* ── Responsive ── */
@media (max-width: 520px) {
  .result-card {
    flex-direction: column;
  }
  .result-cover-wrap {
    width: 100%;
    height: 160px;
    min-height: auto;
  }
  .result-actions {
    flex-direction: column;
  }
  .result-dl-btn {
    justify-content: center;
  }
}
