/* Concepts V8 — Shared Stash panel + point-to-fill styles.
   Companion to stash.js. The stash is the shared cloud list both Visualizer V3
   and Concepts see (Firestore `shared_stash`). Theme: dark glass, cyan = cloud,
   purple = grab/aim, green = confirmed fill. */

/* ---- Trigger pill (bottom-left, away from the Edit-Mode toggle/Save btn) ---- */
.cstash-pill {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 99000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(56,189,248,0.95), rgba(99,102,241,0.95));
  border: 1px solid rgba(56,189,248,0.7);
  color: #fff;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(56,189,248,0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cstash-pill:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(56,189,248,0.55); }
.cstash-pill .cstash-count {
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: rgba(255,255,255,0.25);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}

/* ---- Panel ---- */
.cstash-panel {
  position: fixed;
  left: 20px;
  bottom: 72px;
  z-index: 99001;
  width: 340px;
  max-height: 76vh;
  display: flex;
  flex-direction: column;
  background: #14141c;
  border: 1px solid rgba(56,189,248,0.45);
  border-radius: 14px;
  box-shadow: 0 18px 52px rgba(0,0,0,0.6);
  color: #e2e8f0;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.cstash-panel[hidden] { display: none; }

.cstash-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 13px;
  border-bottom: 1px solid rgba(56,189,248,0.22);
  background: rgba(56,189,248,0.08);
}
.cstash-head .cstash-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em; color: #bae6fd;
}
.cstash-iconbtn {
  background: transparent; border: none; color: #94a3b8;
  cursor: pointer; padding: 4px; border-radius: 6px;
  display: inline-flex; align-items: center;
}
.cstash-iconbtn:hover { background: rgba(255,255,255,0.08); color: #e2e8f0; }

.cstash-tools { padding: 9px 11px; display: flex; flex-direction: column; gap: 8px;
  border-bottom: 1px solid rgba(56,189,248,0.16); }
.cstash-row { display: flex; gap: 6px; align-items: center; }
.cstash-input {
  flex: 1; min-width: 0; font-size: 12px; padding: 7px 9px;
  border-radius: 8px; background: rgba(0,0,0,0.3);
  border: 1px solid rgba(148,163,184,0.25); color: #e2e8f0; outline: none;
}
.cstash-input:focus { border-color: rgba(56,189,248,0.6); }
.cstash-btn {
  font-size: 12px; font-weight: 600; padding: 7px 10px; border-radius: 8px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  background: rgba(56,189,248,0.18); color: #bae6fd;
  border: 1px solid rgba(56,189,248,0.5);
}
.cstash-btn:hover { background: rgba(56,189,248,0.28); }
.cstash-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.cstash-btn.cstash-grab.is-on { background: rgba(168,85,247,0.28); color: #e9d5ff; border-color: rgba(168,85,247,0.6); }

.cstash-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.cstash-chip {
  font-size: 11px; padding: 4px 9px; border-radius: 999px; cursor: pointer;
  background: transparent; color: #94a3b8; border: 1px solid rgba(148,163,184,0.25);
  text-transform: capitalize;
}
.cstash-chip.is-active { background: rgba(56,189,248,0.2); color: #bae6fd; border-color: rgba(56,189,248,0.5); }

/* ---- Body / list ---- */
.cstash-body { overflow-y: auto; flex: 1; padding: 8px; }
.cstash-empty { padding: 28px 14px; text-align: center; color: #64748b; font-size: 12.5px; line-height: 1.5; }
.cstash-empty strong { color: #7dd3fc; }
.cstash-list { display: flex; flex-direction: column; gap: 6px; }

.cstash-item {
  display: flex; gap: 9px; padding: 7px; border-radius: 9px;
  background: rgba(56,189,248,0.06); border: 1px solid rgba(56,189,248,0.22);
}
.cstash-thumb {
  width: 56px; height: 56px; flex-shrink: 0; border-radius: 7px;
  background: #0c0c12; overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: #7dd3fc;
}
.cstash-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cstash-thumb .cstash-textprev {
  font-size: 9px; line-height: 1.2; padding: 4px; color: #cbd5e1;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
}
.cstash-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.cstash-metatop { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.cstash-kind { font-size: 11px; color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cstash-kind b { color: #7dd3fc; text-transform: capitalize; }
.cstash-actions { display: flex; gap: 5px; }
.cstash-fill {
  flex: 1; font-size: 11.5px; font-weight: 600; padding: 6px 8px; border-radius: 7px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  background: rgba(34,197,94,0.18); color: #bbf7d0; border: 1px solid rgba(34,197,94,0.45);
}
.cstash-fill:hover { background: rgba(34,197,94,0.28); }

/* ---- Aim / fill targets (point-to-fill) ---- */
body.stash-aim-active { cursor: crosshair; }
.stash-fill-target {
  outline: 2px dashed #38bdf8 !important;
  outline-offset: 2px !important;
  cursor: copy !important;
  transition: outline-color 0.12s ease, background 0.12s ease;
}
.stash-fill-target:hover {
  outline-color: #22c55e !important;
  background: rgba(56,189,248,0.12) !important;
}

/* ---- Grab-from-page (push) mode ---- */
body.stash-grab-active img {
  outline: 2px dashed #a855f7 !important;
  outline-offset: 2px;
  cursor: copy !important;
}

/* brief confirmation flash applied to a filled/grabbed element */
.stash-flash { animation: cstashFlash 0.7s ease; }
@keyframes cstashFlash {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.7); }
  100% { box-shadow: 0 0 0 14px rgba(34,197,94,0); }
}

/* ---- Toast ---- */
.cstash-toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  z-index: 99002; padding: 9px 16px; border-radius: 999px;
  background: rgba(15,23,42,0.95); color: #e2e8f0; font-size: 12.5px; font-weight: 600;
  border: 1px solid rgba(56,189,248,0.5); box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  pointer-events: none; opacity: 0; transition: opacity 0.18s ease;
  display: inline-flex; align-items: center; gap: 8px;
}
.cstash-toast.is-show { opacity: 1; }
