/*
 * Add/Edit dialog + system confirm overlay + preview.
 */

dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  width: min(720px, calc(100vw - 24px));
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  position: relative; /* anchor in-dialog overlays */
}
dialog::backdrop { background: rgba(0,0,0,0.55); }

[x-cloak] { display: none !important; }

/* System alert/confirm modal overlay */
.sysOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 12px;
}
.sysOverlay.sysOverlayInDlg {
  position: absolute;
  inset: 0;
  z-index: 50;
  padding: 14px;
}
.sysBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}
.sysSheet {
  position: relative;
  width: min(520px, calc(100vw - 24px));
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}
.sysDlgHead {
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.sysDlgHead strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}
.sysCloseBtn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}
@media (prefers-color-scheme: light) {
  .sysCloseBtn {
    background: rgba(255, 255, 255, 0.55);
    color: #0b1220;
  }
}
.sysDlgBody {
  padding: 14px;
}
.sysDlgMsg {
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 13px;
  color: var(--text);
}
.sysDlgActions {
  padding: 12px 14px 14px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.dlgHead {
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.dlgHead strong {
  font-size: 14px;
  letter-spacing: -0.01em;
}
.dlgBody {
  padding: 14px;
  display: grid;
  gap: 14px;
}

/* Filled-field affordance in add/edit dialog (scoped to #form, not sidebar filters) */
#form input[type="text"]:not(:placeholder-shown):not(:focus),
#form input[type="url"]:not(:placeholder-shown):not(:focus),
#form textarea:not(:placeholder-shown):not(:focus) {
  border-color: color-mix(in srgb, var(--good) 52%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--good) 28%, transparent);
}

#form select:has(option:checked:not([value=""])):not(:focus) {
  border-color: color-mix(in srgb, var(--good) 52%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--good) 28%, transparent);
}

#form input[type="date"].fieldFilled:not(:focus) {
  border-color: color-mix(in srgb, var(--good) 52%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--good) 28%, transparent);
}

@media (prefers-color-scheme: light) {
  #form input[type="text"]:not(:placeholder-shown):not(:focus),
  #form input[type="url"]:not(:placeholder-shown):not(:focus),
  #form textarea:not(:placeholder-shown):not(:focus),
  #form select:has(option:checked:not([value=""])):not(:focus),
  #form input[type="date"].fieldFilled:not(:focus) {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--good) 35%, rgba(17, 24, 39, 0.12));
  }
}

.callout {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}
.callout strong {
  font-size: 13px;
  letter-spacing: -0.01em;
}
.callout code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New";
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}
.calloutInfo {
  border-left: 3px solid rgba(96, 165, 250, 0.9);
}
@media (prefers-color-scheme: light) {
  .callout {
    border-color: rgba(17, 24, 39, 0.16);
    background: rgba(17, 24, 39, 0.03);
  }
  .callout code {
    border-color: rgba(17, 24, 39, 0.14);
    background: rgba(17, 24, 39, 0.06);
  }
  .calloutInfo {
    border-left-color: rgba(37, 99, 235, 0.85);
  }
}

/* Visually separate conditional sections in modals */
.modalExtra {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent 40%);
  border-radius: 12px;
  padding-left: 10px;
  padding-right: 10px;
}
@media (prefers-color-scheme: light) {
  .modalExtra {
    border-top-color: rgba(17, 24, 39, 0.16);
    background: linear-gradient(180deg, rgba(17,24,39,0.03), transparent 40%);
  }
}
.dlgActions {
  padding: 12px 14px 14px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.dlgActionsEnd {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.dlgBtnGroup {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.addStepUrl,
.addStepLoading {
  display: grid;
  gap: 18px;
}

/* Step 2 full form vertical rhythm (between fields/sections) */
.addStepDetails {
  display: grid;
  gap: 22px;
}

.addStepLoading {
  justify-items: center;
  text-align: center;
  padding: 8px 0 16px;
}

.enrichSpinner {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: enrichSpin 0.75s linear infinite;
}

@keyframes enrichSpin {
  to {
    transform: rotate(360deg);
  }
}

.enrichStatus {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.enrichHintRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: baseline;
  margin-top: -14px; /* visually attaches to the link inputs above */
  margin-bottom: -6px; /* avoids looking like its own “field” */
}

.enrichHintBtns {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.textLinkBtn {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  height: auto;
  min-height: 0;
  white-space: normal;
  text-align: left;
}

.textLinkBtn:hover {
  color: var(--text);
}

.enrichWarn {
  margin: 0;
  color: var(--warn);
}

/* Prominent add-flow notice when enrich didn’t return trusted fields */
.enrichBanner {
  display: grid;
  gap: 8px;
  margin: 0 0 2px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 55%, var(--border));
  background: color-mix(in srgb, var(--warn) 18%, var(--panel2));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 25%, transparent);
}
.enrichBannerLabel {
  display: block;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--warn);
}
.enrichBannerBody {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-line;
}
@media (prefers-color-scheme: light) {
  .enrichBanner {
    border-color: color-mix(in srgb, var(--warn) 45%, rgba(17, 24, 39, 0.2));
    background: color-mix(in srgb, var(--warn) 22%, #fff);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--warn) 35%, transparent);
  }
}

.listingPreview {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel2);
}
@media (max-width: 720px) {
  .listingPreview {
    grid-template-columns: 1fr;
  }
}

.listingPreviewMedia {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    radial-gradient(600px 200px at 30% 10%, rgba(96,165,250,0.25), transparent 60%),
    radial-gradient(500px 220px at 70% 0%, rgba(52,211,153,0.18), transparent 55%),
    linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  aspect-ratio: 16 / 10;
}
.listingPreviewMedia img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.listingPreviewPlaceholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 10px;
  text-align: center;
}

.listingPreviewBody {
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
}
.listingPreviewTitle {
  font-size: 14px;
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}
.listingPreviewLocation {
  font-size: 12px;
  color: rgba(229, 231, 235, 0.88);
  font-weight: 650;
  margin-top: -2px;
}
@media (prefers-color-scheme: light) {
  .listingPreviewLocation {
    color: rgba(11, 18, 32, 0.86);
  }
}
.listingPreviewLinks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.twoCol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 720px) {
  .twoCol { grid-template-columns: 1fr; }
}

