/* PostHog UI — topbar button, status strip, connect modal,
   provenance hints on surface cards. */

/* topbar connect button */
.tb-connect {
  border: 1px solid #2a2336; background: #0d0a13;
  color: #c7b5ff; font-size: 11.5px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px; white-space: nowrap;
}
.tb-connect:hover { border-color: #c7b5ff; }
.tb-connect.on {
  color: #a9e5c2; border-color: #a9e5c2;
  background: rgba(169,229,194,.08);
}

/* status strip — slim one-liner with proper gaps */
.ph-strip { margin: 0 0 14px; }
.ph-strip-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 10px; font-size: 12px;
  flex-wrap: wrap;
}
.ph-strip-disconnected {
  background: #f7f3eb; border: 1px dashed #e2dccf; color: #6a6477;
}
.ph-strip-loading {
  background: #f7f3eb; border: 1px solid #e2dccf; color: #6a6477;
}
.ph-strip-connected {
  background: #ecfae3; border: 1px solid #b8e0a5; color: #2d4f1d;
}
.ph-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px;
}
.ph-dot.off { background: #c0b8a8; }
.ph-dot.loading { background: #c7b5ff; animation: phPulse 1.4s ease-in-out infinite; }
.ph-dot.live {
  background: #1f7a4a; box-shadow: 0 0 6px rgba(31,122,74,.6);
  animation: phPulse 1.6s ease-in-out infinite;
}
@keyframes phPulse {
  0%,100% { opacity: .65; transform: scale(.85); }
  50%     { opacity: 1;   transform: scale(1.1); }
}
.ph-strip-msg { color: #6a6477; }
.ph-strip-label { color: #1f4a2a; font-weight: 600; }
.ph-strip-sep   { color: #8aaa7a; }
.ph-strip-counters {
  font-family: "JetBrains Mono", monospace; font-size: 11.5px;
  color: #2c6a44;
}
.ph-strip-counters b { color: #1f4a2a; }
.ph-strip-counters.warn b { color: #b54e0a; }
.ph-strip-time {
  font-family: "JetBrains Mono", monospace; font-size: 11px;
  color: #6a8a5a;
}
.ph-strip-actions { display: flex; gap: 4px; margin-left: auto; }
.ph-strip-actions .p-btn { padding: 3px 10px; font-size: 11.5px; }
.p-btn-sm { padding: 3px 10px; font-size: 11.5px; }


/* "from PostHog" chip + provenance line */
.p-chip.ph {
  background: #ede5ff; color: #4a3585;
}
.p-chip.local {
  background: #fff6e8; color: #7a5c1a;
}
.p-provenance {
  margin-top: -2px; margin-bottom: 8px;
  font-size: 11.5px; color: #6a6477;
  font-family: "JetBrains Mono", monospace;
}
.p-provenance code {
  background: #ede5ff; color: #4a3585;
  padding: 1px 6px; border-radius: 4px;
}
.p-prov-mode { color: #9c93a6; }

/* connect modal */
.ph-modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.ph-modal[hidden] { display: none; }
.ph-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(11,9,16,.6);
  backdrop-filter: blur(2px);
}
.ph-modal-body {
  position: relative;
  background: #fff; color: #14101c;
  width: min(520px, 92vw);
  max-height: 86vh; overflow-y: auto;
  border-radius: 14px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.6);
  padding: 22px 24px 18px;
}
.ph-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.ph-modal-head h2 {
  font-family: "Fraunces", Georgia, serif; font-weight: 560;
  font-size: 22px; margin: 0;
}
.ph-modal-x {
  border: 0; background: transparent; font-size: 22px; line-height: 1;
  color: #79708a; padding: 4px 8px; border-radius: 6px;
}
.ph-modal-x:hover { background: #f3eee6; color: #14101c; }
.ph-modal-lede {
  color: #6a6477; font-size: 13px; line-height: 1.5; margin: 0 0 14px;
}
.ph-modal-lede code {
  font-family: "JetBrains Mono", monospace; font-size: 12px;
  background: #f3eee6; padding: 1px 5px; border-radius: 4px; color: #2c2737;
}

/* encoded-project shortcut */
.ph-encoded {
  background: linear-gradient(155deg, #f1ebff 0%, #ecfae3 100%);
  border: 1px solid #d6cdf3;
  border-radius: 10px;
  padding: 12px 14px; margin-bottom: 12px;
}
.ph-encoded-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.ph-encoded-title { font-weight: 600; font-size: 13px; color: #14101c; }
.ph-encoded-spark { color: #6e5aa8; }
.ph-encoded-sub {
  font-size: 11.5px; color: #6a6477; margin-top: 2px;
  font-family: "Inter", sans-serif;
}
.ph-encoded-sub code {
  font-family: "JetBrains Mono", monospace;
  background: rgba(255,255,255,.6); padding: 1px 5px; border-radius: 4px;
  color: #4a3a7a;
}
.ph-encoded-explain {
  margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; color: #6a6477;
}

/* "or use your own" divider */
.ph-or {
  position: relative; text-align: center; margin: 4px 0 12px;
}
.ph-or::before, .ph-or::after {
  content: ''; position: absolute; top: 50%; width: 38%; height: 1px;
  background: #e2dccf;
}
.ph-or::before { left: 0; }
.ph-or::after  { right: 0; }
.ph-or span {
  display: inline-block; background: #fff; padding: 0 10px;
  font-size: 11px; color: #9c93a6;
  font-family: "JetBrains Mono", monospace;
}
.ph-field {
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 10px;
}
.ph-field[hidden] { display: none; }
.ph-field span {
  font-size: 12px; font-weight: 600; color: #2c2737;
}
.ph-field span small {
  font-weight: 400; color: #9c93a6; margin-left: 6px;
}
.ph-field input, .ph-field select {
  width: 100%;
  font-family: "JetBrains Mono", monospace; font-size: 12.5px;
  background: #f7f3eb; border: 1px solid #e2dccf; border-radius: 8px;
  padding: 8px 10px; color: #14101c;
}
.ph-field input:focus, .ph-field select:focus {
  outline: 2px solid #c7b5ff; outline-offset: -1px; background: #fff;
}
.ph-advanced { margin-top: 8px; }
.ph-advanced summary {
  cursor: pointer; font-size: 12px; color: #6a6477;
  font-family: "JetBrains Mono", monospace;
  padding: 6px 0;
}
.ph-modal-status {
  min-height: 18px; padding: 6px 0;
  font-family: "JetBrains Mono", monospace; font-size: 12px;
  color: #6a6477;
}
.ph-modal-status.ok  { color: #1f7a4a; }
.ph-modal-status.err { color: #c54a4a; }
.ph-modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 8px;
}


/* ============================================================
 * Connected panel — appears in the modal when PostHog is live.
 * Shows host + flag counters and the manage actions (Emit
 * manifest / Refresh / Disconnect). Credentials form is hidden
 * underneath; "Use different credentials" reveals it.
 * ============================================================ */
.ph-connected {
  padding: 4px 0 18px;
  border-bottom: 1px dashed #e2dccf;
  margin-bottom: 16px;
}
.ph-connected[hidden] { display: none; }
.ph-connected-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: #f7f3eb;
  border: 1px solid #e2dccf;
  border-radius: 10px;
  margin-bottom: 12px;
}
.ph-connected-dot {
  display: inline-block;
  width: 10px; height: 10px; border-radius: 50%;
  background: #2d8a3a;
  box-shadow: 0 0 0 3px rgba(45,138,58,0.18);
  flex: 0 0 10px;
}
.ph-connected-summary { flex: 1; min-width: 0; }
.ph-connected-host {
  font-family: "JetBrains Mono", monospace; font-size: 13px;
  font-weight: 600; color: #14101c;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ph-connected-stats {
  font-family: "JetBrains Mono", monospace; font-size: 11.5px;
  color: #6a6477; margin-top: 2px;
}
.ph-connected-stats b { color: #14101c; font-weight: 600; }

.ph-connected-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 10px;
}

.ph-credentials-toggle {
  display: inline-block;
  border: 0; background: transparent;
  color: #4a3585; font-size: 12px; font-weight: 600;
  padding: 4px 0;
  cursor: pointer;
  border-bottom: 1px dashed #c7b5ff;
}
.ph-credentials-toggle:hover { color: #6843c4; border-bottom-style: solid; }

.ph-credentials[hidden] { display: none; }

/* Mobile polish.
 *   - 16px form fields stop iOS Safari from zooming on focus.
 *   - .ph-encoded-row gets wrap so the Enable/Disable button drops
 *     beneath the label instead of colliding with it on narrow modals.
 *   - .tb-connect grows to the touch-min target. The other topbar
 *     pills already become full-width inside the hamburger dropdown,
 *     so they're fine. */
@media (max-width: 640px) {
  .ph-field input, .ph-field select { font-size: 16px; padding: 10px 12px; }
  .ph-encoded-row { flex-wrap: wrap; }
  .ph-encoded-row > div { flex: 1 1 200px; }
  .tb-connect { min-height: var(--touch-min); padding-inline: 14px; }
}
