/*
 * AC Cannabis Wissen — shared detail modal.
 * Ported 1:1 from the Einnahmeformen prototype's modal (einnahmeformen.css) — this is the
 * single modal implementation reused by every widget in the plugin. Only generalized where
 * needed so widgets with different field sets (checklists, meters, formulas) can populate
 * the same detail-row markup.
 */

.ac-modal {
	display: none;
	position: fixed;
	z-index: 100000;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background-color: rgba( 0, 0, 0, 0.5 );
	/*
	 * align-items: flex-start (not center) is deliberate: a centered flex item taller
	 * than its container gets pushed above the container's top edge, and that space is
	 * not reachable via overflow-y:auto — scrolling down works, but the top portion of a
	 * long modal becomes permanently cut off with no way to scroll up to it (this is what
	 * happened on mobile with tall content). Starting the box at the top instead means
	 * overflow can always scroll through its full height. .ac-modal-content's own
	 * top/bottom margin below restores the "roughly centered" look for the common case
	 * of a modal that's shorter than the viewport.
	 */
	align-items: flex-start;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
	overflow-y: auto;
}

.ac-modal.ac-modal-open {
	display: flex;
}

.ac-modal-content {
	background-color: #fff;
	margin: 40px auto;
	width: 80%;
	max-width: 800px;
	border-radius: 8px;
	box-shadow: 0 5px 15px rgba( 0, 0, 0, 0.3 );
	position: relative;
	animation: ac-modal-in 0.3s;
}

@keyframes ac-modal-in {
	from {
		transform: translateY( -50px );
		opacity: 0;
	}
	to {
		transform: translateY( 0 );
		opacity: 1;
	}
}

.ac-modal-header {
	font-family: 'Montserrat', sans-serif !important;
	background-color: var( --ac-accent, #2e6741 );
	color: #fff;
	padding: 15px 20px;
	display: flex;
	align-items: center;
	border-radius: 8px 8px 0 0;
}

.ac-modal-icon {
	width: 40px;
	height: 40px;
	background-color: #fff;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	flex-shrink: 0;
}

.ac-modal-icon img {
	max-width: 100%;
	max-height: 100%;
}

.ac-modal-icon:empty {
	display: none;
}

.ac-modal-title {
	font-family: 'Montserrat', sans-serif !important;
	color: #fff;
	font-size: 1.5rem;
	margin: 0 0 0 15px;
}

.ac-modal-close {
	position: absolute;
	right: 20px;
	top: 15px;
	display: inline-flex;
	color: #fff;
	cursor: pointer;
	line-height: 1;
}

.ac-modal-close svg {
	display: block;
	width: 30px !important;
	height: 30px !important;
	fill: currentColor !important;
}

.ac-modal-close:hover {
	opacity: 0.8;
}

.ac-modal-body {
	padding: 20px;
	display: grid;
	grid-template-columns: 1fr 2fr;
	gap: 20px;
}

.ac-modal-body.ac-modal-no-image {
	grid-template-columns: 1fr;
}

.ac-modal-image {
	background-color: #f5f5f5;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	border-radius: 8px;
	overflow: hidden;
}

.ac-modal-image img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.ac-modal-image:empty {
	display: none;
}

.ac-detail-section {
	display: flex;
	flex-direction: column;
	gap: 15px;
	font-family: 'Amiko', sans-serif;
}

.ac-detail-item {
	margin-bottom: 10px;
}

.ac-detail-label {
	font-weight: bold;
	margin-bottom: 5px;
	font-family: 'Montserrat', sans-serif;
}

.ac-detail-text {
	color: #555;
	line-height: 1.6;
}

.ac-detail-text.ac-detail-muted {
	font-size: 14px;
	font-style: italic;
	color: #666;
}

.ac-detail-list {
	list-style-type: none;
	margin: 0;
	padding-left: 15px;
}

.ac-detail-list li {
	position: relative;
	padding: 5px 0;
	padding-left: 25px;
	color: #555;
}

.ac-detail-list li::before {
	content: '\2713';
	position: absolute;
	left: 0;
	color: #4caf50;
	font-weight: bold;
}

.ac-meter {
	height: 20px;
	background-color: #eee;
	border-radius: 10px;
	overflow: hidden;
	margin-top: 5px;
	position: relative;
}

.ac-meter-fill {
	height: 100%;
	background-color: var( --ac-accent, #2e6741 );
	width: 0;
	transition: width 0.8s ease-out;
}

.ac-meter-label {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-weight: bold;
	text-shadow: 1px 1px 2px rgba( 0, 0, 0, 0.5 );
}

@media ( max-width: 768px ) {
	.ac-modal-body {
		grid-template-columns: 1fr;
	}

	.ac-modal-content {
		width: 95%;
		margin: 5% auto;
	}
}
