/* Modal Window - Modern CSS with hardware-accelerated animations */
#modal_form {
	width: 310px;
	height: auto;
	min-height: 270px;
	border-radius: 16px;
	background: #fff;
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(0.9);
	display: none;
	opacity: 0;
	z-index: 1001;
	box-shadow:
		0 25px 50px -12px rgba(0, 0, 0, 0.25),
		0 0 0 1px rgba(0, 0, 0, 0.05);
	transition:
		opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
		transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	will-change: opacity, transform;
}

#modal_form.modal-visible {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

#modal_form.modal-closing {
	opacity: 0;
	transform: translate(-50%, -50%) scale(0.95);
}

/* Overlay with backdrop blur */
#overlay {
	z-index: 1000;
	position: fixed;
	background-color: rgba(0, 0, 0, 0.6);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	cursor: pointer;
	display: none;
	opacity: 0;
	transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#overlay.overlay-visible {
	opacity: 1;
}

#modal_form h2 {
	text-align: center;
}

/* Close button - Modern X design */
.exit {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.1);
	cursor: pointer;
	transition: all 0.2s ease;
	z-index: 10;
}

.exit::before,
.exit::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 14px;
	height: 2px;
	background: #374151;
	border-radius: 1px;
	transition: background 0.2s ease;
}

.exit::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.exit::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

.exit:hover {
	background: rgba(239, 68, 68, 0.15);
	transform: scale(1.1);
}

.exit:hover::before,
.exit:hover::after {
	background: #ef4444;
}

.exit:active {
	transform: scale(0.95);
}

/* Responsive design for mobile */
@media (max-width: 480px) {
	#modal_form {
		width: 92%;
		min-width: 280px;
		max-width: 360px;
		border-radius: 12px;
	}

	.exit {
		top: 8px;
		right: 8px;
		width: 36px;
		height: 36px;
	}

	.exit::before,
	.exit::after {
		width: 16px;
	}
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
	#modal_form,
	#overlay,
	.exit {
		transition: none;
	}

	#modal_form.modal-visible {
		transform: translate(-50%, -50%);
	}

	#modal_form.modal-closing {
		transform: translate(-50%, -50%);
	}
}

/* Prevent body scroll when modal is open */
body.modal-open {
	overflow: hidden;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	#modal_form {
		border: 2px solid #000;
	}

	.exit {
		border: 2px solid currentColor;
	}
}
