/*
 * Frontend CSS for IonicDry Add-ons
 * Matches the specified layout and styling requirements.
 */

/* CSS variables are injected inline on the .iodry-card element */

.iodry-card {
	/* Styling from spec: blød radius, let skygge, padding 16–20px. */
	background: #f7f7f8;
	border-radius: 12px;
	padding: 16px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
	margin-bottom: 15px; /* Add some space below the card */
}

.iodry-addons-title {
	font-size: 1.2em;
	margin-top: 0;
	margin-bottom: 15px;
}

.iodry-addons-list {
	display: flex;
	flex-direction: column;
	gap: 10px; /* Space between rows */
}

.iodry-row {
	/* Styling from spec: display:grid; grid-template-columns: 22px var(--addon-img,56px) minmax(0,1fr) auto; column-gap: var(--addon-gap,12px); align-items:center; border-radius:8px; transition:background .15s; */
	display: grid;
	grid-template-columns: 22px var(--addon-img, 56px) minmax(0, 1fr) auto;
	column-gap: var(--addon-gap, 12px);
	align-items: center;
	border-radius: 8px;
	transition: background .15s;
	padding: 5px 0; /* Small vertical padding for hover effect */
}

.iodry-row:hover {
	background: rgba(0, 0, 0, .03);
}

/* Columns */
.iodry-col {
	min-width: 0; /* Allows content to shrink */
}

/* 1. Checkbox/Radio */
.iodry-col-input {
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
}

.iodry-addon-input {
	/* Fjern temaets pseudo-checkmarks; brug rigtige inputs. */
	/* We hide the default input and style the label as a custom input */
	opacity: 0;
	position: absolute;
	width: 100%;
	height: 100%;
	cursor: pointer;
	z-index: 1;
}

.iodry-custom-input-label {
	display: block;
	width: 22px;
	height: 22px;
	border: 2px solid #ccc;
	border-radius: 4px;
	background: #fff;
	transition: all 0.15s ease-in-out;
	position: relative;
}

.iodry-addon-input[type="radio"] + .iodry-custom-input-label {
	border-radius: 50%;
}

.iodry-addon-input:checked + .iodry-custom-input-label {
	border-color: #007cba; /* Primary color for checked state */
	background: #007cba;
}

.iodry-addon-input:checked + .iodry-custom-input-label::after {
	content: 	'';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	/* Checkmark for checkbox */
	width: 6px;
	height: 10px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: translate(-50%, -50%) rotate(45deg);
}

.iodry-addon-input[type="radio"]:checked + .iodry-custom-input-label::after {
	/* Dot for radio */
	width: 8px;
	height: 8px;
	border: none;
	border-radius: 50%;
	background: #fff;
	transform: translate(-50%, -50%);
}

.iodry-addon-input:focus + .iodry-custom-input-label {
	/* Accessibility: focus-stil */
	box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.5);
}

/* Disabled state */
.iodry-row.is-disabled {
	opacity: 0.6;
	pointer-events: none;
}

/* 2. Image */
.iodry-col-image {
	width: var(--addon-img, 56px);
	height: var(--addon-img, 56px);
}

.iodry-addon-image-link,
.iodry-addon-image {
	display: block;
	width: 100%;
	height: 100%;
}

.iodry-addon-image {
	/* Billede: kvadratisk ramme, object-fit: contain */
	object-fit: contain;
}

/* 3. Label + Price Note */
.iodry-col-label-price {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-width: 0;
}

.iodry-addon-label-wrapper {
	display: flex;
	align-items: center;
	gap: 5px;
	line-height: 1.2;
	/* Hold alt på én linje; white-space: nowrap på label/prisnote. */
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	cursor: pointer;
}

.iodry-addon-label {
	font-weight: 600;
	color: #333;
}

.iodry-addon-price-note {
	color: #007cba; /* Highlight price note */
	font-weight: 500;
}

.iodry-addon-out-of-stock {
	display: inline-block;
	font-size: 0.8em;
	color: #a00;
	font-weight: 600;
	margin-top: 3px;
}

/* 4. Læs mere */
.iodry-col-read-more {
	text-align: right;
}

.iodry-col-read-more.is-hidden {
	display: none;
}

.iodry-addon-read-more {
	font-size: 0.9em;
	color: #007cba;
	text-decoration: underline;
	white-space: nowrap;
}

/* Mobile: under 420px rykkes “Læs mere” på linje 2; resten forbliver i rækkefølge. */
@media (max-width: 420px) {
	.iodry-row {
		/* Change to 2 rows layout */
		grid-template-columns: 22px var(--addon-img, 56px) minmax(0, 1fr);
		grid-template-rows: auto auto;
		align-items: flex-start;
	}

	.iodry-col-input {
		grid-row: 1 / 2;
		grid-column: 1 / 2;
		align-self: center;
	}

	.iodry-col-image {
		grid-row: 1 / 2;
		grid-column: 2 / 3;
	}

	.iodry-col-label-price {
		grid-row: 1 / 2;
		grid-column: 3 / 4;
	}

	.iodry-col-read-more {
		grid-row: 2 / 3;
		grid-column: 3 / 4;
		text-align: left;
		margin-top: -5px; /* Adjust spacing */
	}
}
