/* ===================================
   MODAL — visual moderno (design-system §19.11.bis)
   Aplicado a TODOS os modais Bootstrap. Aditivo: nenhum modal
   precisa mudar para funcionar, mas todos ganham o visual novo.
   =================================== */

.modal-content {
  border: none !important;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  background-color: var(--bg-elevated) !important;
}

.modal-header,
.modal-footer {
  border: none !important;
  padding: 1rem 1.25rem;
}

.modal-header {
  box-shadow: inset 0 -1px 0 var(--border-color);
  background: var(--bg-elevated);
}

.modal-footer {
  box-shadow: inset 0 1px 0 var(--border-color);
  gap: .5rem;
}

.modal-title {
  font-weight: 600;
}
.modal-title i {
  margin-right: .5rem;
}

/* Backdrop com leve blur */
.modal-backdrop.show {
  background: rgba(0, 0, 0, .35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 1 !important;
}

/* Entrada com translate + scale sutil */
.modal.fade .modal-dialog {
  transform: translateY(-12px) scale(.98);
  transition: transform .25s ease-out, opacity .25s ease-out;
}
.modal.show .modal-dialog {
  transform: translateY(0) scale(1);
}

/* Variante destrutiva */
.modal-content.is-danger .modal-header {
  background: color-mix(in srgb, var(--color-danger) 12%, var(--bg-elevated));
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--color-danger) 35%, transparent);
}
.modal-content.is-danger .modal-title {
  color: var(--color-danger);
}

/* ===================================
   Botão "X" universal — substitui o SVG do Bootstrap
   por uma máscara que herda currentColor (respeita o tema
   sem precisar de filter: invert).
   =================================== */
.btn-close {
  --x-icon: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/></svg>");
  background-image: none !important;
  background-color: currentColor !important;
  -webkit-mask: var(--x-icon) center / .9em no-repeat;
          mask: var(--x-icon) center / .9em no-repeat;
  color: var(--text-muted) !important;
  opacity: 1 !important;
  filter: none !important;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  transition: color .15s ease;
}
.btn-close:hover {
  color: var(--text-main) !important;
}
.btn-close:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  box-shadow: none !important;
}

/* Sombras de rolagem em modais scrollable */
.modal-dialog-scrollable .modal-body {
  mask-image: linear-gradient(
    180deg,
    transparent 0,
    #000 24px,
    #000 calc(100% - 24px),
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    180deg,
    transparent 0,
    #000 24px,
    #000 calc(100% - 24px),
    transparent 100%
  );
}
