/* =====================================================
   DTB Region Selector – Frontend Popup
   ===================================================== */

/* --- Overlay ---------------------------------------- */
.dtb-rs-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.dtb-rs-overlay[hidden] {
	display: none;
}

.dtb-rs-overlay.is-visible {
	opacity: 1;
}

/* --- Popup card ------------------------------------- */
.dtb-rs-popup {
	position: relative;
	background: #fff;
	border-radius: 1rem;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	max-width: 520px;
	width: 100%;
	padding: 2.5rem 2rem 2rem;
	transform: translateY(24px) scale(0.97);
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
	            opacity  0.25s ease;
	opacity: 0;
}

.dtb-rs-overlay.is-visible .dtb-rs-popup {
	transform: translateY(0) scale(1);
	opacity: 1;
}

/* --- Close button ----------------------------------- */
.dtb-rs-close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	background: transparent;
	border: none;
	cursor: pointer;
	color: #6b7280;
	padding: 0.25rem;
	line-height: 0;
	border-radius: 50%;
	transition: color 0.15s, background 0.15s;
}

.dtb-rs-close:hover,
.dtb-rs-close:focus-visible {
	color: #111827;
	background: #f3f4f6;
	outline: none;
}

/* --- Header ----------------------------------------- */
.dtb-rs-header {
	text-align: center;
	margin-bottom: 1.75rem;
}

.dtb-rs-title {
	margin: 0 0 0.5rem;
	font-size: 1.5rem;
	font-weight: 700;
	color: #111827;
	line-height: 1.2;
}

.dtb-rs-subtitle {
	margin: 0;
	color: #6b7280;
	font-size: 0.95rem;
}

/* --- Country list ----------------------------------- */
.dtb-rs-countries {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	gap: 0.75rem;
}

/* --- Country button --------------------------------- */
.dtb-rs-country-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	padding: 1rem 0.75rem;
	background: #f9fafb;
	border: 2px solid #e5e7eb;
	border-radius: 0.75rem;
	cursor: pointer;
	font-family: inherit;
	text-align: center;
	transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

.dtb-rs-country-btn:hover,
.dtb-rs-country-btn:focus-visible {
	border-color: #2563eb;
	background: #eff6ff;
	transform: translateY(-2px);
	outline: none;
}

.dtb-rs-country-btn.is-active {
	border-color: #2563eb;
	background: #dbeafe;
}

.dtb-rs-flag {
	font-size: 2.25rem;
	line-height: 1;
	display: block;
}

/* If flag is an image URL (rendered via JS) */
.dtb-rs-flag img {
	width: 2.25rem;
	height: 2.25rem;
	object-fit: cover;
	border-radius: 50%;
}

.dtb-rs-name {
	font-size: 0.875rem;
	font-weight: 600;
	color: #1f2937;
}

/* --- Language switch confirmation ------------------- */
.dtb-rs-lang-confirm {
	margin-top: 1.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid #e5e7eb;
	text-align: center;
}

.dtb-rs-lang-confirm[hidden] {
	display: none;
}

.dtb-rs-lang-prompt {
	margin: 0 0 1rem;
	color: #374151;
	font-size: 0.95rem;
}

.dtb-rs-lang-actions {
	display: flex;
	gap: 0.75rem;
	justify-content: center;
	flex-wrap: wrap;
}

/* --- Generic buttons -------------------------------- */
.dtb-rs-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0.6rem 1.25rem;
	border-radius: 0.5rem;
	font-size: 0.9rem;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s;
	border: 2px solid transparent;
}

.dtb-rs-btn--primary {
	background: #2563eb;
	color: #fff;
	border-color: #2563eb;
}

.dtb-rs-btn--primary:hover,
.dtb-rs-btn--primary:focus-visible {
	background: #1d4ed8;
	border-color: #1d4ed8;
	outline: none;
}

.dtb-rs-btn--secondary {
	background: transparent;
	color: #374151;
	border-color: #d1d5db;
}

.dtb-rs-btn--secondary:hover,
.dtb-rs-btn--secondary:focus-visible {
	background: #f3f4f6;
	border-color: #9ca3af;
	outline: none;
}

/* --- Trigger button (shortcode) --------------------- */
.dtb-rs-trigger-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 1rem;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: 0.375rem;
	cursor: pointer;
	font-family: inherit;
	font-size: inherit;
}

/* --- Responsive -------------------------------------- */
@media (max-width: 480px) {
	.dtb-rs-popup {
		padding: 2rem 1.25rem 1.5rem;
	}

	.dtb-rs-countries {
		grid-template-columns: repeat(2, 1fr);
	}

	.dtb-rs-title {
		font-size: 1.25rem;
	}

	.dtb-rs-lang-actions {
		flex-direction: column;
	}

	.dtb-rs-btn {
		width: 100%;
		justify-content: center;
	}
}
