/* UA Country Segmentation — selector manual de país
 * Paleta alineada al tema UroAcademy: azul oscuro + púrpura + gradiente.
 */

.ua-country-selector {
	--ua-primary:        #00457C;
	--ua-primary-dark:   #012965;
	--ua-accent:         #BB33FF;
	--ua-accent-soft:    rgba(187, 51, 255, 0.12);
	--ua-text:           #012965;
	--ua-muted:          #6b7a90;
	--ua-border:         rgba(1, 41, 101, 0.18);
	--ua-border-hover:   rgba(1, 41, 101, 0.35);
	--ua-bg:             #ffffff;
	--ua-bg-hover:       #f4f7fb;
	--ua-shadow:         0 4px 14px rgba(1, 41, 101, 0.12);
	--ua-gradient:       linear-gradient(90deg, #3485FE 0%, #BB33FF 55%, #99FBFF 100%);
	--ua-radius:         999px;
	--ua-radius-panel:   14px;
	--ua-font:           inherit;

	display: inline-flex;
	align-items: center;
	gap: 0px;
	font-family: var(--ua-font);
	font-size: 14px;
	line-height: 1.3;
	color: var(--ua-text);
}

.ua-country-selector__label {
	font-weight: 600;
	color: var(--ua-primary-dark);
	letter-spacing: 0.01em;
	white-space: nowrap;
}

/* ============================================================
 * DROPDOWN CUSTOM (div-based, panel estilable)
 * ============================================================ */
.ua-country-selector--dropdown {
	margin: 0;
}
.ua-country-selector__combo {
	position: relative;
	display: inline-block;
}
/* Trigger (botón) */
.ua-country-selector__field {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px 8px 12px;
	min-width: 180px;
	background: var(--ua-bg);
	border: 1.5px solid var(--ua-border);
	border-radius: var(--ua-radius);
	font: inherit;
	font-weight: 600;
	color: var(--ua-text);
	cursor: pointer;
	text-align: left;
	transition: border-color .2s, box-shadow .2s, transform .15s;
	box-shadow: 0 1px 2px rgba(1, 41, 101, 0.04);
	outline: none;
}
.ua-country-selector__field:hover {
	border-color: var(--ua-accent);
	box-shadow: var(--ua-shadow);
}
.ua-country-selector__field:focus-visible,
.ua-country-selector--dropdown.is-open .ua-country-selector__field {
	border-color: var(--ua-accent);
	box-shadow: 0 0 0 3px var(--ua-accent-soft);
}
.ua-country-selector__field-flag {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.ua-country-selector__icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	color: var(--ua-primary);
}
.ua-country-selector__field-label {
	flex: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.ua-country-selector__caret {
	width: 12px;
	height: 12px;
	flex-shrink: 0;
	color: var(--ua-primary);
	transition: transform .2s, color .2s;
}
.ua-country-selector__field:hover .ua-country-selector__caret {
	color: var(--ua-accent);
}
.ua-country-selector--dropdown.is-open .ua-country-selector__caret {
	transform: rotate(180deg);
	color: var(--ua-accent);
}

/* Panel (lista de opciones) */
.ua-country-selector__panel {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 100;
	min-width: 100%;
	max-width: 320px;
	max-height: 360px;
	overflow-y: auto;
	margin: 0;
	padding: 6px;
	list-style: none;
	background: var(--ua-bg);
	border: 1px solid var(--ua-border);
	border-radius: var(--ua-radius-panel);
	box-shadow: 0 12px 32px rgba(1, 41, 101, 0.18);
	animation: ua-fade-in .18s ease-out;
}
@keyframes ua-fade-in {
	from { opacity: 0; transform: translateY(-4px); }
	to   { opacity: 1; transform: translateY(0); }
}
.ua-country-selector__panel[hidden] {
	display: none;
}
.ua-country-selector__option {
	margin: 0;
	padding: 0;
	list-style: none;
	border-radius: 10px;
}
.ua-country-selector__option a {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 12px;
	border-radius: 10px;
	text-decoration: none;
	color: var(--ua-text);
	font-weight: 500;
	transition: background .15s, color .15s;
	outline: none;
}
.ua-country-selector__option a:hover,
.ua-country-selector__option a:focus-visible {
	background: var(--ua-bg-hover);
	color: var(--ua-primary-dark);
	text-decoration: none;
}
.ua-country-selector__option.is-selected a {
	background: var(--ua-accent-soft);
	color: var(--ua-primary-dark);
	font-weight: 700;
}
.ua-country-selector__option.is-selected a:hover {
	background: rgba(187, 51, 255, 0.18);
}
.ua-country-selector__flag {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	object-fit: cover;
	flex-shrink: 0;
	box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.ua-country-selector__flag--placeholder {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--ua-gradient);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	box-shadow: none;
}
/* Bandera para la opción "Otro" (Colombia) */
.ua-country-selector__flag--other {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background-image: url('/wp-content/themes/Divi-child/doc/bandera_colombia.jpg');
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	font-size: 0;
	color: transparent;
	border: 1px solid var(--ua-border);
	box-shadow: none;
}
.ua-country-selector__option--other.is-selected .ua-country-selector__flag--other {
	border-color: var(--ua-accent);
}
/* Botón "Otro" en modo buttons/flags */
.ua-country-selector__btn--other .ua-country-selector__flag--other {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	font-size: 12px;
}
.ua-country-selector--flags .ua-country-selector__btn--other {
	border: 1.5px dashed var(--ua-border-hover);
	background: rgba(1, 41, 101, 0.04);
}
.ua-country-selector--flags .ua-country-selector__btn--other.is-active {
	border-style: solid;
	border-color: var(--ua-accent);
}
.ua-country-selector__name {
	flex: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.ua-country-selector__iso {
	display: inline-block;
	padding: 2px 8px;
	font-size: 0.75em;
	font-weight: 700;
	color: var(--ua-muted);
	background: rgba(1, 41, 101, 0.06);
	border-radius: 999px;
	letter-spacing: 0.04em;
}
.ua-country-selector__option.is-selected .ua-country-selector__iso {
	background: var(--ua-accent);
	color: #fff;
}
.ua-country-selector__check {
	width: 16px;
	height: 16px;
	color: var(--ua-accent);
	flex-shrink: 0;
}

/* Fallback <noscript> */
.ua-country-selector__noscript {
	display: inline-flex;
	gap: 6px;
	align-items: center;
}
.ua-country-selector__noscript select {
	padding: 8px 10px;
	border-radius: 8px;
	border: 1px solid var(--ua-border);
}
.ua-country-selector__noscript button {
	padding: 8px 14px;
	border: 0;
	border-radius: 8px;
	background: var(--ua-primary);
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}

/* ============================================================
 * BOTONES (pills con bandera)
 * ============================================================ */
.ua-country-selector--buttons {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}
.ua-country-selector__btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	background: var(--ua-bg);
	border: 1.5px solid var(--ua-border);
	border-radius: var(--ua-radius);
	color: var(--ua-text);
	text-decoration: none;
	font-weight: 600;
	transition: all .2s;
	box-shadow: 0 1px 2px rgba(1, 41, 101, 0.04);
}
.ua-country-selector__btn:hover {
	border-color: var(--ua-accent);
	background: var(--ua-bg-hover);
	box-shadow: var(--ua-shadow);
	transform: translateY(-1px);
	color: var(--ua-primary-dark);
	text-decoration: none;
}
.ua-country-selector__btn.is-active {
	background: var(--ua-gradient);
	border-color: transparent;
	color: #fff;
	box-shadow: 0 4px 14px rgba(187, 51, 255, 0.35);
}
.ua-country-selector__btn.is-active:hover {
	transform: translateY(-1px);
	filter: brightness(1.05);
	color: #fff;
}
.ua-country-selector__btn img {
	display: block;
	width: 22px;
	height: auto;
	border-radius: 3px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ============================================================
 * FLAGS (solo banderas circulares, muy compacto — ideal al lado del menú)
 * ============================================================ */
.ua-country-selector--flags {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px;
	background: rgba(1, 41, 101, 0.04);
	border-radius: var(--ua-radius);
}
.ua-country-selector--flags .ua-country-selector__btn {
	position: relative;
	padding: 0;
	width: 36px;
	height: 36px;
	border: 2px solid transparent;
	background: transparent;
	box-shadow: none;
	overflow: hidden;
	border-radius: 50%;
}
.ua-country-selector--flags .ua-country-selector__btn img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	box-shadow: none;
}
.ua-country-selector--flags .ua-country-selector__btn span {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
.ua-country-selector--flags .ua-country-selector__btn:hover {
	background: transparent;
	border-color: var(--ua-accent-soft);
	transform: scale(1.08);
}
.ua-country-selector--flags .ua-country-selector__btn.is-active {
	background: transparent;
	border-color: var(--ua-accent);
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ua-accent), 0 4px 10px rgba(187, 51, 255, 0.4);
}
.ua-country-selector--flags .ua-country-selector__btn.is-active img {
	transform: scale(1);
}

/* Tooltip del nombre en modo flags */
.ua-country-selector--flags .ua-country-selector__btn::after {
	content: attr(data-label);
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%) translateY(4px);
	background: var(--ua-primary-dark);
	color: #fff;
	padding: 4px 10px;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity .2s, transform .2s;
	z-index: 10;
}
.ua-country-selector--flags .ua-country-selector__btn:hover::after {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* ============================================================
 * Reset — botón × circular compacto
 * ============================================================ */
.ua-country-selector__reset {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-left: 6px;
	width: 28px;
	height: 28px;
	padding: 0;
	font-size: 18px;
	font-weight: 400;
	line-height: 1;
	color: var(--ua-muted);
	text-decoration: none;
	background: rgba(1, 41, 101, 0.05);
	border: 1px solid transparent;
	border-radius: 50%;
	transition: color .15s, background .15s, border-color .15s, transform .15s;
}
.ua-country-selector__reset:hover {
	color: #fff;
	background: var(--ua-accent);
	border-color: var(--ua-accent);
	text-decoration: none;
	transform: rotate(90deg);
}
.ua-country-selector--flags .ua-country-selector__reset {
	margin-left: 2px;
	width: 36px;
	height: 36px;
	font-size: 20px;
}

/* ============================================================
 * Responsive — tablet Divi (≤ 980px)
 * El contenedor del módulo permite wrap para que nada se recorte.
 * ============================================================ */
@media (max-width: 980px) {
	div#menu_registro .et_pb_text_inner {
		flex-wrap: wrap;
		row-gap: 8px;
		column-gap: 10px;
	}
}

/* ============================================================
 * Responsive — móvil (≤ 767px)
 * Trigger y panel más compactos.
 * ============================================================ */
@media (max-width: 767px) {
	div#menu_registro .et_pb_text_inner {
		display: flex;
		align-items: center;
		flex-wrap: wrap;
		gap: 10px;
		justify-content: center;
		width: 80%;
		margin: 0 auto;
	}

	div#menu_registro .et_pb_text_inner p {
		text-align: center;
	}

	.ua-country-selector {
		font-size: 13px;
	}
	.ua-country-selector__field {
		min-width: 0;
		padding: 7px 12px 7px 10px;
		gap: 8px;
		font-size: 13px;
	}
	.ua-country-selector__field-flag {
		width: 28px !important;
		height: 28px !important;
	}
	.ua-country-selector__icon {
		width: 18px !important;
		height: 18px !important;
	}
	.ua-country-selector__field-label {
		max-width: 160px;
	}

	/* Panel: no desborda del viewport */
	.ua-country-selector__panel {
		min-width: 240px;
		max-width: calc(100vw - 20px);
		max-height: 65vh;
	}

	/* Opciones */
	.ua-country-selector__option a {
		padding: 10px 12px;
		gap: 10px;
	}
	.ua-country-selector__flag {
		width: 38px !important;
		height: 38px !important;
	}
	.ua-country-selector__name {
		font-size: 14px;
	}

	/* Buttons */
	.ua-country-selector__btn {
		padding: 6px 12px;
		font-size: 13px;
	}

	/* Flags */
	.ua-country-selector--flags .ua-country-selector__btn {
		width: 44px !important;
		height: 44px !important;
	}

	/* Reset × */
	.ua-country-selector__reset {
		width: 26px;
		height: 26px;
		font-size: 16px;
		margin-left: 4px;
	}
}

