/**
 * ClipNeat V17.0 — Production-Grade Styles
 * Creative Director, Agent Inspector, Verity, Error Recovery
 */

/* ── BRIEF EXTRACTION BUTTON ─────────────────────────────── */
.v17-extract-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  padding: 4px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 8px;
  transition: opacity 0.2s;
  vertical-align: middle;
}
.v17-extract-btn:hover { opacity: 0.85; }
.v17-extract-btn:disabled { opacity: 0.5; cursor: wait; }

/* ── STRUCTURED BRIEF PANEL ──────────────────────────────── */
.v17-brief-panel { margin-top: 16px; }
.v17-brief-panel:not(.v17-active) { display: none; }
.v17-brief-panel.v17-active {
  padding: 16px;
  background: rgba(102,126,234,0.06);
  border: 1px solid rgba(102,126,234,0.15);
  border-radius: 10px;
  animation: v17fadeIn 0.3s ease;
}
@keyframes v17fadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }

.v17-brief-header small { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.4; }
.v17-brief-header h3 { font-size: 15px; margin: 2px 0 12px; font-weight: 600; }

.v17-brief-field { margin-bottom: 8px; }
.v17-brief-field small { display: block; font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.35; margin-bottom: 2px; }
.v17-brief-field span { font-size: 13px; line-height: 1.4; }

.v17-format-pill {
  display: inline-block;
  padding: 2px 10px;
  background: rgba(102,126,234,0.2);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #667eea;
}

