div.pl_twilio_phone_div {
	display: flex;
	position: relative;
}

/* Hide "Create account" at checkout until email verified (Guest OTP). Toggled via JS. */
.pl-guest-otp-create-account-hidden {
	display: none !important;
}

/* Hide mobile OTP block (radios + button) when verified - same pattern as block checkout. */
.pl-ptv-mobile-otp-hidden {
	display: none !important;
}

.select2-container--default {
	margin-right: 15px;
}

.select2-container--default .select2-selection--single {
	height: inherit !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-container--default .select2-selection--single .select2-selection__arrow {
	line-height: 42px !important;
	height: 42px !important;
}

#pl_twilio_otp_input {
	line-height: 42px !important;
	margin-top: 10px;
	text-align: center;
}
.pl-twilio-otp-btn {
	width: auto;
	height: auto;
	line-height: 45px;
	z-index: 10;
	cursor: pointer;
	font-size: 12px;
	text-transform: uppercase;
	color: var(--wp-admin-theme-color);
	font-weight: bold;
	text-align: center;
	border: 1px solid silver;
	background: #efefef;
	margin-top: 10px;
}
#pl_twillio_login_request_button {
	margin-bottom: 5px;
}
#pl_twillio_login_validate_button {
	margin-left: 5px;
}

#pl_twilio_otp_consent,
.pl-ptv-otp-consent {
	margin-top: 10px;
	margin-bottom: 0;
}

/* Ensure consent is hidden when OTP block is hidden (belt-and-suspenders) */
.pl-ptv-mobile-otp-hidden #pl_twilio_otp_consent,
.pl-ptv-mobile-otp-hidden .pl-ptv-otp-consent {
	display: none !important;
}

.pl-margin-top-5 {
	margin-top: 5px;
}

.pl_twilio_otp_mode_radio {
	margin-right: 5px;
}

/* Verify button styling */
.pl-twilio-verify-btn {
	width: auto;
	height: auto;
	min-width: 100px;
	line-height: 38px;
	padding: 0 15px;
	cursor: pointer;
	font-size: 13px;
	text-transform: none;
	color: #fff;
	font-weight: 600;
	text-align: center;
	border: 1px solid #2271b1;
	background: #2271b1;
	margin-top: 10px;
	margin-left: 10px;
	border-radius: 3px;
	transition: background-color 0.2s ease;
}

.pl-twilio-verify-btn:hover:not(:disabled) {
	background: #135e96;
	border-color: #135e96;
}

.pl-twilio-verify-btn:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* OTP feedback styling */
.pl-otp-feedback {
	display: inline-block;
	margin-left: 10px;
	margin-top: 10px;
	padding: 8px 12px;
	border-radius: 3px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
}

.pl-otp-feedback.pl-otp-success {
	background-color: #d4edda;
	color: #155724;
	border: 1px solid #c3e6cb;
}

.pl-otp-feedback.pl-otp-error {
	background-color: #f8d7da;
	color: #721c24;
	border: 1px solid #f5c6cb;
}

.pl-otp-checkmark {
	display: inline-block;
	color: #28a745;
	font-weight: bold;
	font-size: 16px;
	margin-right: 5px;
	vertical-align: middle;
}

.pl-otp-error-icon {
	display: inline-block;
	color: #dc3545;
	font-weight: bold;
	font-size: 16px;
	margin-right: 5px;
	vertical-align: middle;
}

/* Verified OTP input styling */
#pl_twilio_otp_input input.pl-otp-verified,
#pl_twilio_otp_input.pl-otp-verified,
#pl_twilio_email_otp_input.pl-otp-verified {
	background-color: #d4edda;
	border-color: #c3e6cb;
	color: #155724;
}

/* Email OTP wrapper styling */
#pl_twilio_email_otp_wrapper,
#pl_ptv_account_email_otp_wrapper,
#pl_ptv_billing_email_otp_wrapper,
.pl-ptv-email-otp-block {
	margin-top: 15px;
	margin-bottom: 15px;
	padding: 15px;
	background-color: #f8f9fa;
	border: 1px solid #dee2e6;
	border-radius: 4px;
}

#pl_twilio_email_otp_wrapper label,
#pl_twilio_phone_otp_wrapper label,
.pl-ptv-email-otp-block label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
	color: #333;
}

#pl_twilio_email_otp_wrapper input,
#pl_twilio_phone_otp_wrapper input,
.pl-ptv-email-otp-block input[type="text"] {
	width: 100%;
	max-width: 300px;
	margin-bottom: 10px;
}

#pl_twilio_email_otp_wrapper .pl-twilio-verify-btn,
#pl_twilio_phone_otp_wrapper .pl-twilio-verify-btn,
.pl-ptv-email-otp-block .pl-twilio-verify-btn {
	margin-left: 0;
	margin-right: 10px;
}

