/* =============================================================================
	Modal Base Styles
	Owns reusable overlay, container, animation, and shared modal primitives used
	by the focused modal/domain layers.
   ============================================================================= */

.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
	padding: 2rem 1rem;
	animation: fadeIn 0.2s ease;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
}

@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.modal-content {
	background: var(--bg-secondary);
	border-radius: 12px;
	max-width: 500px;
	width: 100%;
	max-height: 90vh;
	overflow-x: hidden;
	overflow-y: auto;
	position: relative;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
	animation: slideUp 0.3s ease;
	border: 1px solid var(--border-primary);
	padding: 1.5rem;
}

.modal-content.confirm-modal {
	margin: 0 auto;
	width: min(100%, 450px);
}

@media (max-width: 500px) {
	.modal-content.confirm-modal {
		margin: 0 auto;
		border-radius: 12px;
		max-height: min(85dvh, 85vh);
	}
}

@keyframes slideUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.modal-close,
.lightbox-close {
	width: 2.75rem;
	height: 2.75rem;
	min-width: 2.75rem;
	min-height: 2.75rem;
	font-size: 1.2rem;
	line-height: 1;
}

.modal-close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	background: var(--btn-ghost-hover);
	border: 1px solid var(--border-secondary);
	color: var(--text-secondary);
	cursor: pointer;
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--btn-radius-round);
	transition:
		background 150ms ease,
		border-color 150ms ease,
		color 150ms ease;
	flex-shrink: 0;
	padding: 0;
	box-shadow: none;
}

.modal-close:hover {
	background: rgba(255, 255, 255, 0.15);
	border-color: var(--text-secondary);
	color: var(--text-primary);
}

[data-theme="light"] .modal-close:hover {
	background: rgba(0, 0, 0, 0.1);
}

.modal-footer {
	padding: 1rem 1.5rem;
	display: flex;
	justify-content: space-between;
	align-items: center;
	border-top: 1px solid var(--border-primary);
	gap: 0.75rem;
}

.modal-footer button {
	white-space: nowrap;
}

.modal-footer .footer-left,
.modal-footer .footer-right {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

.modal-footer button.icon-only {
	padding: 0.5rem;
	min-width: 2.75rem;
	min-height: 2.75rem;
}
