/**
 * EPOFW Tooltip / Help Icon styles.
 *
 * Styles for the help icon (?) that appears next to field labels when help_text
 * is configured. Clean bordered circle with tooltip above. Pure CSS hover/focus reveal.
 *
 * @package Extra_Product_Options_For_WooCommerce
 * @version 4.4.8
 */

.epofw-help-icon {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	min-width: 20px;
	min-height: 20px;
	background-color: transparent;
	border: 2px solid #ccc;
	color: #666;
	border-radius: 50%;
	font-size: 13px;
	font-weight: bold;
	cursor: help;
	margin-right: 8px;
	margin-left: 0;
	vertical-align: text-bottom;
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	flex-shrink: 0;
	transition: all 0.2s ease;
	line-height: 1;
	white-space: nowrap;
	overflow: visible !important;
	z-index: 10001 !important;
}

.epofw-help-icon:hover {
	border-color: #999;
	color: #333;
	background-color: #f5f5f5;
}

.epofw-help-icon:focus-visible {
	outline: 2px solid #0073aa;
	outline-offset: 2px;
	border-color: #0073aa;
}

.epofw-help-icon:active {
	background-color: #efefef;
}

.epofw-help-icon__mark {
	display: block;
	line-height: 1;
	pointer-events: none;
	padding: 0;
	margin: 0;
	font-size: inherit;
}

.epofw-tooltip-text {
	display: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
	position: absolute !important;
	bottom: calc( 100% + 6px ) !important;
	left: 50% !important;
	right: auto !important;
	transform: translateX( -50% ) !important;
	background-color: #2c3e50 !important;
	border: none !important;
	color: #ffffff !important;
	font-size: 13px !important;
	font-weight: 400 !important;
	padding: 10px 14px !important;
	border-radius: 6px !important;
	white-space: normal !important;
	word-wrap: break-word !important;
	z-index: 10000 !important;
	pointer-events: auto !important;
	min-width: 140px !important;
	max-width: 280px !important;
	box-shadow: 0 6px 18px rgba( 0, 0, 0, 0.25 ) !important;
	line-height: 1.5 !important;
	text-align: left !important;
	width: auto !important;
	height: auto !important;
	margin: 0 !important;
	overflow: visible !important;
	float: none !important;
	clear: none !important;
	transition: opacity 0.2s ease, visibility 0.2s ease !important;
}

/*
 * Higher-specificity guard so themes that style spans inside labels can't
 * collapse the tooltip padding (which caused the text to touch the edges and
 * the descenders to clip). Also sizes the box to its content so there is no
 * lopsided empty space.
 */
.epofw-help-icon .epofw-tooltip-text {
	box-sizing: border-box !important;
	padding: 12px 16px !important;
	margin: 0 0 3px 0 !important;
	line-height: 1.5 !important;
	min-width: 0 !important;
	width: -moz-max-content !important;
	width: max-content !important;
	max-width: 280px !important;
	min-height: 0 !important;
	height: auto !important;
	overflow: visible !important;
	white-space: normal !important;
	text-align: left !important;
}

.epofw-tooltip-text a {
	color: #8ecbff !important;
	text-decoration: underline !important;
}

.epofw-tooltip-text a:hover {
	color: #bfe2ff !important;
}

.epofw-tooltip-text strong,
.epofw-tooltip-text b {
	font-weight: 600 !important;
}

.epofw-tooltip-text em,
.epofw-tooltip-text i {
	font-style: italic !important;
}

.epofw-tooltip-text::before {
	content: '' !important;
	/* Force content-box: themes set box-sizing:border-box globally, which would
	   collapse the 0x0 + border CSS triangle and hide the arrow entirely. */
	box-sizing: content-box !important;
	position: absolute !important;
	bottom: -15px !important;
	left: 50% !important;
	transform: translateX( -50% ) !important;
	border: 8px solid transparent !important;
	border-top-color: #2c3e50 !important;
	pointer-events: none !important;
	display: block !important;
	width: 0 !important;
	height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
}

.epofw-help-icon:hover .epofw-tooltip-text,
.epofw-help-icon:focus-visible .epofw-tooltip-text,
.epofw-help-icon:focus .epofw-tooltip-text {
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
	pointer-events: auto !important;
}

/* Ensure tooltip can overflow ALL parent containers - comprehensive coverage */
.epofw-label-left,
.epofw-field-container,
.epofw-global-label,
.epofw-section-wrapper,
.epofw-section,
.epofw-section-fields,
.epofw-fields-container,
.epofw-fields-table,
.epofw_fields_container,
.epofw_fields_table,
.epofw_addon_html,
.epofw_middle_tg,
.epofw-row-group,
.epofw-columns,
.epofw-column,
.epofw-field-label,
.epofw_td_label,
.epofw_tr_se,
.label,
.label_div,
.epofw_field_container {
	overflow: visible !important;
}

/* Extra specificity for label containers that might clip the tooltip */
.epofw_tr_se .label,
.epofw_field_container .label,
.epofw_field_container .label_div,
.epofw_td_label .label_div,
.label_div span,
form.cart,
.cart {
	overflow: visible !important;
	z-index: auto !important;
}

/* ── Responsive Design ────────────────────────────────────────────────────── */

/* Tablet: slightly smaller icon and tooltip. */
@media ( max-width: 1024px ) {
	.epofw-help-icon {
		width: 18px;
		height: 18px;
		min-width: 18px;
		min-height: 18px;
		font-size: 12px;
		margin-right: 6px;
		border-width: 1.5px;
	}

	.epofw-tooltip-text {
		max-width: 260px;
		font-size: 12px;
		padding: 10px 14px;
		bottom: calc( 100% + 6px );
		left: auto !important;
		right: 0 !important;
		transform: translateX( 75% ) !important;
		margin-right: 8px !important;
	}

	.epofw-tooltip-text::before {
		border: 6px solid transparent;
		border-top-color: #2c3e50;
		bottom: -6px;
	}
}

/* Mobile/touch devices: compact mode, ensure tooltip works on tap. */
@media ( max-width: 768px ) {
	.epofw-help-icon {
		width: 20px;
		height: 20px;
		min-width: 20px;
		min-height: 20px;
		font-size: 13px;
		margin-right: 8px;
		border-width: 2px;
	}

	.epofw-tooltip-text {
		max-width: 240px;
		font-size: 12px;
		padding: 10px 14px;
		bottom: calc( 100% + 6px );
		left: auto !important;
		right: 0 !important;
		transform: translateX( 75% ) !important;
		margin-right: 8px !important;
	}

	.epofw-tooltip-text::before {
		border: 6px solid transparent;
		border-top-color: #2c3e50;
		bottom: -6px;
	}

	/* Ensure tooltip is visible on tap/focus without relying on hover. */
	.epofw-help-icon:focus .epofw-tooltip-text {
		display: block;
	}
}

/* Small mobile screens: maintain readability */
@media ( max-width: 480px ) {
	.epofw-help-icon {
		width: 18px;
		height: 18px;
		min-width: 18px;
		min-height: 18px;
		font-size: 12px;
		margin-right: 6px;
		border-width: 1.5px;
	}

	.epofw-tooltip-text {
		max-width: 240px;
		font-size: 12px;
		padding: 8px 12px;
		bottom: calc( 100% + 6px );
	}

	.epofw-tooltip-text::before {
		border: 5px solid transparent;
		border-top-color: #2c3e50;
		bottom: -5px;
	}
}