/* Email OTP inline row: align input and verify button vertically */
#pl_twilio_email_otp_wrapper .pl-ptv-otp-input-row {
	align-items: center;
}

#pl_twilio_email_otp_wrapper .pl-ptv-otp-input-row #pl_twilio_email_otp_input {
	height: 40px;
	box-sizing: border-box;
	padding: 8px 12px;
	margin-bottom: 0;
}

#pl_twilio_email_otp_wrapper .pl-ptv-otp-input-row #pl_twilio_verify_email_otp {
	height: 40px;
	line-height: 38px;
	padding: 0 15px;
	margin-top: 0;
	box-sizing: border-box;
}

/* Checkout: "Also update my account login email" checkbox alignment */
#pl_twilio_email_otp_wrapper #pl_ptv_update_account_email_wrap {
	text-align: left !important;
}
#pl_twilio_email_otp_wrapper #pl_ptv_update_account_email_wrap label {
	/*
	 * Use 2-column grid so wrapped text aligns under itself,
	 * and the checkbox stays on the left.
	 */
	display: grid !important;
	grid-template-columns: 16px 1fr;
	column-gap: 8px !important;
	align-items: start !important;
	margin: 0 !important;
	width: 100% !important;
	line-height: 1.3 !important;
	font-weight: 400 !important;
	white-space: normal !important;
}
#pl_twilio_email_otp_wrapper #pl_ptv_update_account_email_wrap input[type="checkbox"] {
	margin: 0 !important;
	margin-top: 2px !important;
}

#pl_twilio_email_otp_wrapper #pl_ptv_update_account_email_wrap .pl-ptv-inline-checkbox-label {
	display: block;
}

/* Countdown timer styling */
.pl-otp-countdown {
	display: inline-block;
	color: #666;
	font-size: 13px;
	font-style: italic;
	vertical-align: middle;
}

/* Email OTP input wrapper (hidden initially) */
#pl_twilio_email_otp_input_wrapper {
	margin-bottom: 15px;
}

/* Phone OTP wrapper styling (matches email OTP, block checkout pattern) */
#pl_twilio_phone_otp_wrapper,
.pl-ptv-mobile-otp-block {
	margin-top: 15px;
	padding: 15px;
	background-color: #f8f9fa;
	border: 1px solid #dee2e6;
	border-radius: 4px;
}

/* Inner block: radios + send button contained together */
.pl-ptv-mobile-otp-block-inner {
	display: block;
	width: 100%;
}

/* Phone OTP input row: input and Verify button side by side without overlap */
#pl_twilio_phone_otp_wrapper .pl-ptv-otp-input-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
}

#pl_twilio_phone_otp_wrapper .pl-ptv-otp-input-row #pl_twilio_otp_input {
	flex: 1;
	min-width: 120px;
	max-width: 300px;
	margin-bottom: 0;
	height: 40px;
	box-sizing: border-box;
	padding: 8px 12px;
}

#pl_twilio_phone_otp_wrapper .pl-ptv-otp-input-row #pl_twilio_verify_phone_otp {
	flex-shrink: 0;
	height: 40px;
	line-height: 38px;
	padding: 0 15px;
	margin-top: 0;
	margin-bottom: 0;
	box-sizing: border-box;
}

/* Phone OTP input wrapper (hidden initially) */
#pl_twilio_phone_otp_input_wrapper {
	margin-bottom: 15px;
}

/* Phone OTP radio buttons: radio on left, WhatsApp above SMS, stacked vertically (inside pl-ptv-mobile-otp-block-inner) */
#pl_twilio_phone_otp_wrapper #pl_twilio_otp_mode_div,
.pl-ptv-mobile-otp-block-inner #pl_twilio_otp_mode_div {
	text-align: left !important;
	margin-bottom: 15px;
	margin-left: 0 !important;
	margin-right: 0 !important;
	margin-top: 0 !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: flex-start;
	gap: 8px;
	width: 100%;
	position: relative;
	box-sizing: border-box;
}

#pl_twilio_phone_otp_wrapper #pl_twilio_otp_mode_div label {
	display: flex !important;
	flex-direction: row;
	align-items: center;
	justify-content: flex-start;
	margin: 0 !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding: 0 !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
	text-align: left;
	text-indent: 0 !important;
	float: none !important;
	cursor: pointer;
	width: 100%;
	min-width: 0;
	max-width: 100%;
	box-sizing: border-box;
	position: relative;
	left: 0 !important;
	transform: translateX(0) !important;
	align-self: flex-start;
}

/* Reset any pseudo-elements that might add spacing */
#pl_twilio_phone_otp_wrapper #pl_twilio_otp_mode_div label::before,
#pl_twilio_phone_otp_wrapper #pl_twilio_otp_mode_div label::after {
	content: none !important;
	margin: 0 !important;
	padding: 0 !important;
	display: none !important;
}

