/*
 * The confirmation popup (shared/_confirm_dialog), to Glacier's modal spec
 * (section 9.7): a 40% black overlay, a card at --radius-lg and --shadow-lg,
 * 560px at most, a header with the title and a close button, the question,
 * and a footer with Cancel then the action, right-aligned.
 *
 * A native <dialog>, so the overlay is its ::backdrop and the browser stacks
 * it in the top layer above everything -- the z-index tokens are set to match
 * the spec, not because anything could cover it.
 */

.confirm-dialog {
  width: min(560px, calc(100vw - 2 * var(--space-4)));
  max-width: none;
  padding: 0;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  background: var(--surface-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-modal);
}

/* The fallback repeats the token's value for browsers where ::backdrop does
   not yet inherit custom properties from the page (Safari before 17.4). */
.confirm-dialog::backdrop {
  background: var(--overlay-modal, rgba(0, 0, 0, 0.4));
}

.confirm-dialog[open] {
  animation: confirm-dialog-in 200ms ease-out;
}

@keyframes confirm-dialog-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .confirm-dialog[open] {
    animation: none;
  }
}

.confirm-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-primary);
}

.confirm-dialog__title {
  margin: 0;
  font-size: var(--text-h3);
  font-weight: 600;
  color: var(--text-heading);
}

/* 40px, the header-action size, so the X is a fair target. */
.confirm-dialog__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}

.confirm-dialog__close:hover {
  background: var(--surface-secondary);
  color: var(--text-primary);
}

.confirm-dialog__body {
  max-height: 70vh;
  overflow-y: auto;
  margin: 0;
  padding: var(--space-6);
  font-size: var(--text-body);
  color: var(--text-secondary);
}

.confirm-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-primary);
}

@media (max-width: 767px) {
  .confirm-dialog__header,
  .confirm-dialog__body,
  .confirm-dialog__footer {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}
