
.modal {
	/* Underlay covers entire screen. */
	position: fixed;
	top:0px;
	bottom: 0px;
	left:0px;
	right:0px;
	background-color:rgba(0,0,0,0.5);
	z-index:900;

	/* Flexbox centers the .modal-content vertically and horizontally */
	display:flex;
	flex-direction:column;
	align-items:center;
	/* Allow modal to scroll vertically if content exceeds viewport */
	overflow-y:auto;
	/* Prevent horizontal scrolling on the page when modal is open */
	overflow-x:hidden;

	/* Animate when opening */
	animation-name: fadeIn;
	animation-duration:150ms;
	animation-timing-function: ease;
}

.modal > .modal-underlay {
	/* underlay takes up the entire viewport. This is only
	required if you want to click to dismiss the popup */
	position: absolute;
	z-index: -1;
	top:0px;
	bottom:0px;
	left: 0px;
	right: 0px;
}

.modal > .modal-content {
	/* Sizing for visible dialog */
	/* keep modal within viewport width and be responsive */
	max-width:70%;
	min-width:300px;
	box-sizing: border-box;

	/* Limit height so content can scroll inside the modal */
	max-height: calc(100vh - 80px); /* leave some space around modal */
	overflow-y: auto; /* internal vertical scrolling */
	overflow-x: hidden; /* prevent internal horizontal overflow */

	/* Display properties for visible dialog*/
	border:solid 1px #999;
	border-radius:8px;
	box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.3);
	background-color:white;
	padding:20px;

	/* Animate when opening */
	animation-name:zoomIn;
	animation-duration:150ms;
	animation-timing-function: ease;
}

/* Ensure content inside modal doesn't cause horizontal overflow */
.modal > .modal-content * {
	max-width: 100%;
	box-sizing: border-box;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

/* Make tables inside modal responsive */
.modal > .modal-content table {
	width: 100% !important;
	max-width: 100% !important;
	table-layout: fixed; /* make columns respect widths and wrap cell content */
	border-collapse: collapse;
}

.modal > .modal-content table th,
.modal > .modal-content table td {
	padding: 6px 8px;
	text-align: left;
	vertical-align: top;
	overflow: hidden;
}

/* Allow table cells to wrap when needed on small screens */
@media (max-width: 600px) {
	.modal > .modal-content table th,
	.modal > .modal-content table td {
		white-space: normal;
	}
}

/* If a table is still too wide, allow horizontal scrolling within modal */
.modal > .modal-content .table-responsive {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.modal.closing {
	/* Animate when closing */
	animation-name: fadeOut;
	animation-duration:150ms;
	animation-timing-function: ease;
}

.modal.closing > .modal-content {
	/* Animate when closing */
	animation-name: zoomOut;
	animation-duration:150ms;
	animation-timing-function: ease;
}

@keyframes fadeIn {
	0% {opacity: 0;}
	100% {opacity: 1;}
} 

@keyframes fadeOut {
	0% {opacity: 1;}
	100% {opacity: 0;}
} 

@keyframes zoomIn {
	0% {transform: scale(0.9);}
	100% {transform: scale(1);}
} 

@keyframes zoomOut {
	0% {transform: scale(1);}
	100% {transform: scale(0.9);}
} 