/* Interactive copy of the Clipboard Orbit popup, scoped to .chp-demo. */

.chp-demo {
  --d-bg: #ffffff;
  --d-text: #1a1a2e;
  --d-muted: #5b6472;
  --d-border: #e9ecef;
  --d-hover: #f3f4f6;
  --d-soft: #f8f9fa;
  --d-accent: #7c3aed;
  --d-accent-soft: #f3e8ff;
  --d-danger: #dc2626;
  --d-copied: #d8f8e6;

  position: relative;
  width: 100%;
  max-width: 400px;
  min-width: 0;
  margin: 0 auto;
  height: 520px;
  display: flex;
  flex-direction: column;
  background: var(--d-bg);
  color: var(--d-text);
  border: 1px solid var(--d-border);
  border-radius: 14px;
  box-shadow: 0 20px 44px rgba(15, 43, 70, 0.14);
  font-family: -apple-system, "Segoe UI", "Noto Sans", "DejaVu Sans", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

.chp-demo * { box-sizing: border-box; }

.chp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--d-border);
  flex: 0 0 auto;
}

.chp-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-weight: 650;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.chp-brand span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.chp-brand img { width: 20px; height: 20px; border-radius: 5px; flex: 0 0 auto; }

.chp-tools { display: flex; align-items: center; gap: 2px; }

.chp-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--d-muted);
  cursor: pointer;
}

.chp-icon:hover { background: var(--d-hover); color: var(--d-text); }

.chp-search {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 10px 12px 8px;
  padding: 0 9px;
  height: 34px;
  background: var(--d-soft);
  border: 1px solid var(--d-border);
  border-radius: 8px;
  flex: 0 0 auto;
}

.chp-search svg { color: var(--d-muted); flex: 0 0 auto; }

.chp-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  color: var(--d-text);
  outline: none;
}

.chp-search input::placeholder { color: #9aa4b2; }

.chp-counter {
  font-size: 11.5px;
  color: var(--d-muted);
  white-space: nowrap;
  flex: 0 0 auto;
}

.chp-clear-search {
  display: none;
  border: 0;
  background: transparent;
  color: var(--d-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 5px;
}

.chp-clear-search:hover { background: var(--d-border); color: var(--d-text); }
.chp-demo.has-query .chp-clear-search { display: inline-flex; }

.chp-tabs {
  display: flex;
  gap: 2px;
  padding: 0 8px;
  border-bottom: 1px solid var(--d-border);
  flex: 0 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.chp-tabs::-webkit-scrollbar { display: none; }

.chp-tab {
  border: 0;
  background: transparent;
  color: var(--d-muted);
  font: inherit;
  font-size: 13px;
  padding: 8px 10px 9px;
  border-radius: 7px 7px 0 0;
  cursor: pointer;
  white-space: nowrap;
}

.chp-tab:hover { background: var(--d-hover); color: var(--d-text); }

.chp-tab.is-active {
  color: var(--d-accent);
  background: var(--d-soft);
  font-weight: 650;
}

.chp-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 8px 8px;
  overscroll-behavior: contain;
}

.chp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
}

.chp-item:hover,
.chp-item:focus-within { background: var(--d-hover); }

.chp-item.is-pinned { box-shadow: inset 3px 0 0 var(--d-accent); }

.chp-item.is-copied { background: var(--d-copied); }

.chp-item-main { flex: 1 1 auto; min-width: 0; }

.chp-item-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13.5px;
}

.chp-item-title { font-weight: 650; font-size: 13.5px; }

.chp-item-sub {
  color: var(--d-muted);
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chp-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.chp-time { font-size: 11px; color: var(--d-muted); }

.chp-badge {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--d-accent);
  background: var(--d-accent-soft);
  border-radius: 4px;
  padding: 1px 5px;
}

.chp-actions {
  display: flex;
  gap: 3px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.chp-move {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chp-grid {
  display: grid;
  grid-template-rows: repeat(2, 22px);
  grid-auto-flow: column;
  grid-auto-columns: 22px;
  gap: 2px;
}

.chp-item:hover .chp-actions,
.chp-item:focus-within .chp-actions,
.chp-item.is-pinned .chp-actions { opacity: 1; }

.chp-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--d-muted);
  cursor: pointer;
}

