/* ====================================================
   Activation Region Manager — Frontend Modal  v1.5.7
   ==================================================== */

/* ---- CSS custom-property defaults (overridden by inline PHP block) ---- */
:root {
	--arm-modal-bg:             #320d6d;
	--arm-modal-radius:         4px;
	--arm-modal-border-width:   0px;
	--arm-modal-border-color:   transparent;
	--arm-overlay-bg:           rgba(0,0,0,0.72);
	--arm-search-bg:            rgba(0,0,0,0.20);
	--arm-search-border:        transparent;
	--arm-scrollbar-track:      rgba(255,255,255,0.05);
	--arm-scrollbar-thumb:      rgba(255,255,255,0.30);
	--arm-scrollbar-radius:     10px;
	--arm-divider-color:        rgba(255,255,255,0.12);
	--arm-font-size-country:    14px;
	--arm-font-size-status:     16px;
	--arm-modal-icon-size:      44px;
	--arm-search-w-desktop:     220px;
	--arm-search-w-tablet:      100%;
	--arm-search-w-mobile:      100%;
	--arm-search-h:             auto;
	--arm-search-border-width:  0px;
	--arm-search-border-radius: 4px;
	--arm-text-color:           #ffffff;
	--arm-meta-label-size:      11px;
	--arm-meta-label-color:     rgba(255,255,255,0.58);
	--arm-list-title-size:      13px;
	--arm-list-title-color:     #ffffff;
}

/* ---- Scroll lock ---- */
html.arm-modal-open,
body.arm-modal-open {
	overflow: hidden !important;
}

/* ---- Overlay ---- */
.arm-modal-overlay {
	position: fixed;
	inset: 0;
	background: var(--arm-overlay-bg);
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	animation: armFadeIn 0.2s ease both;
	will-change: opacity;
	box-sizing: border-box;
}

/* Loading overlay: just the spinner, no modal box */
.arm-modal-overlay--loading {
	animation: none;
	padding: 0;
}

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

/* ---- Modal container ---- */
.arm-modal {
	background: var(--arm-modal-bg);
	color: var(--arm-text-color);
	border-radius: var(--arm-modal-radius);
	border: var(--arm-modal-border-width) solid var(--arm-modal-border-color);
	width: 800px;
	height: 630px;
	max-width: calc(100vw - 32px);
	max-height: calc(100vh - 32px);
	display: flex;
	flex-direction: column;
	box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
	overflow: hidden;
	animation: armSlideUp 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
	will-change: transform, opacity;
	transform: translateZ(0);
	position: relative;
}

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

/* ---- CSS ring spinner ---- */
.arm-spinner {
	width: 44px;
	height: 44px;
	border: 3px solid rgba(255, 255, 255, 0.18);
	border-top-color: rgba(255, 255, 255, 0.85);
	border-radius: 50%;
	animation: armSpin 0.75s linear infinite;
	will-change: transform;
}

