/* save_points.css — Save Point dropdown, rollback modal, conflict banner, unsatisfied hint */

/* ── Dropdown trigger (top-right of preview tabs) ── */
.sp-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
}
/* 游客分享模式不展示版本入口（与 .pvt-actions 对齐） */
body.guest-mode .sp-dropdown { display: none !important; }
.sp-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg2);
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.sp-dropdown-btn:hover { background: var(--bg3); color: var(--text); }
.sp-dropdown-btn.sp-historical {
  background: var(--bg3);
  border-color: var(--border);
  color: var(--text);
}
.sp-dropdown-btn .sp-caret {
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  opacity: .7;
}
.sp-dropdown-btn[disabled],
.sp-dropdown-btn.disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Dropdown menu ── */
.sp-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 300px;
  max-width: 380px;
  max-height: 400px;
  overflow-y: auto;
  padding: 6px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 1000;
}
.sp-item {
  padding: 8px 10px;
  margin: 2px 0;
  border-radius: 6px;
  cursor: default;
  border: 1px solid transparent;
}
.sp-item:hover { background: var(--bg3); }
.sp-item.sp-active { background: var(--accent-glow); border-color: var(--accent); }
.sp-item.sp-latest { border-left: 2px solid var(--green); }
.sp-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 3px;
}
.sp-icon { font-size: 13px; }
.sp-seq { font-weight: 600; color: var(--text); }
.sp-time { margin-left: auto; color: var(--text3); font-size: 11px; }
.sp-tag {
  display: inline-block;
  padding: 0 6px;
  font-size: 10px;
  border-radius: 8px;
  line-height: 16px;
}
.sp-tag-latest { background: rgba(124,133,148,0.12); color: var(--green); }
.sp-tag-rollback { background: var(--bg3); color: var(--text2); }
.sp-desc {
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
  margin-bottom: 4px;
}
.sp-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.sp-btn {
  padding: 3px 10px;
  font-size: 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
  cursor: pointer;
}
.sp-btn:hover:not([disabled]) { background: var(--bg3); color: var(--text); }
.sp-btn-rollback {
  border-color: var(--border);
  color: var(--text2);
}
.sp-btn-rollback:hover:not([disabled]) { background: var(--bg3); color: var(--text); }
.sp-btn[disabled] { opacity: .4; cursor: not-allowed; }

/* ── Clickable item (preview on click) ── */
.sp-item { cursor: pointer; }
.sp-item.sp-active { cursor: default; }

/* ── Rollback confirm modal ── */
.sp-modal-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.sp-modal-mask.visible { display: flex; }
.sp-modal {
  background: var(--bg2);
  border-radius: 10px;
  padding: 18px 20px;
  min-width: 360px;
  max-width: 480px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.sp-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}
.sp-modal-body {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
}
.sp-modal-target {
  margin: 10px 0;
  padding: 8px 10px;
  background: var(--bg3);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
}
.sp-modal-target span { color: var(--text2); }
.sp-modal-error {
  display: none;
  margin-top: 10px;
  padding: 6px 10px;
  background: rgba(239,68,68,0.08);
  border-left: 2px solid var(--red);
  border-radius: 4px;
  font-size: 12px;
  color: var(--red);
}
.sp-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.sp-modal-actions button {
  padding: 6px 16px;
  font-size: 13px;
  border-radius: 14px;
  cursor: pointer;
}
.sp-modal-cancel {
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text2);
}
.sp-modal-cancel:hover { background: var(--bg3); }
.sp-modal-confirm {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}
.sp-modal-confirm:hover:not([disabled]) { filter: brightness(0.95); }
.sp-modal-confirm[disabled] { opacity: .6; cursor: wait; }

/* ── Conflict banner (top of chat when foreign write detected) ── */
.sp-conflict-banner {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 6px 10px 0;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  font-size: 12px;
  color: var(--red);
}
.sp-conflict-banner button {
  margin-left: auto;
  padding: 3px 12px;
  font-size: 11px;
  border: 1px solid var(--red);
  border-radius: 10px;
  background: transparent;
  color: var(--red);
  cursor: pointer;
}
.sp-conflict-banner button:hover { background: rgba(239,68,68,0.15); }

/* ── Session conflict modal (multi-tab concurrent edit) ──
   Blocking modal for 409 SESSION_CONFLICT / STALE_VIEW / VERSION_CONFLICT.
   Mask click does NOT close — user must click Refresh to sync state. */
.session-conflict-modal { position: fixed; inset: 0; z-index: 1000; }
.session-conflict-modal .scm-mask {
  position: absolute; inset: 0; background: rgba(0,0,0,.4);
}
.session-conflict-modal .scm-dialog {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 420px; max-width: calc(100vw - 32px);
  background: var(--bg-elevated, #fff);
  color: var(--text-primary, #1a1a1a);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,.15);
}
.session-conflict-modal .scm-title {
  font-weight: 600; font-size: 16px;
  margin-bottom: 12px;
}
.session-conflict-modal .scm-body {
  color: var(--text-secondary, #555);
  line-height: 1.6;
  margin-bottom: 20px;
  font-size: 14px;
}
.session-conflict-modal .scm-actions {
  display: flex; justify-content: flex-end;
}
.session-conflict-modal .scm-actions button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border: 0; border-radius: 6px;
  background: var(--accent, #2b6cff);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
}
.session-conflict-modal .scm-actions button:hover { filter: brightness(1.05); }
.session-conflict-modal .scm-actions svg { width: 16px; height: 16px; }

/* ── Loading state for dropdown/export buttons while Agent is running ── */
.sp-dropdown-btn.sp-loading,
.pvt-export-btn.sp-loading {
  opacity: .7;
  cursor: wait;
  pointer-events: none;
}
.sp-dropdown-btn.sp-loading .sp-caret { display: none; }
.sp-dropdown-btn.sp-loading::after,
.pvt-export-btn.sp-loading::after {
  content: '';
  width: 10px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: sp-spin .7s linear infinite;
  margin-left: 4px;
  display: inline-block;
}
@keyframes sp-spin { to { transform: rotate(360deg); } }
