/* PNW-FILE-GUIDE
   css/cf-v101.css — KOMPONEN v101 (chip output status + preflight modal).
   Memakai token dari cf-tokens.css, prefix cf-, TANPA !important baru.
   Visibilitas modal via kelas .on (bukan [hidden] — pelajaran v81).
*/

/* ---------- chip status output (top bar) ---------- */
body.yvStandalone .cfOutputChip {
  display: inline-flex;
  align-items: center;
  gap: var(--cf-space-1);
  height: 24px;
  padding: 0 var(--cf-space-2);
  border-radius: 999px;
  border: 1px solid var(--cf-color-border);
  background: var(--cf-color-sunken);
  color: var(--cf-color-text-muted);
  font: 400 9.5px/1 var(--cf-font-ui);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color var(--cf-motion-fast) var(--cf-ease-standard);
}
body.yvStandalone .cfOutputChip:hover {
  border-color: var(--cf-color-primary);
}
body.yvStandalone .cfOutputChip:focus-visible {
  outline: 2px solid var(--cf-color-primary);
  outline-offset: 1px;
}
body.yvStandalone .cfOutputDot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cf-color-text-muted);
}
body.yvStandalone .cfOutputChip[data-status="connected"] .cfOutputDot {
  background: var(--cf-color-success);
}
body.yvStandalone .cfOutputChip[data-status="connected"] {
  color: var(--cf-color-text);
}
body.yvStandalone .cfOutputChip[data-status="connecting"] .cfOutputDot {
  background: var(--cf-color-warning);
}
body.yvStandalone .cfOutputChip[data-status="stale"] .cfOutputDot {
  background: var(--cf-color-warning);
}
body.yvStandalone .cfOutputChip[data-status="stale"] {
  color: var(--cf-color-warning);
  border-color: var(--cf-color-warning);
}
body.yvStandalone .cfOutputChip[data-status="disconnected"] .cfOutputDot,
body.yvStandalone .cfOutputChip[data-status="error"] .cfOutputDot {
  background: var(--cf-color-danger);
}
body.yvStandalone .cfOutputChip[data-status="disconnected"],
body.yvStandalone .cfOutputChip[data-status="error"] {
  color: var(--cf-color-danger);
  border-color: var(--cf-color-danger);
}
body.yvStandalone .cfOutputChip[data-ack="ok"]::after {
  content: "ACK";
  font-size: 8px;
  letter-spacing: 0.06em;
  color: var(--cf-color-success);
}

/* ---------- preflight modal ---------- */
.cfPreflightOverlay {
  position: fixed;
  inset: 0;
  z-index: var(--cf-z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  font-family: var(--cf-font-ui);
}
.cfPreflightOverlay.on {
  display: flex;
}
.cfPreflightPanel {
  width: min(560px, calc(100vw - 48px));
  max-height: min(70vh, 640px);
  display: flex;
  flex-direction: column;
  gap: var(--cf-space-2);
  padding: var(--cf-space-4);
  border-radius: var(--cf-radius-lg);
  border: 1px solid var(--cf-color-border);
  background: var(--cf-color-surface);
  color: var(--cf-color-text);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}
.cfPreflightHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cfPreflightHead h3 {
  margin: 0;
  font-size: 13px;
  font-weight: var(--cf-weight-heading);
  letter-spacing: 0.04em;
}
.cfPreflightX {
  border: 0;
  background: transparent;
  color: var(--cf-color-text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: var(--cf-space-1) var(--cf-space-2);
  border-radius: var(--cf-radius-sm);
}
.cfPreflightX:hover {
  background: var(--cf-color-hover);
  color: var(--cf-color-text);
}
.cfPreflightHint {
  margin: 0;
  font-size: 10px;
  font-weight: var(--cf-weight-text);
  color: var(--cf-color-text-muted);
}
.cfPreflightList {
  display: flex;
  flex-direction: column;
  gap: var(--cf-space-1);
  overflow: auto;
}
.cfPreflightRow {
  display: grid;
  grid-template-columns: 52px 70px 1fr;
  align-items: center;
  gap: var(--cf-space-2);
  padding: 6px var(--cf-space-2);
  border-radius: var(--cf-radius-sm);
  background: var(--cf-color-sunken);
  font-size: 10.5px;
}
.cfPreflightBadge {
  text-align: center;
  padding: 2px 0;
  border-radius: 999px;
  font-size: 8.5px;
  letter-spacing: 0.08em;
  background: var(--cf-color-hover);
  color: var(--cf-color-text-muted);
}
.cfPreflightRow[data-status="pass"] .cfPreflightBadge {
  background: rgba(46, 158, 107, 0.18);
  color: var(--cf-color-success);
}
.cfPreflightRow[data-status="warn"] .cfPreflightBadge {
  background: rgba(217, 161, 59, 0.18);
  color: var(--cf-color-warning);
}
.cfPreflightRow[data-status="fail"] .cfPreflightBadge {
  background: rgba(224, 92, 92, 0.18);
  color: var(--cf-color-danger);
}
.cfPreflightName {
  font-weight: var(--cf-weight-heading);
  letter-spacing: 0.03em;
}
.cfPreflightMsg {
  font-weight: var(--cf-weight-text);
  color: var(--cf-color-text-muted);
}
.cfPreflightSummary {
  font-size: 11px;
  font-weight: var(--cf-weight-heading);
  letter-spacing: 0.03em;
  color: var(--cf-color-text-muted);
}
.cfPreflightSummary[data-status="pass"] {
  color: var(--cf-color-success);
}
.cfPreflightSummary[data-status="warn"] {
  color: var(--cf-color-warning);
}
.cfPreflightSummary[data-status="fail"] {
  color: var(--cf-color-danger);
}
.cfPreflightFoot {
  display: flex;
  justify-content: flex-end;
  gap: var(--cf-space-2);
}
.cfPreflightBtn {
  padding: 7px 14px;
  border-radius: var(--cf-radius-sm);
  border: 1px solid var(--cf-color-border);
  background: var(--cf-color-sunken);
  color: var(--cf-color-text);
  font: 400 10.5px/1 var(--cf-font-ui);
  cursor: pointer;
}
.cfPreflightBtn:hover {
  background: var(--cf-color-hover);
}
.cfPreflightBtn.primary {
  background: var(--cf-color-primary);
  border-color: var(--cf-color-primary);
}
.cfPreflightBtn.primary:hover {
  background: var(--cf-color-primary-hover);
}

/* aksesibilitas: hormati prefers-reduced-motion untuk komponen v101 */
@media (prefers-reduced-motion: reduce) {
  body.yvStandalone .cfOutputChip {
    transition: none;
  }
}
