/* Centered popups, command palette, settings, toasts.
 * Backdrop uses `backdrop-filter: blur(4px)` per plan visual-design spec.
 * Esc + backdrop-click both close (handled in app.js). */

/* ───────────── Backdrop ───────────── */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 160ms ease-out;
}

.modal-backdrop[data-hidden="true"] { display: none; }

/* ───────────── Modal shell ───────────── */

.modal {
  background: var(--bg-popover);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elev-2);
  max-width: 480px;
  width: calc(100% - 48px);
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 180ms ease-out;
}

.modal-lg  { max-width: 640px; }
.modal-xl  { max-width: 800px; }
.modal-sm  { max-width: 360px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.modal-title {
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--text-primary);
}
.modal-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color 120ms ease-out, background 120ms ease-out;
}
.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.modal-close svg { width: 16px; height: 16px; }

.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
  font-size: var(--fs-base);
  color: var(--text-secondary);
  line-height: var(--lh-normal);
}
.modal-body p + p { margin-top: 10px; }
.modal-body strong { color: var(--text-primary); font-weight: 600; }
.modal-body code, .modal-body .mono {
  font-family: var(--font-mono);
  background: var(--bg-base);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-shrink: 0;
}
.modal-footer .spacer { flex: 1; }

/* ───────────── Command palette (Cmd+K) ───────────── */

.cmdk {
  background: var(--bg-popover);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elev-2);
  max-width: 560px;
  width: calc(100% - 48px);
  max-height: calc(100vh - 200px);
  margin-top: -10vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 180ms ease-out;
}
.cmdk-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.cmdk-input-wrap svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.cmdk-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
}
.cmdk-input::placeholder { color: var(--text-muted); }

.cmdk-results {
  overflow-y: auto;
  max-height: 360px;
  padding: 4px;
}
.cmdk-section {
  padding: 6px 8px 2px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  user-select: none;
  transition: background 80ms ease-out;
}
.cmdk-item:hover,
.cmdk-item[data-active="true"] {
  background: var(--bg-active);
  color: var(--text-primary);
}
.cmdk-item svg.cmdk-icon {
  width: 14px;
  height: 14px;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.cmdk-item[data-active="true"] svg.cmdk-icon { color: var(--accent); }
.cmdk-item .cmdk-label { flex: 1; }
.cmdk-item .cmdk-hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.cmdk-item .cmdk-kbd {
  display: inline-flex;
  gap: 2px;
}
.cmdk-item kbd {
  display: inline-block;
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
}
.cmdk-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-style: italic;
}

/* ───────────── Toasts ───────────── */

.toast-stack {
  position: fixed;
  top: 60px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1100;
  pointer-events: none;
  max-width: 360px;
}

.toast {
  background: var(--bg-popover);
  border: 1px solid var(--border-strong);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  box-shadow: var(--shadow-elev-2);
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 280px;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info    { border-left-color: var(--info); }

.toast .toast-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}
.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    .toast-icon { color: var(--info); }

.toast-content { flex: 1; min-width: 0; }
.toast-title {
  font-weight: 600;
  margin-bottom: 2px;
}
.toast-msg {
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  line-height: 1.4;
  word-break: break-word;
}
.toast-msg a {
  color: var(--accent);
  border-bottom: 1px dashed transparent;
}
.toast-msg a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

.toast-close {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.toast-close:hover { color: var(--text-primary); background: var(--bg-hover); }
.toast-close svg { width: 12px; height: 12px; }

/* ───────────── Approval-flow popup (DC_DEPLOY/DC_CALL_*/SITE_PUBLISH preview) ─────────────
 * The wallet renders the REAL approval modal — this is just the IDE's
 * preview/confirmation of what the wallet will show. Per IDE-9 we never
 * try to replicate the wallet's renderer; this just summarizes args. */

.approval-preview {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  margin: 8px 0 16px;
  color: var(--text-primary);
}
.approval-preview .ap-row {
  display: flex;
  gap: 12px;
  padding: 3px 0;
}
.approval-preview .ap-key {
  color: var(--text-secondary);
  min-width: 100px;
}
.approval-preview .ap-val {
  flex: 1;
  word-break: break-all;
}
.approval-preview .ap-fee {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}
.approval-preview .ap-fee-amount {
  color: var(--accent);
  font-weight: 700;
}
.approval-preview .ap-reserve-note {
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  color: var(--accent);
  margin-top: 4px;
}

/* ───────────── Publish-wizard step indicator ───────────── */

.wizard-steps {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 0 14px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 12px;
}
.wizard-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.wizard-step .num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wizard-step.active {
  color: var(--accent);
}
.wizard-step.active .num {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}
.wizard-step.done {
  color: var(--success);
}
.wizard-step.done .num {
  background: var(--success);
  color: var(--text-inverse);
  border-color: var(--success);
}
.wizard-arrow {
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ───────────── Connect-wallet explainer (used when window.monerousd is absent) ───────────── */

.connect-explainer {
  text-align: center;
  padding: 8px 4px;
}
.connect-explainer img {
  width: 64px;
  height: 64px;
  opacity: 0.85;
  margin-bottom: 12px;
}
.connect-explainer h3 {
  font-size: var(--fs-lg);
  color: var(--text-primary);
  margin-bottom: 8px;
}
.connect-explainer p {
  margin-bottom: 8px;
}
.connect-explainer ol {
  text-align: left;
  margin: 12px auto;
  max-width: 360px;
  padding-left: 24px;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}
.connect-explainer ol li { margin-bottom: 4px; }
.connect-explainer .download-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
