/* ─────────────────────────────────────────────
 *  Automation Progress Widget
 *  우측하단 floating 패널 (사이트 전역)
 *  studio.css의 디자인 토큰 기반 — 다크 톤 + 빨강(#dc2626) 강조
 * ───────────────────────────────────────────── */

.ap-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--bg-secondary, #141414);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
  z-index: 99999;
  color: var(--text-primary, #e0e0e0);
  font-size: 15px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow: hidden;
  user-select: none;
  animation: ap-slide-in 0.25s ease-out;
}

@keyframes ap-slide-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.ap-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.ap-widget-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary, #e0e0e0);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ap-widget-close {
  background: none;
  border: none;
  color: var(--text-secondary, #888);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s;
}
.ap-widget-close:hover {
  color: var(--text-primary, #e0e0e0);
}

.ap-widget-body {
  padding: 12px;
}

.ap-widget-step-label {
  font-size: 15px;
  color: var(--text-primary, #e0e0e0);
  margin-bottom: 8px;
  min-height: 16px;
  line-height: 1.4;
}

.ap-widget-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.ap-widget-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color, #dc2626), #f87171);
  transition: width 0.35s ease;
  width: 0%;
}

.ap-widget[data-status="completed"] .ap-widget-progress-fill {
  background: linear-gradient(90deg, var(--success-color, #22c55e), #4ade80);
}

.ap-widget[data-status="failed"] .ap-widget-progress-fill {
  background: linear-gradient(90deg, var(--error-color, #ef4444), #f87171);
}

.ap-widget-progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary, #888);
}

.ap-widget-percent {
  font-weight: 600;
  color: var(--text-primary, #e0e0e0);
}

.ap-widget-steps {
  list-style: none;
  margin: 10px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  max-height: 200px;
  overflow-y: auto;
}

.ap-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 14px;
  transition: color 0.2s;
}

.ap-step-icon {
  width: 14px;
  text-align: center;
  font-size: 12px;
  flex-shrink: 0;
}

.ap-step-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ap-step-done {
  color: var(--success-color, #22c55e);
}
.ap-step-done .ap-step-icon {
  color: var(--success-color, #22c55e);
}

.ap-step-active {
  color: var(--text-primary, #e0e0e0);
  font-weight: 600;
}
.ap-step-active .ap-step-icon {
  color: var(--primary-color, #dc2626);
  animation: ap-pulse 1.2s infinite ease-in-out;
}

@keyframes ap-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.ap-step-pending {
  color: var(--text-secondary, #666);
}
.ap-step-pending .ap-step-icon {
  color: var(--text-muted, #555);
}

.ap-step-failed {
  color: var(--error-color, #ef4444);
}
.ap-step-failed .ap-step-icon {
  color: var(--error-color, #ef4444);
}

/* 스크롤바 다크 톤 */
.ap-widget-steps::-webkit-scrollbar {
  width: 4px;
}
.ap-widget-steps::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}
.ap-widget-steps::-webkit-scrollbar-track {
  background: transparent;
}
