/* ============================================
   Forge Build Card — Inline chat card for
   autonomous build progress (Phase 28 S242).
   Dark theme, matches chat.css tokens.
   ============================================ */

/* --- Card Container --- */

.build-card {
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 8px 0;
  max-width: 520px;
  width: 100%;
  animation: build-card-in 0.25s ease;
}

@keyframes build-card-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Header: icon + build name --- */

.build-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.build-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: rgba(66, 133, 244, 0.15);
}

.build-card-name {
  font-size: 14px;
  font-weight: 600;
  color: #f5f5f3;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* --- Progress Bar --- */

.build-card-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.build-card-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}

.build-card-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: #4285F4;
  transition: width 0.4s ease;
  width: 0%;
}

.build-card-phase {
  font-size: 12px;
  font-weight: 500;
  color: #a1a1aa;
  white-space: nowrap;
  flex-shrink: 0;
}

.build-card-elapsed {
  font-size: 12px;
  font-weight: 500;
  color: #71717a;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* --- Status Line --- */

.build-card-status {
  font-size: 13px;
  color: #9a9990;
  line-height: 1.4;
  min-height: 18px;
}

/* --- State Accents --- */

/* Active / building */
.build-card.state-active .build-card-bar-fill {
  background: #4285F4;
}

.build-card.state-active .build-card-icon {
  background: rgba(66, 133, 244, 0.15);
}

/* Planning — subtle pulsing bar */
.build-card.state-planning .build-card-bar-fill {
  background: #4285F4;
  animation: bar-pulse 1.8s ease-in-out infinite;
}

@keyframes bar-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Success */
.build-card.state-success {
  border-color: rgba(52, 211, 153, 0.2);
}

.build-card.state-success .build-card-bar-fill {
  background: #34d399;
}

.build-card.state-success .build-card-icon {
  background: rgba(52, 211, 153, 0.15);
}

.build-card.state-success .build-card-phase {
  color: #34d399;
}

/* Partial success */
.build-card.state-partial {
  border-color: rgba(251, 191, 36, 0.2);
}

.build-card.state-partial .build-card-bar-fill {
  background: #fbbf24;
}

.build-card.state-partial .build-card-icon {
  background: rgba(251, 191, 36, 0.15);
}

.build-card.state-partial .build-card-phase {
  color: #fbbf24;
}

/* Failed */
.build-card.state-failed {
  border-color: rgba(239, 68, 68, 0.2);
}

.build-card.state-failed .build-card-bar-fill {
  background: #ef4444;
}

.build-card.state-failed .build-card-icon {
  background: rgba(239, 68, 68, 0.15);
}

.build-card.state-failed .build-card-phase {
  color: #ef4444;
}

/* --- Reconnecting indicator --- */

.build-card-reconnecting {
  font-size: 12px;
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.build-card-reconnecting::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fbbf24;
  animation: reconnect-blink 1s step-end infinite;
}

@keyframes reconnect-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* --- Completion summary link --- */

.build-card-pr-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  color: #4285F4;
  text-decoration: none;
  font-weight: 500;
}

.build-card-pr-link:hover {
  text-decoration: underline;
}

/* --- Cost badge --- */

.build-card-cost {
  display: inline-block;
  margin-top: 6px;
  margin-left: 12px;
  font-size: 12px;
  color: #71717a;
  font-variant-numeric: tabular-nums;
}

/* --- Feature Checklist --- */

.build-card-checklist {
  margin-top: 8px;
}

.build-card-check-item {
  font-size: 12px;
  color: #a1a1aa;
  padding: 3px 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  line-height: 1.4;
}

.check-icon {
  flex-shrink: 0;
  width: 14px;
  text-align: center;
  color: #71717a;
  font-size: 11px;
}

.check-icon.check-pass {
  color: #34d399;
}

.check-icon.check-fail {
  color: #ef4444;
}

/* --- Follow in #builds link --- */

.build-card-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.build-card-msg-link {
  font-size: 12px;
  color: #71717a;
  text-decoration: none;
  transition: color 0.15s;
}

.build-card-msg-link:hover {
  color: #4285F4;
}

/* --- Mobile / iPad --- */

@media (max-width: 600px) {
  .build-card {
    max-width: 100%;
    padding: 12px 14px;
  }

  .build-card-name {
    font-size: 13px;
  }

  .build-card-progress {
    flex-wrap: wrap;
    gap: 8px;
  }

  .build-card-bar-track {
    width: 100%;
    flex: none;
    order: 3;
  }

  .build-card-phase {
    order: 1;
  }

  .build-card-elapsed {
    order: 2;
    margin-left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .build-card {
    animation: none;
  }

  .build-card.state-planning .build-card-bar-fill {
    animation: none;
    opacity: 0.8;
  }

  .build-card-reconnecting::before {
    animation: none;
    opacity: 0.7;
  }
}
