/* Progress components — Liquid Silk Edition */

/* Progress header */
.progress-header {
  margin-bottom: var(--space-2xl);
}
.progress-header__title {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

/* Metrics row — pages / issues / ETA */
.progress-metrics {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg) var(--space-xl);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  gap: var(--space-lg);
}
.progress-metrics__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.progress-metrics__value {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-text);
}
.progress-metrics__label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.progress-metrics__issues--active {
  color: var(--color-error);
}

/* Current action — single line */
.progress-current {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-align: center;
}
.progress-current.status-ticker--done {
  color: var(--color-success);
  font-weight: var(--font-medium);
}

/* Completed pages log */
.completed-log {
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  scrollbar-width: thin;
  scrollbar-color: rgba(139,92,246,0.2) transparent;
}
.completed-log:empty {
  display: none;
}
.completed-log::-webkit-scrollbar { width: 6px; }
.completed-log::-webkit-scrollbar-track { background: transparent; }
.completed-log::-webkit-scrollbar-thumb {
  background: rgba(139,92,246,0.2);
  border-radius: var(--radius-full);
}
.completed-log__item {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
}
.completed-log__item:last-child { border-bottom: none; }
.completed-log__item--pending {
  border-left: 3px solid var(--color-border);
  opacity: 0.5;
}
.completed-log__item--pass {
  border-left: 3px solid var(--color-success);
}
.completed-log__item--fail {
  border-left: 3px solid var(--color-error);
}
.completed-log__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
}
.completed-log__icon {
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
  font-weight: var(--font-bold);
}
.completed-log__item--pending .completed-log__icon { color: var(--color-text-secondary); }
.completed-log__item--pass .completed-log__icon { color: var(--color-success); }
.completed-log__item--fail .completed-log__icon { color: var(--color-error); }
.completed-log__path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.completed-log__issues {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
  padding-left: calc(1rem + var(--space-sm));
}

/* Progress bar — violet→pink→orange gradient with warm shimmer */
.progress-bar {
  width: 100%;
  height: 12px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(139,92,246,0.1);
  position: relative;
}
/* Indeterminate wave while waiting for first result */
.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(139,92,246,0.15) 20%,
    rgba(236,72,153,0.2) 50%,
    rgba(139,92,246,0.15) 80%,
    transparent 100%
  );
  animation: indeterminate-wave 2s ease-in-out infinite;
  border-radius: var(--radius-full);
}
.progress-bar.progress-bar--determinate::after {
  display: none;
}
@keyframes indeterminate-wave {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #ec4899, #f97316);
  border-radius: var(--radius-full);
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 1;
}
.progress-bar__fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(236,72,153,0.3), transparent);
  animation: shimmer 2.5s ease-in-out infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.progress-bar__fill--complete {
  background: linear-gradient(90deg, var(--color-success), #059669);
  box-shadow: var(--shadow-glow-success);
}
.progress-bar__fill--complete::after {
  animation: none;
}
.progress-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-md);
  font-size: var(--text-base);
  color: var(--color-text-secondary);
}
.progress-stats__issues {
  color: var(--color-error);
  font-weight: var(--font-semibold);
}

/* Activity log — warm rounded items */
.activity-log {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  margin-top: var(--space-xl);
  font-size: var(--text-base);
  background: var(--color-surface);
  scrollbar-width: thin;
  scrollbar-color: rgba(139,92,246,0.2) transparent;
}
.activity-log::-webkit-scrollbar {
  width: 6px;
}
.activity-log::-webkit-scrollbar-track {
  background: transparent;
}
.activity-log::-webkit-scrollbar-thumb {
  background: rgba(139,92,246,0.2);
  border-radius: var(--radius-full);
}
.activity-log__item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--transition-fast);
}
.activity-log__item:hover {
  background: var(--color-ghost-hover);
}
.activity-log__item:last-child { border-bottom: none; }
.activity-log__icon { flex-shrink: 0; width: var(--space-lg); text-align: center; font-size: var(--text-base); }
.activity-log__icon--pass { color: var(--color-success); }
.activity-log__icon--fail { color: var(--color-error); }
.activity-log__icon--info { color: var(--color-primary); }

/* C4.1: Pause button — warm pill */
.btn--pause {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.625rem 1.25rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  font-family: var(--font);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background var(--transition-base), color var(--transition-base), transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}
.btn--pause:hover {
  background: var(--color-ghost-hover);
  border-color: var(--color-primary);
  transform: scale(1.02);
  box-shadow: var(--shadow-glow);
}
.btn--pause--active {
  background: var(--color-warning-bg);
  border-color: var(--color-warning-border);
  color: var(--color-warning-text);
}