.chp-action:hover { background: var(--d-border); color: var(--d-text); }

.chp-action.is-on { color: var(--d-accent); }
.chp-action.is-danger:hover { background: #fde8e8; color: var(--d-danger); }

.chp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  min-height: 220px;
  text-align: center;
  color: var(--d-muted);
  padding: 20px;
}

.chp-empty svg { color: #c3ccd8; }

.chp-empty-title { font-weight: 650; color: var(--d-text); font-size: 14px; }

.chp-empty-desc { font-size: 12.5px; max-width: 28ch; }

.chp-primary {
  margin-top: 8px;
  border: 0;
  border-radius: 7px;
  background: var(--d-accent);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
}

.chp-primary:hover { filter: brightness(0.94); }

.chp-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 8px;
  flex: 0 0 auto;
}

.chp-filters.is-hidden { display: none; }

.chp-chip {
  border: 1px solid var(--d-border);
  background: #fff;
  color: var(--d-muted);
  font: inherit;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.chp-chip:hover { border-color: var(--d-accent); color: var(--d-accent); }

.chp-chip.is-active {
  background: var(--d-accent-soft);
  border-color: var(--d-accent);
  color: var(--d-accent);
  font-weight: 600;
}

.chp-lang {
  font-size: 11px;
  font-weight: 700;
  color: var(--d-muted);
  border: 1px solid var(--d-border);
  border-radius: 6px;
  padding: 2px 5px;
  letter-spacing: 0.04em;
}

.chp-thumb {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--d-border);
  flex: 0 0 auto;
  background: #eef2f7;
}

.chp-action { width: 22px; height: 22px; }
.chp-action svg { width: 13px; height: 13px; }

.chp-modal {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 6;
}

.chp-modal.is-open { display: flex; }

.chp-modal-card {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 340px;
  max-height: 100%;
  overflow: hidden;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.25);
}

.chp-modal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--d-border);
  font-weight: 650;
  font-size: 13.5px;
}

.chp-modal-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chp-modal-close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--d-muted);
  cursor: pointer;
  padding: 3px;
  border-radius: 5px;
  display: inline-flex;
}

.chp-modal-close:hover { background: var(--d-hover); color: var(--d-text); }

.chp-modal-img {
  padding: 10px;
  background: #f8fafc;
  display: flex;
  justify-content: center;
}

.chp-modal-img img {
  max-width: 100%;
  max-height: 220px;
  border-radius: 8px;
  border: 1px solid var(--d-border);
}

.chp-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 12px 12px;
}

.chp-btn {
  border: 1px solid var(--d-border);
  background: #fff;
  color: var(--d-text);
  border-radius: 7px;
  padding: 7px 10px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}

.chp-btn:hover { border-color: var(--d-accent); }

.chp-btn.primary {
  background: var(--d-accent);
  border-color: var(--d-accent);
  color: #fff;
  font-weight: 600;
}

.chp-btn.soft-danger { color: var(--d-danger); }

.chp-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-top: 1px solid var(--d-border);
  background: var(--d-bg);
  flex: 0 0 auto;
}

.chp-watch {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--d-muted);
  cursor: pointer;
}

.chp-switch {
  position: relative;
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: #d8dee7;
  transition: background 0.15s ease;
}

.chp-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.chp-watch input { position: absolute; opacity: 0; pointer-events: none; }

.chp-watch input:checked + .chp-switch { background: var(--d-accent); }
.chp-watch input:checked + .chp-switch::after { transform: translateX(13px); }

.chp-watch input:focus-visible + .chp-switch { outline: 2px solid var(--d-accent); outline-offset: 2px; }

.chp-text {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--d-muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
  white-space: nowrap;
}

.chp-text + .chp-text { margin-left: 0; }

.chp-text:hover { background: var(--d-hover); color: var(--d-text); }

.chp-toast {
  position: absolute;
  left: 50%;
  bottom: 52px;
  transform: translate(-50%, 6px);
  background: #1a1a2e;
  color: #fff;
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  white-space: nowrap;
  max-width: calc(100% - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 8;
}

.chp-toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 620px) {
  .chp-demo { height: 480px; }
  .chp-modal { padding: 10px; }
  .chp-modal-img img { max-height: 150px; }
  .chp-modal-actions { padding: 8px 10px 10px; gap: 6px; }
}