.v17-brief-assets { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.06); }
.v17-brief-assets small { display: block; font-size: 9px; text-transform: uppercase; opacity: 0.35; margin-bottom: 6px; }
.v17-missing-tag { display: inline-block; font-size: 12px; color: #f56565; margin-right: 8px; }
.v17-ready-tag { font-size: 12px; color: #48bb78; }
.v17-upload-link { background: none; border: none; color: #63b3ed; font-size: 12px; cursor: pointer; padding: 4px 0; margin-top: 4px; display: block; }

/* ── AGENT INSPECTOR ─────────────────────────────────────── */
.v17-inspector-panel { margin: 20px 0; }
.v17-inspector-empty, .v17-inspector-error { font-size: 13px; opacity: 0.4; padding: 20px; }
.v17-inspector-error { color: #f56565; opacity: 0.8; }

.v17-inspector-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 1100px) {
  .v17-inspector-grid { grid-template-columns: 1fr 1.2fr 0.8fr; }
}

/* Goal card */
.v17-insp-goal, .v17-insp-steps, .v17-insp-timeline {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 18px;
}
.v17-insp-goal small, .v17-insp-steps small, .v17-insp-timeline small {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.4;
}
.v17-insp-goal h3 { font-size: 16px; margin: 4px 0 8px; font-weight: 600; }
.v17-insp-goal p { font-size: 13px; opacity: 0.6; line-height: 1.5; margin: 0 0 12px; }
.v17-insp-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; opacity: 0.6; }
.v17-insp-meta b { opacity: 1; font-weight: 600; }

.v17-status-completed { color: #48bb78; }
.v17-status-running, .v17-status-queued { color: #63b3ed; }
.v17-status-failed { color: #f56565; }
.v17-status-waiting { color: #ecc94b; }

/* Step cards */
.v17-step-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.v17-step-card { border-radius: 8px; overflow: hidden; }
.v17-step-card summary {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  cursor: pointer; list-style: none; font-size: 13px;
  background: rgba(255,255,255,0.02); border-radius: 8px;
  transition: background 0.15s;
}
.v17-step-card summary:hover { background: rgba(255,255,255,0.05); }
.v17-step-card summary::-webkit-details-marker { display: none; }

.v17-step-dot { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; }
.v17-state-completed .v17-step-dot { color: #48bb78; }
.v17-state-working .v17-step-dot { color: #63b3ed; animation: v17pulse 1.5s ease-in-out infinite; }
.v17-state-failed .v17-step-dot { color: #f56565; }
.v17-state-waiting .v17-step-dot { color: #ecc94b; }
.v17-state-recovering .v17-step-dot { color: #ed8936; animation: v17pulse 1s ease-in-out infinite; }
@keyframes v17pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

.v17-step-name { flex: 1; min-width: 0; }
.v17-step-name b { display: block; font-weight: 600; }
.v17-step-name small { font-size: 11px; opacity: 0.5; }
.v17-step-time, .v17-step-cost { font-size: 11px; opacity: 0.4; white-space: nowrap; }

.v17-step-body { padding: 10px 12px 14px 40px; font-size: 12px; }
.v17-step-output, .v17-step-prov, .v17-step-error, .v17-step-attempts {
  margin-bottom: 8px;
}
.v17-step-output small, .v17-step-prov small, .v17-step-error small {
  font-size: 9px; text-transform: uppercase; opacity: 0.35; display: block; margin-bottom: 2px;
}
.v17-step-output p { margin: 0; line-height: 1.5; opacity: 0.7; white-space: pre-wrap; word-break: break-word; }
.v17-step-prov span { opacity: 0.5; }
.v17-step-error { color: #f56565; }
.v17-step-error p { margin: 0; }
.v17-step-attempts small { opacity: 0.4; }

.v17-step-actions { display: flex; gap: 8px; margin-top: 8px; }
.v17-retry-btn, .v17-inspect-btn {
  padding: 4px 12px; border-radius: 5px; font-size: 12px; cursor: pointer; border: none;
}
.v17-retry-btn { background: rgba(99,179,237,0.15); color: #63b3ed; }
.v17-retry-btn:hover { background: rgba(99,179,237,0.25); }
.v17-inspect-btn { background: rgba(255,255,255,0.06); color: inherit; }

/* Verity inline */
.v17-verity-inline { margin-top: 8px; }
.v17-verity-inline small { font-size: 9px; text-transform: uppercase; opacity: 0.35; }
.v17-verity-score { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.v17-verdict-pass { background: rgba(72,187,120,0.15); color: #48bb78; }
.v17-verdict-repair { background: rgba(236,201,75,0.15); color: #ecc94b; }
.v17-verdict-reject { background: rgba(245,101,101,0.15); color: #f56565; }

/* Signal bars */
.v17-signal-bars { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.v17-signal { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.v17-signal span { width: 100px; text-align: right; opacity: 0.5; flex-shrink: 0; }
.v17-signal-track { flex: 1; height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.v17-signal-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.v17-signal b { width: 24px; text-align: right; font-weight: 600; opacity: 0.7; }

/* Event timeline */
.v17-timeline-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; max-height: 400px; overflow-y: auto; }
.v17-event { padding: 6px 10px; border-radius: 6px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; }
.v17-event-started { background: rgba(99,179,237,0.06); }
.v17-event-completed { background: rgba(72,187,120,0.06); }
.v17-event-failed, .v17-event-retry { background: rgba(245,101,101,0.06); }
.v17-event-agent { font-weight: 600; font-size: 11px; opacity: 0.6; min-width: 60px; }
.v17-event-msg { flex: 1; line-height: 1.4; }
.v17-event small { font-size: 10px; opacity: 0.3; width: 100%; }

/* ── VERITY QUALITY PANEL (post-generation) ──────────────── */
.v17-verity-panel {
  margin-top: 16px; padding: 16px;
  background: rgba(72,187,120,0.04);
  border: 1px solid rgba(72,187,120,0.12);
  border-radius: 10px;
}
.v17-verity-header { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.v17-verity-header .v17-verity-icon { font-size: 18px; color: #48bb78; }
.v17-verity-header small { font-size: 9px; text-transform: uppercase; opacity: 0.35; display: block; }
.v17-verity-header b { font-size: 14px; }

.v17-verity-issues, .v17-verity-strengths { margin-top: 10px; }
.v17-verity-issues small, .v17-verity-strengths small { font-size: 9px; text-transform: uppercase; opacity: 0.35; display: block; margin-bottom: 4px; }
.v17-verity-issues span { display: block; font-size: 12px; color: #f56565; padding: 2px 0; }
.v17-verity-strengths span { display: block; font-size: 12px; color: #48bb78; padding: 2px 0; }

/* ── TOAST ────────────────────────────────────────────────── */
.v17-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  padding: 10px 24px; border-radius: 8px; font-size: 13px; font-weight: 500;
  background: #1a202c; color: #e2e8f0; border: 1px solid rgba(255,255,255,0.08);
  opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s; z-index: 10000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.v17-toast-show { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.v17-toast-err { border-color: rgba(245,101,101,0.3); color: #feb2b2; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .v17-inspector-grid { grid-template-columns: 1fr; }
  .v17-signal span { width: 70px; }
}
