/*
 * 6.9.69 · In-app confirm / alert dialog
 * Replaces the browser's window.confirm()/alert(). Built by window.zfDialog in public/app.js;
 * forms opt in with data-confirm="…" (+ optional data-confirm-title / -button / -tone / -details).
 * Desktop: centred card. Phones (≤ 560 px): bottom sheet with full-width buttons.
 * Viewport units are divided by --zf-vu so the dialog stays correct on scaled large screens (6.9.65).
 */

html.zf-dialog-open,
html.zf-dialog-open body { overflow: hidden; }

.zf-dialog {
  position: fixed;
  inset: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 24px;
  border: 0;
  background: transparent;
  color: var(--zf-ink);
  font-family: var(--zf-font-sans);
  display: grid;
  place-items: center;
  overflow: auto;
  overscroll-behavior: contain;
}
.zf-dialog:not([open]) { display: none; }
.zf-dialog:focus { outline: none; }

.zf-dialog::backdrop {
  background: linear-gradient(135deg, rgba(40, 48, 30, .30), rgba(30, 36, 24, .42));
  -webkit-backdrop-filter: blur(7px) saturate(.9);
  backdrop-filter: blur(7px) saturate(.9);
  animation: zfDialogFade .22s ease both;
}

.zf-dialog-card {
  position: relative;
  box-sizing: border-box;
  width: min(540px, 100%);
  max-height: calc(calc(100vh / var(--zf-vu, 1)) - 48px);
  overflow: auto;
  padding: 32px 32px 26px;
  border: 1px solid var(--zf-line);
  border-radius: 28px;
  background: var(--zf-surface) var(--zf-paper-texture, none);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 36px 90px rgba(28, 36, 20, .26), 0 6px 18px rgba(28, 36, 20, .08);
  animation: zfDialogIn .34s cubic-bezier(.2, .82, .2, 1) both;
}
/* Thin tone stripe across the top of the card. */
.zf-dialog-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  border-radius: 28px 28px 0 0;
  background: linear-gradient(90deg, var(--zf-palette-leaf, #7CB518), var(--zf-palette-lime, #C4F22C));
}
.zf-dialog.is-danger .zf-dialog-card::before { background: linear-gradient(90deg, #c2410c, var(--zf-palette-coral, #FB6107)); }
.zf-dialog.is-warning .zf-dialog-card::before { background: linear-gradient(90deg, var(--zf-amber-strong, #f09a0e), var(--zf-palette-amber, #FBB02D)); }

.zf-dialog-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 4px 0 20px;
  border-radius: 18px;
  background: var(--zf-green-soft, #f1fad8);
  color: var(--zf-green-ink, #4d6b00);
}
.zf-dialog-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.zf-dialog.is-danger .zf-dialog-icon { background: var(--zf-coral-soft, #ffebdd); color: var(--zf-coral-ink, #b54600); }
.zf-dialog.is-warning .zf-dialog-icon { background: var(--zf-amber-soft, #fff3dc); color: var(--zf-amber-ink, #8a5300); }

.zf-dialog-title {
  margin: 0;
  font-family: var(--zf-font-ink);
  font-size: clamp(1.75rem, calc(1.4rem + calc(1vw / var(--zf-vu, 1))), 2.15rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -.012em;
  color: var(--zf-ink);
  text-wrap: balance;
  overflow-wrap: anywhere;
}
.zf-dialog-message {
  margin: 12px 0 0;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--zf-ink-soft);
  text-wrap: pretty;
  overflow-wrap: anywhere;
}
.zf-dialog-details {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 14px 16px;
  list-style: none;
  border: 1px solid var(--zf-line);
  border-radius: 16px;
  background: var(--zf-surface-subtle);
  font-size: .94rem;
  color: var(--zf-ink-soft);
}
.zf-dialog-details li { position: relative; padding-left: 20px; }
.zf-dialog-details li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--zf-palette-leaf, #7CB518);
}
.zf-dialog.is-danger .zf-dialog-details { border-color: #f4d6c4; background: #fff8f2; }
.zf-dialog.is-danger .zf-dialog-details li::before { background: var(--zf-palette-coral, #FB6107); }

.zf-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 28px;
}
.zf-dialog-actions .button {
  min-height: 48px;
  min-width: 128px;
  padding: 12px 22px !important;
  font-size: .98rem !important;
  font-weight: 650;
  justify-content: center;
}
.zf-dialog .zf-dialog-confirm.is-danger {
  background: #b23a14 !important;
  border: 1px solid #b23a14 !important;
  color: #ffffff !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .16) inset, 0 10px 22px rgba(160, 52, 16, .24) !important;
}
.zf-dialog .zf-dialog-confirm.is-danger:hover { background: #962f0f !important; border-color: #962f0f !important; }
.zf-dialog .zf-dialog-confirm.is-danger:focus-visible { outline: 3px solid rgba(251, 97, 7, .45) !important; outline-offset: 2px; }

/* Closing */
.zf-dialog.is-closing .zf-dialog-card { animation: zfDialogOut .17s ease both; }
.zf-dialog.is-closing::backdrop { animation: zfDialogFadeOut .17s ease both; }

@keyframes zfDialogFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes zfDialogFadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes zfDialogIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes zfDialogOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(8px) scale(.98); } }

/* Phones: bottom sheet, thumb-sized stacked buttons, safe-area aware. */
@media (max-width: 560px) {
  .zf-dialog { place-items: end stretch; padding: 0; }
  .zf-dialog-card {
    width: 100%;
    max-height: calc(calc(100vh / var(--zf-vu, 1)) - 24px);
    padding: 30px 22px calc(20px + env(safe-area-inset-bottom, 0px));
    border-width: 1px 0 0;
    border-radius: 28px 28px 0 0;
    animation-name: zfDialogSheetIn;
    animation-duration: .38s;
  }
  .zf-dialog-card::before { left: 50%; right: auto; top: 10px; width: 44px; height: 5px; border-radius: 99px; transform: translateX(-50%); background: var(--zf-line-strong); }
  .zf-dialog.is-danger .zf-dialog-card::before,
  .zf-dialog.is-warning .zf-dialog-card::before { background: var(--zf-line-strong); }
  .zf-dialog-icon { width: 50px; height: 50px; margin-top: 8px; border-radius: 16px; }
  .zf-dialog-title { font-size: 1.85rem; }
  .zf-dialog-actions { flex-direction: column-reverse; gap: 10px; margin-top: 24px; }
  .zf-dialog-actions .button { width: 100%; min-height: 52px; }
  .zf-dialog.is-closing .zf-dialog-card { animation-name: zfDialogSheetOut; }
}
@keyframes zfDialogSheetIn { from { transform: translateY(100%); } to { transform: none; } }
@keyframes zfDialogSheetOut { from { transform: none; } to { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  .zf-dialog-card,
  .zf-dialog::backdrop,
  .zf-dialog.is-closing .zf-dialog-card,
  .zf-dialog.is-closing::backdrop { animation: none !important; }
}

/* ---------- Booking page delete: always within reach (6.9.69) ---------- */
.zf-header-actions form { display: contents; }
.button.zf-delete-page-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #ffffff !important;
  border-color: #efcfc1 !important;
  color: #a43a12 !important;
}
.button.zf-delete-page-button:hover:not(:disabled) { background: #fff2ea !important; border-color: #e3aa91 !important; color: #8a2f0c !important; }
.zf-delete-page-button svg,
.zf-page-tile-delete svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* Dashboard tiles: the tile stays one link; the delete button sits beside it in the same grid cell. */
.zf-page-tile-shell { position: relative; display: grid; min-width: 0; }
.zf-page-tile-shell > .zf-page-tile { min-width: 0; }
.zf-page-tile-shell:nth-child(3n+2) > .zf-page-tile::after { background: rgba(141, 149, 125, .07); }
.zf-page-tile-shell:nth-child(3n+3) > .zf-page-tile::after { background: rgba(211, 141, 126, .07); }
.zf-page-tile-delete { position: absolute; right: 14px; bottom: 14px; z-index: 3; margin: 0; }
.zf-page-tile-delete button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--zf-line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--zf-muted);
  cursor: pointer;
  transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.zf-page-tile-delete button:hover,
.zf-page-tile-delete button:focus-visible {
  color: #a43a12;
  background: #fff2ea;
  border-color: #e3aa91;
  box-shadow: 0 6px 16px rgba(160, 52, 16, .12);
  transform: translateY(-1px);
}
.zf-page-tile-shell .zf-page-tile-metrics { padding-right: 46px; }
