/**
 * Mycotoxin Risk Map - front end styles.
 * Every colour is a custom property so the theme can override it without
 * touching the plugin.
 */

.mycomap {
	--mycomap-height: 560px;
	--mycomap-accent: #5b2a6e;
	--mycomap-accent-soft: #f6ecf7;
	--mycomap-row-alt: #b07cb8;
	--mycomap-row: #f4ebf6;
	--mycomap-border: #f0dcef;
	--mycomap-text: #3d3d46;
	--mycomap-radius: 18px;

	position: relative;
	margin: 0 0 2rem;
	font-size: 15px;
	color: var(--mycomap-text);
	padding:5%;
}

/* Toolbar: filters on the left, language switch on the right ------------- */

.mycomap__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 14px;
	margin-bottom: 18px;
}

.mycomap__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
}

.mycomap__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 180px;
}

.mycomap__field-label {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--mycomap-accent);
}

.mycomap__filters select {
	padding: 9px 12px;
	border: 1px solid var(--mycomap-border);
	border-radius: 10px;
	background: #fff;
	font: inherit;
	color: inherit;
	line-height: 1.2;
}

/* Language switch -------------------------------------------------------- */

.mycomap__lang {
	display: inline-flex;
	padding: 3px;
	border: 1px solid var(--mycomap-border);
	border-radius: 999px;
	background: #fff;
}

.mycomap__lang-btn {
	padding: 6px 16px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--mycomap-accent);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background .15s ease, color .15s ease;
}

.mycomap__lang-btn:hover {
	background: var(--mycomap-accent-soft);
}

.mycomap__lang-btn.is-active {
	background: var(--mycomap-accent);
	color: #fff;
}

/* Map stage -------------------------------------------------------------- */

.mycomap__stage {
	position: relative;
}

.mycomap__map {
	width: 100%;
	height: var(--mycomap-height);
}

.mycomap__map svg {
	touch-action: pan-y;
}

.mycomap__map path.is-active {
	filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25));
}

.mycomap__error {
	padding: 20px;
	background: #fff4f4;
	border: 1px solid #f2c6c6;
	border-radius: 8px;
}

/* Card ------------------------------------------------------------------- */

.mycomap__card {
	position: absolute;
	z-index: 5;
	width: min(420px, calc(100% - 24px));
	padding: 28px;
	background: #fff;
	border: 1px solid var(--mycomap-border);
	border-radius: var(--mycomap-radius);
	box-shadow: 0 18px 40px rgba(60, 20, 70, .16);
}

.mycomap__card[hidden] {
	display: none;
}

.mycomap__close {
	position: absolute;
	top: 6px;
	right: 8px;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #9a8fa2;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.mycomap__close:hover {
	color: var(--mycomap-accent);
}

.mycomap__card-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}

.mycomap__card-title h3 {
	margin: 0 0 6px;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.25;
	color: var(--mycomap-accent);
}

.mycomap__risk {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: var(--mycomap-accent);
}

.mycomap__risk-icon {
	width: 24px;
	height: 24px;
	object-fit: contain;
	border-radius: 50%;
}

.mycomap__risk-icon--dot {
	display: inline-block;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}

.mycomap__flag {
	flex: 0 0 auto;
	width: 42px;
	height: auto;
	border-radius: 4px;
}

.mycomap__flag--emoji {
	font-size: 30px;
	line-height: 1;
}

/* Table ------------------------------------------------------------------ */

.mycomap__table-wrap {
	overflow-x: auto;
}

.mycomap__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 11px;
	text-align: center;
	table-layout: fixed;
}

.mycomap__table th,
.mycomap__table td {
	padding: 5px 4px;
	border: 0;
	font-weight: 400;
	line-height: 1.2;
}

.mycomap__table thead th {
	font-size: 10px;
	font-weight: 700;
	color: var(--mycomap-accent);
	vertical-align: bottom;
}

.mycomap__table tbody th {
	text-align: left;
	padding-left: 8px;
	font-weight: 700;
}

.mycomap__table tbody tr:nth-child(odd) th,
.mycomap__table tbody tr:nth-child(odd) td {
	background: var(--mycomap-row);
	color: var(--mycomap-text);
}

.mycomap__table tbody tr:nth-child(even) th,
.mycomap__table tbody tr:nth-child(even) td {
	background: var(--mycomap-row-alt);
	color: #fff;
}

.mycomap__table tbody tr:first-child th {
	border-top-left-radius: 6px;
}

.mycomap__table tbody tr:first-child td:last-child {
	border-top-right-radius: 6px;
}

.mycomap__table tbody tr:last-child th {
	border-bottom-left-radius: 6px;
}

.mycomap__table tbody tr:last-child td:last-child {
	border-bottom-right-radius: 6px;
}

.mycomap__nodata,
.mycomap__notes {
	margin-top: 10px;
	font-size: 12px;
	color: #6b6b76;
}

/* Legend ----------------------------------------------------------------- */

.mycomap__legend {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 22px;
	width: fit-content;
	max-width: 100%;
	margin: 24px auto 0;
	padding: 12px 22px;
	border: 1px solid var(--mycomap-border);
	border-radius: 999px;
	background: #fff;
	box-shadow: 0 8px 22px rgba(60, 20, 70, .08);
}

.mycomap__legend-item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: var(--mycomap-accent);
}

.mycomap__dot {
	width: 12px;
	height: 12px;
	border-radius: 50%;
}

.mycomap__empty {
	margin-top: 16px;
	text-align: center;
	color: #8a8a94;
}

/* Responsive ------------------------------------------------------------- */

@media (max-width: 782px) {
	.mycomap {
		--mycomap-height: 340px;
	}

	.mycomap__toolbar {
		align-items: stretch;
	}

	.mycomap__card {
		position: static !important;
		width: 100%;
		margin-top: 16px;
		transform: none !important;
	}

	.mycomap__legend {
		gap: 12px 16px;
		border-radius: 16px;
	}
}