/* ============================================================
 * Responsive — móvil pequeño (≤ 480px)
 * Dentro de #menu_registro, el selector ocupa el ancho completo.
 * ============================================================ */
@media (max-width: 480px) {
	div#menu_registro .ua-country-selector--dropdown,
	div#menu_registro .ua-country-selector__combo,
	div#menu_registro .ua-country-selector__field {
		width: 100%;
	}
	.ua-country-selector__field-label {
		max-width: none;
	}
	.ua-country-selector__panel {
		min-width: 0;
	}
	.ua-country-selector--flags .ua-country-selector__btn {
		width: 38px !important;
		height: 38px !important;
	}
}

/* Compatibilidad con headers oscuros de Divi */
.et_fixed_nav .ua-country-selector__field,
.et-menu .ua-country-selector__field {
	background: rgba(255, 255, 255, 0.95);
}

/* ============================================================
 * Ajustes específicos del tema (módulo Divi del menú)
 * ============================================================ */
div#menu_registro .et_pb_text_inner {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
}

div#menu_registro .et_pb_text_inner p {
	margin: 0px !important;
	padding-bottom: 0px;
}

/* El <p></p> vacío que deja Divi no debe ocupar ancho */
div#menu_registro .et_pb_text_inner p:empty {
	display: none;
}

ul.ua-country-selector__panel {
	padding: 0px;
}