/* C4.2: Paused progress bar — pink-tinted stripes */
.progress-bar__fill--paused {
  opacity: 0.7;
  background: repeating-linear-gradient(
    -45deg,
    #ec4899,
    #ec4899 6px,
    rgba(236,72,153,0.3) 6px,
    rgba(236,72,153,0.3) 12px
  );
  animation: paused-stripes 1s linear infinite;
}
.progress-bar__fill--paused::after {
  animation: none;
}
@keyframes paused-stripes {
  from { background-position: 0 0; }
  to { background-position: 24px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .progress-bar__fill--paused {
    animation: none;
  }
  .progress-bar::after {
    animation: none;
  }
  .progress-bar__fill::after {
    animation: none;
  }
}

/* ===========================
   Compact Progress Dashboard
   =========================== */

.progress-dashboard {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  min-height: 400px;
}

/* --- Header bar --- */
.progress-dashboard__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-xl);
  min-height: 48px;
}

.progress-dashboard__breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  min-width: 0;
  overflow: hidden;
}

.progress-dashboard__domain {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text);
  font-weight: var(--font-semibold);
}

.progress-dashboard__arrow {
  flex-shrink: 0;
  color: var(--color-text-secondary);
}

.progress-dashboard__actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-shrink: 0;
}

.progress-dashboard__icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--color-text-secondary);
  font-size: 1rem;
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast);
}

.progress-dashboard__icon-btn:hover {
  background: var(--color-ghost-hover);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.progress-dashboard__icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.progress-dashboard__icon-btn--danger:hover {
  border-color: var(--color-error);
  color: var(--color-error);
  background: var(--color-error-bg);
}

/* --- Progress stripe (4px) --- */
.progress-dashboard__stripe {
  flex-shrink: 0;
  height: 4px;
  background: var(--color-border);
  overflow: hidden;
  position: relative;
}

/* Indeterminate wave before first result */
.progress-dashboard__stripe::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(139,92,246,0.2) 20%,
    rgba(236,72,153,0.25) 50%,
    rgba(139,92,246,0.2) 80%,
    transparent 100%
  );
  animation: indeterminate-wave 2s ease-in-out infinite;
}

.progress-dashboard__stripe.progress-bar--determinate::after {
  display: none;
}

.progress-dashboard__stripe-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #ec4899, #f97316);
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 1;
}

.progress-dashboard__stripe-fill--complete {
  background: linear-gradient(90deg, var(--color-success), #059669);
}

/* --- Stat strip --- */
.progress-dashboard__stats {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-sm) var(--space-xl);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
  min-height: 36px;
}

.progress-dashboard__stat {
  white-space: nowrap;
}

.progress-dashboard__stat--issues-active {
  color: var(--color-error);
  font-weight: var(--font-semibold);
}

.progress-dashboard__ticker {
  flex: 1;
  min-width: 0;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-dashboard__ticker.status-ticker--done {
  color: var(--color-success);
  font-weight: var(--font-medium);
}

/* --- Log body (fills remaining space) --- */
.progress-dashboard__log {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  border: none;
  border-radius: 0;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.progress-dashboard__log:empty {
  display: flex;
}

/* --- Summary strip (pass/fail/skip pills) --- */
.progress-dashboard__summary {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-xl);
  border-bottom: 1px solid var(--color-border);
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1;
}

.summary-pill--pass {
  color: var(--color-success);
  background: var(--color-success-bg);
}

.summary-pill--fail {
  color: var(--color-error);
  background: var(--color-error-bg);
}

.summary-pill--skip {
  color: var(--color-text-secondary);
  background: var(--color-neutral-bg);
}

/* --- Issue counter bump animation --- */
@keyframes counter-bump {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); color: var(--color-error); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: no-preference) {
  .progress-dashboard__stat--bump {
    animation: counter-bump 300ms ease-out;
  }
}

/* --- Skeleton screen for report transition --- */
.skeleton-layout {
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.skeleton-block {
  background: var(--color-border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.skeleton-block::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skeleton-header {
  height: 48px;
  width: 60%;
}

.skeleton-stats-row {
  display: flex;
  gap: var(--space-md);
}

.skeleton-stat-card {
  flex: 1;
  height: 80px;
}

.skeleton-result-row {
  height: 56px;
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-block::after {
    animation: none;
  }
  .progress-dashboard__stripe::after {
    animation: none;
  }
}