#pl_twilio_phone_otp_wrapper #pl_twilio_otp_mode_div input[type="radio"] {
	margin: 0 !important;
	margin-right: 8px !important;
	margin-left: 0 !important;
	margin-top: 0 !important;
	margin-bottom: 0 !important;
	flex-shrink: 0;
	flex-grow: 0;
	float: none !important;
	order: -1;
	vertical-align: middle;
	position: relative;
	left: 0 !important;
	width: auto;
	min-width: 16px;
	max-width: 16px;
}

/* Ensure all labels start at the same position - no indentation differences */
#pl_twilio_phone_otp_wrapper #pl_twilio_otp_mode_div label:first-child,
#pl_twilio_phone_otp_wrapper #pl_twilio_otp_mode_div label:last-child,
#pl_twilio_phone_otp_wrapper #pl_twilio_otp_mode_div label:nth-child(1),
#pl_twilio_phone_otp_wrapper #pl_twilio_otp_mode_div label:nth-child(2) {
	margin-left: 0 !important;
	margin-right: 0 !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
	text-indent: 0 !important;
	left: 0 !important;
	position: relative;
}

/* Reset any list-style or inherited padding that might affect first label */
#pl_twilio_phone_otp_wrapper #pl_twilio_otp_mode_div label:first-child {
	margin-left: 0 !important;
	padding-left: 0 !important;
}

/* Block checkout: hide label when we've added country code wrapper (avoids "Phone" overlay on country selector) */
.wc-block-components-phone-number:has(.pl-phone-with-country-code) .wc-block-components-input-label,
.wc-block-components-phone-number:has(.pl-phone-with-country-code) label,
.wc-block-components-text-input:has(.pl-phone-with-country-code) .wc-block-components-input-label,
.wc-block-components-text-input:has(.pl-phone-with-country-code) label {
	display: none !important;
}

/* Compact country code selector */
#billing_phone_code {
	display: inline-block;
	margin-right: 8px;
	vertical-align: middle;
	flex-shrink: 0;
	min-width: 5.5em;
	max-width: 7.5em;
}

/* Flex container for country code + phone input */
.pl-phone-with-country-code {
	display: flex !important;
	align-items: center !important;
	gap: 8px !important;
	flex-wrap: nowrap !important;
	width: 100%;
}

.pl-phone-with-country-code #billing_phone_code {
	margin-right: 8px;
	flex-shrink: 0;
	min-width: 5.5em;
	max-width: 7.5em;
}

/* Compact Select2 for country code (phone row only) */
#billing_phone_field .select2-container,
.wc-block-components-phone-number .select2-container,
.wc-block-components-text-input:has(input[type="tel"]) .select2-container {
	max-width: 7.5em !important;
}
.select2-container--default .select2-selection--single {
	min-height: 40px;
}

.pl-phone-with-country-code input[type="tel"],
.pl-phone-with-country-code #billing_phone,
.pl-phone-with-country-code #phone {
	flex: 1;
	min-width: 0; /* Allow input to shrink if needed */
}

/* Ensure country code selector appears before phone input, not after postal code */
#billing_phone_field .pl-phone-with-country-code,
.wc-block-components-phone-number .pl-phone-with-country-code,
.wc-block-components-text-input .pl-phone-with-country-code {
	display: flex !important;
	align-items: center !important;
}

/* For traditional checkout - ensure wrapper contains flex container */
#billing_phone_field .woocommerce-input-wrapper .pl-phone-with-country-code {
	width: 100%;
}

/* Force phone field onto its own row */

/* Traditional checkout: form-row-wide is set via filter; ensure full width. */
#billing_phone_field.form-row-wide {
	width: 100%;
	clear: both;
}

/* Block-based checkout: force phone container to full width / new row. */
.wc-block-checkout__form .wc-block-components-phone-number,
.wc-block-checkout .wc-block-components-text-input:has(input[type="tel"][id="phone"]),
.wc-block-checkout .wc-block-components-text-input:has(input[type="tel"][name="billing_phone"]) {
	grid-column: 1 / -1;
	width: 100%;
}

/* Fallback for block checkout when :has() not available (older browsers) */
.wc-block-components-phone-number {
	grid-column: 1 / -1;
	width: 100%;
}

/* My Account edit address: force phone OTP block full width (theme grid / e.g. Kadence) */
.woocommerce-edit-address .woocommerce-address-fields__field-wrapper #pl_twilio_phone_otp_wrapper,
.woocommerce-edit-address .woocommerce-address-fields__field-wrapper .pl-ptv-mobile-otp-block.form-row-wide {
	grid-column: 1 / -1;
	width: 100%;
	clear: both;
}