@keyframes armSpin {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

.arm-spinner-img {
	width: 48px;
	height: 48px;
	object-fit: contain;
}

/* ---- Close button — bare SVG, no background, theme-proof ---- */
.arm-modal-close {
	position: absolute !important;
	top: 16px !important;
	right: 10px !important;
	left: auto !important;
	bottom: auto !important;
	background: none !important;
	border: none !important;
	box-shadow: none !important;
	color: #fff !important;
	cursor: pointer;
	display: flex !important;
	align-items: center;
	justify-content: center;
	padding: 4px;
	width: auto !important;
	height: auto !important;
	line-height: 1;
	z-index: 10;
	transition: color 0.15s ease;
	text-decoration: none;
	float: none !important;
}

.arm-modal-close:hover,
.arm-modal-close:focus {
	color: #ef4444 !important;
	background: none !important;
	outline: none;
	text-decoration: none;
}

/* ---- Header ---- */
.arm-modal-header {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 32px 44px 24px 40px; /* right pad clears close button */
	border-bottom: 1px solid var(--arm-divider-color);
	flex-shrink: 0;
}

/* Optional uploaded region / fallback icon */
.arm-modal-icon {
	width: var(--arm-modal-icon-size);
	height: var(--arm-modal-icon-size);
	object-fit: contain;
	flex-shrink: 0;
}

.arm-modal-status {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.arm-modal-status > strong {
	font-size: var(--arm-font-size-status);
	font-weight: 500;
	line-height: 1.35;
	letter-spacing: 0.01em;
}

.arm-cannot-reason {
	opacity: 0.7;
	font-size: 0.875em;
}

/* ---- Meta row (region + country) — stays two-column on all screens ---- */
.arm-modal-meta {
	display: flex;
	flex-direction: row;
	gap: 160px;
	padding: 20px 40px;
	border-bottom: 1px solid var(--arm-divider-color);
	flex-shrink: 0;
}

.arm-modal-meta-item {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

/* Muted label — sentence case, not uppercase */
.arm-modal-meta-item > span {
	font-size: var(--arm-meta-label-size);
	font-weight: 600;
	text-transform: none;
	letter-spacing: 0;
	color: var(--arm-meta-label-color);
}

.arm-modal-meta-item > strong {
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	font-size: 1em;
}

/* ---- Body: flex column, no overflow — only the grid scrolls ---- */
.arm-modal-body {
	padding: 0 40px 40px;
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-height: 0;
}

/* Body header: title left, search right — stays fixed above the list */
.arm-modal-body-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 0 25px;
	flex-shrink: 0;
}

.arm-modal-body-header h3 {
	font-weight: 700;
	margin: 0;
	font-size: var(--arm-list-title-size);
	color: var(--arm-list-title-color);
	flex: 1;
	line-height: 1.4;
}

/* ---- Search wrap ---- */
.arm-search-wrap {
	position: relative;
	flex-shrink: 0;
	width: var(--arm-search-w-desktop);
	margin-right: 48px;
}

/* Magnifying glass absolutely positioned inside the wrap */
.arm-search-icon {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
	color: rgba(255, 255, 255, 0.45);
	display: flex;
	align-items: center;
	line-height: 1;
}

/* ---- Search input — vertical padding unchanged from original ---- */
.arm-country-search {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: var(--arm-search-h) !important;
	padding: 7px 12px 7px 40px !important;
	border-radius: var(--arm-search-border-radius);
	border: var(--arm-search-border-width) solid var(--arm-search-border);
	background: var(--arm-search-bg, rgba(0,0,0,0.20)) !important;
	color: #fff;
	outline: none;
	font-size: 0.875em;
	box-sizing: border-box;
	-webkit-box-shadow: none;
	box-shadow: none;
}

.arm-country-search::placeholder {
	color: rgba(255, 255, 255, 0.4);
}

.arm-country-search:focus {
	outline: none;
	border-color: rgba(255, 255, 255, 0.25);
}

/* Kill webkit's auto-styling of search inputs */
.arm-country-search::-webkit-search-decoration,
.arm-country-search::-webkit-search-cancel-button {
	-webkit-appearance: none;
}

/* ---- Scrollable country grid wrapper — scrollbar scoped here ---- */
.arm-country-grid-wrap {
	flex: 1;
	overflow-y: auto;
	min-height: 0;
	padding-right: 6px;
	margin-right: -6px; /* scrollbar right edge = body right padding edge */
}

.arm-country-grid-wrap::-webkit-scrollbar {
	width: 4px;
}

.arm-country-grid-wrap::-webkit-scrollbar-track {
	background: var(--arm-scrollbar-track);
	border-radius: 10px;
}

.arm-country-grid-wrap::-webkit-scrollbar-thumb {
	background: var(--arm-scrollbar-thumb);
	border-radius: var(--arm-scrollbar-radius);
}

/* ---- Country grid — padding-bottom here so it works in all browsers ---- */
.arm-country-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 4px 16px;
	padding-bottom: 32px;
}

.arm-country-item {
	padding: 2px 0;
	opacity: 0.88;
	font-size: var(--arm-font-size-country);
	font-weight: 500;
}

.arm-country-item.arm-hidden {
	display: none;
}

/* ---- Trigger link ---- */
.arm-trigger-wrap {
	margin-top: 8px;
}

.arm-trigger-link {
	cursor: pointer;
}

/* ---- Responsive: tablet / small desktop ---- */
@media (max-width: 640px) {
	.arm-modal-header {
		padding: 24px 44px 20px 18px;
	}

	.arm-modal-close {
		right: -4px !important;
	}

	/* Keep meta as 2 columns — do NOT stack on mobile */
	.arm-modal-meta {
		gap: 20px;
		padding: 16px 16px;
	}

	.arm-modal-body {
		padding: 24px 18px;
	}

	.arm-modal-body-header {
		flex-wrap: wrap;
		padding: 16px 0 16px;
	}

	.arm-search-wrap {
		width: var(--arm-search-w-tablet);
		margin-right: 50px;
	}

	.arm-country-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ---- Responsive: mobile ---- */
@media (max-width: 480px) {
	.arm-modal-close {
		right: -10px !important;
	}

	.arm-search-wrap {
		width: var(--arm-search-w-mobile);
		margin-right: 0;
	}
}

@media (max-width: 400px) {
	.arm-country-grid {
		grid-template-columns: 1fr;
	}
}
