/**
 * Tax Toggle for WooCommerce – AJAX by iKetch
 * Front-end Styles
 *
 * @package iKetch\TaxToggle
 */

:root {
	--iketch-tax-toggle-accent: #2271b1;
	--iketch-tax-toggle-accent-hover: #135e96;
	--iketch-tax-toggle-bg: #e2e8f0;
	--iketch-tax-toggle-active-bg: #2271b1;
	--iketch-tax-toggle-text: #1e293b;
	--iketch-tax-toggle-text-muted: #64748b;
	--iketch-tax-toggle-knob: #ffffff;
	--iketch-tax-toggle-border: #cbd5e1;
	--iketch-tax-toggle-radius: 9999px;
	--iketch-tax-toggle-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main Wrapper */
.iketch-tax-toggle-wrapper {
	display: inline-flex;
	align-items: center;
	margin: 10px 0;
	font-family: inherit;
	font-size: 14px;
	line-height: 1.4;
	color: inherit;
	user-select: none;
	vertical-align: middle;
	box-sizing: border-box;
}

.iketch-tax-toggle-wrapper *,
.iketch-tax-toggle-wrapper *::before,
.iketch-tax-toggle-wrapper *::after {
	box-sizing: inherit;
}

/* Loading state */
.iketch-tax-toggle-wrapper.iketch-tax-toggle-is-loading {
	opacity: 0.65;
	pointer-events: none;
	cursor: wait;
}

/* ==========================================================================
   Switch UI & Theme / Elementor Button Reset Shield
   ========================================================================== */
.iketch-tax-toggle-switch-container {
	display: inline-flex !important;
	align-items: center !important;
	gap: 10px !important;
	vertical-align: middle !important;
}

.iketch-tax-toggle-label {
	font-size: 13px !important;
	font-weight: 500 !important;
	line-height: 1.2 !important;
	color: currentColor !important;
	opacity: 0.75 !important;
	cursor: pointer !important;
	margin: 0 !important;
	padding: 0 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	user-select: none !important;
	display: inline-block !important;
	transition: opacity var(--iketch-tax-toggle-transition), color var(--iketch-tax-toggle-transition) !important;
}

.iketch-tax-toggle-label.is-active {
	color: currentColor !important;
	opacity: 1 !important;
	font-weight: 600 !important;
}

/* Bulletproof Button Reset for Switch across all themes (Woodmart, Elementor, etc.) */
.iketch-tax-toggle-switch,
button.iketch-tax-toggle-switch,
.iketch-tax-toggle-wrapper button.iketch-tax-toggle-switch,
.iketch-tax-toggle-floating button.iketch-tax-toggle-switch {
	all: unset !important;
	position: relative !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: flex-start !important;
	width: 48px !important;
	min-width: 48px !important;
	max-width: 48px !important;
	height: 26px !important;
	min-height: 26px !important;
	max-height: 26px !important;
	padding: 2px !important;
	margin: 0 !important;
	background: rgba(128, 128, 128, 0.25) !important;
	background-color: rgba(128, 128, 128, 0.25) !important;
	border: 1px solid rgba(128, 128, 128, 0.35) !important;
	border-radius: var(--iketch-tax-toggle-radius, 9999px) !important;
	cursor: pointer !important;
	outline: none !important;
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08) !important;
	box-sizing: border-box !important;
	line-height: 1 !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	gap: 0 !important;
	transform: none !important;
	overflow: visible !important;
	vertical-align: middle !important;
	transition: background-color var(--iketch-tax-toggle-transition), border-color var(--iketch-tax-toggle-transition) !important;
}

.iketch-tax-toggle-switch.is-active,
button.iketch-tax-toggle-switch.is-active,
.iketch-tax-toggle-wrapper button.iketch-tax-toggle-switch.is-active,
.iketch-tax-toggle-floating button.iketch-tax-toggle-switch.is-active {
	background: var(--iketch-tax-toggle-active-bg, var(--iketch-tax-toggle-accent)) !important;
	background-color: var(--iketch-tax-toggle-active-bg, var(--iketch-tax-toggle-accent)) !important;
	border-color: var(--iketch-tax-toggle-active-bg, var(--iketch-tax-toggle-accent)) !important;
}

.iketch-tax-toggle-switch:focus-visible,
button.iketch-tax-toggle-switch:focus-visible,
.iketch-tax-toggle-wrapper button.iketch-tax-toggle-switch:focus-visible,
.iketch-tax-toggle-floating button.iketch-tax-toggle-switch:focus-visible {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--iketch-tax-toggle-accent) !important;
}

.iketch-tax-toggle-track,
.iketch-tax-toggle-switch .iketch-tax-toggle-track,
.iketch-tax-toggle-wrapper .iketch-tax-toggle-track,
.iketch-tax-toggle-floating .iketch-tax-toggle-track {
	position: relative !important;
	display: block !important;
	width: 100% !important;
	height: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
	background: transparent !important;
	box-shadow: none !important;
	border-radius: var(--iketch-tax-toggle-radius, 9999px) !important;
	box-sizing: border-box !important;
	pointer-events: none !important;
}

.iketch-tax-toggle-slider,
.iketch-tax-toggle-switch .iketch-tax-toggle-slider,
.iketch-tax-toggle-wrapper .iketch-tax-toggle-slider,
.iketch-tax-toggle-floating .iketch-tax-toggle-slider {
	position: absolute !important;
	top: 0 !important;
	inset-inline-start: 0 !important;
	width: 20px !important;
	min-width: 20px !important;
	max-width: 20px !important;
	height: 20px !important;
	min-height: 20px !important;
	max-height: 20px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
	background-color: var(--iketch-tax-toggle-knob, #ffffff) !important;
	border-radius: 50% !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) !important;
	box-sizing: border-box !important;
	transition: transform var(--iketch-tax-toggle-transition) !important;
	pointer-events: none !important;
}

/* Switch Active State (LTR) */
.iketch-tax-toggle-switch.is-active .iketch-tax-toggle-slider {
	transform: translateX(22px) !important;
}

/* RTL Support for Switch */
html[dir="rtl"] .iketch-tax-toggle-switch.is-active .iketch-tax-toggle-slider,
body.rtl .iketch-tax-toggle-switch.is-active .iketch-tax-toggle-slider {
	transform: translateX(-22px) !important;
}

/* ==========================================================================
   Buttons UI & Theme / Elementor Button Reset Shield
   ========================================================================== */
.iketch-tax-toggle-buttons,
.iketch-tax-toggle-wrapper .iketch-tax-toggle-buttons,
.iketch-tax-toggle-floating .iketch-tax-toggle-buttons {
	display: inline-flex !important;
	align-items: center !important;
	background-color: rgba(128, 128, 128, 0.15) !important;
	border: 1px solid rgba(128, 128, 128, 0.25) !important;
	border-radius: var(--iketch-tax-toggle-radius, 9999px) !important;
	padding: 3px !important;
	gap: 2px !important;
	margin: 0 !important;
	box-sizing: border-box !important;
}

.iketch-tax-toggle-btn,
button.iketch-tax-toggle-btn,
.iketch-tax-toggle-wrapper button.iketch-tax-toggle-btn,
.iketch-tax-toggle-floating button.iketch-tax-toggle-btn {
	all: unset !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 5px 14px !important;
	background: transparent !important;
	border: none !important;
	border-radius: var(--iketch-tax-toggle-radius, 9999px) !important;
	min-height: auto !important;
	max-height: none !important;
	height: auto !important;
	font-size: 13px !important;
	font-weight: 500 !important;
	color: currentColor !important;
	opacity: 0.75 !important;
	cursor: pointer !important;
	margin: 0 !important;
	line-height: 1.2 !important;
	box-shadow: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	gap: 0 !important;
	text-decoration: none !important;
	box-sizing: border-box !important;
	transition: all var(--iketch-tax-toggle-transition) !important;
}

.iketch-tax-toggle-btn:hover,
button.iketch-tax-toggle-btn:hover {
	opacity: 1 !important;
}

.iketch-tax-toggle-btn:focus-visible,
button.iketch-tax-toggle-btn:focus-visible {
	outline: none !important;
	box-shadow: 0 0 0 2px var(--iketch-tax-toggle-accent, #2271b1) !important;
}

.iketch-tax-toggle-btn.is-active,
button.iketch-tax-toggle-btn.is-active,
.iketch-tax-toggle-wrapper button.iketch-tax-toggle-btn.is-active,
.iketch-tax-toggle-floating button.iketch-tax-toggle-btn.is-active {
	background: var(--iketch-tax-toggle-accent, #2271b1) !important;
	background-color: var(--iketch-tax-toggle-accent, #2271b1) !important;
	color: #ffffff !important;
	opacity: 1 !important;
	font-weight: 600 !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}

/* ==========================================================================
   Price Label Enhancements
   ========================================================================== */
.iketch-tax-price {
	display: inline;
	transition: opacity 0.2s ease;
}

.iketch-tax-price-label {
	display: inline-block;
	font-size: 0.85em;
	color: var(--iketch-tax-toggle-text-muted);
	font-weight: normal;
	margin-inline-start: 4px;
}

/* Smooth fade during price update */
.iketch-tax-price.is-updating {
	opacity: 0.4;
}

/* Line break helper for 'new_line' price label position */
.iketch-tax-price-break {
	display: block;
	height: 2px;
}

/* Bulletproof layout for 'new_line' price label position */
.iketch-tax-price--new_line,
.iketch-tax-price--new-line {
	display: inline-flex !important;
	flex-direction: column !important;
	align-items: flex-start !important;
	vertical-align: middle !important;
}

.iketch-tax-price--new_line .iketch-tax-price-break,
.iketch-tax-price--new-line .iketch-tax-price-break {
	display: none !important;
}

.iketch-tax-price--new_line .iketch-tax-price-label,
.iketch-tax-price--new-line .iketch-tax-price-label {
	margin-inline-start: 0 !important;
	margin-top: 2px !important;
}

/* ==========================================================================
   Floating Toggle UI
   ========================================================================== */
:root {
	--iketch-tax-toggle-floating-bottom: 24px;
	--iketch-tax-toggle-floating-offset: 24px;
	--iketch-tax-toggle-floating-inline-offset: 24px;
	--iketch-tax-toggle-floating-block-offset: 24px;
	--iketch-tax-toggle-floating-zindex: 99990;
	--iketch-tax-toggle-floating-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
	--iketch-tax-toggle-floating-bg: rgba(255, 255, 255, 0.96);
	--iketch-tax-toggle-floating-border: #cbd5e1;
}

.iketch-tax-toggle-floating {
	position: fixed !important;
	z-index: var(--iketch-tax-toggle-floating-zindex, 99990) !important;
	background-color: var(--iketch-tax-toggle-floating-bg) !important;
	border: 1px solid var(--iketch-tax-toggle-floating-border) !important;
	border-radius: var(--iketch-tax-toggle-radius, 9999px) !important;
	box-shadow: var(--iketch-tax-toggle-floating-shadow) !important;
	padding: 4px 12px !important;
	display: inline-flex !important;
	align-items: center !important;
	backdrop-filter: blur(8px) !important;
	-webkit-backdrop-filter: blur(8px) !important;
	transition: transform 0.25s ease, opacity 0.25s ease !important;
	box-sizing: border-box !important;
	margin: 0 !important;
	max-width: none !important;
	--iketch-tax-toggle-accent: var(--iketch-tax-toggle-floating-accent, #2271b1);
}

.iketch-tax-toggle-floating .iketch-tax-toggle-wrapper {
	margin: 0 !important;
}

/* ==========================================================================
   The 6 Floating Positions (Physical Viewport Positioning for Consistent Placement)
   ========================================================================== */

/* 1. Bottom Right (Default) */
.iketch-tax-toggle-floating--bottom_right {
	bottom: var(--iketch-tax-toggle-floating-block-offset, 24px);
	top: auto;
	right: var(--iketch-tax-toggle-floating-inline-offset, 24px);
	left: auto;
	transform: none;
}

/* 2. Bottom Left */
.iketch-tax-toggle-floating--bottom_left {
	bottom: var(--iketch-tax-toggle-floating-block-offset, 24px);
	top: auto;
	left: var(--iketch-tax-toggle-floating-inline-offset, 24px);
	right: auto;
	transform: none;
}

/* 3. Top Right */
.iketch-tax-toggle-floating--top_right {
	top: var(--iketch-tax-toggle-floating-block-offset, 24px);
	bottom: auto;
	right: var(--iketch-tax-toggle-floating-inline-offset, 24px);
	left: auto;
	transform: none;
}

/* 4. Top Left */
.iketch-tax-toggle-floating--top_left {
	top: var(--iketch-tax-toggle-floating-block-offset, 24px);
	bottom: auto;
	left: var(--iketch-tax-toggle-floating-inline-offset, 24px);
	right: auto;
	transform: none;
}

/* 5. Center Right (50% Vertical) */
.iketch-tax-toggle-floating--center_right {
	top: 50%;
	bottom: auto;
	right: var(--iketch-tax-toggle-floating-inline-offset, 24px);
	left: auto;
	transform: translateY(-50%);
}

/* 6. Center Left (50% Vertical) */
.iketch-tax-toggle-floating--center_left {
	top: 50%;
	bottom: auto;
	left: var(--iketch-tax-toggle-floating-inline-offset, 24px);
	right: auto;
	transform: translateY(-50%);
}

/* Top positions clearance for logged-in WordPress Admin Bar */
body.admin-bar .iketch-tax-toggle-floating--top_right,
body.admin-bar .iketch-tax-toggle-floating--top_left {
	top: calc(var(--iketch-tax-toggle-floating-block-offset, 24px) + var(--wp-admin--admin-bar--height, 32px));
}

@media (max-width: 782px) {
	body.admin-bar .iketch-tax-toggle-floating--top_right,
	body.admin-bar .iketch-tax-toggle-floating--top_left {
		top: calc(var(--iketch-tax-toggle-floating-block-offset, 24px) + 46px);
	}
}

/* ==========================================================================
   Appearance Themes (Light, Dark ONLY - Fixed Light and Dark)
   ========================================================================== */

/* Light Theme (Default) */
.iketch-tax-toggle-appearance-light,
.iketch-tax-toggle-floating.iketch-tax-toggle-appearance-light {
	--iketch-tax-toggle-floating-bg: rgba(255, 255, 255, 0.96);
	--iketch-tax-toggle-floating-text: #1e293b;
	--iketch-tax-toggle-floating-text-muted: #64748b;
	--iketch-tax-toggle-floating-border: #cbd5e1;
	--iketch-tax-toggle-floating-shadow: 0 4px 16px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
	--iketch-tax-toggle-bg: #e2e8f0;
	--iketch-tax-toggle-text: #1e293b;
	--iketch-tax-toggle-text-muted: #64748b;
	--iketch-tax-toggle-border: #cbd5e1;
	color: #1e293b;
	background-color: var(--iketch-tax-toggle-floating-bg);
	border-color: var(--iketch-tax-toggle-floating-border);
}

/* Dark Theme */
.iketch-tax-toggle-appearance-dark,
.iketch-tax-toggle-floating.iketch-tax-toggle-appearance-dark {
	--iketch-tax-toggle-floating-bg: rgba(30, 41, 59, 0.96);
	--iketch-tax-toggle-floating-text: #f8fafc;
	--iketch-tax-toggle-floating-text-muted: #94a3b8;
	--iketch-tax-toggle-floating-border: #475569;
	--iketch-tax-toggle-floating-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0, 0, 0, 0.2);
	--iketch-tax-toggle-bg: #334155;
	--iketch-tax-toggle-text: #f8fafc;
	--iketch-tax-toggle-text-muted: #94a3b8;
	--iketch-tax-toggle-border: #475569;
	color: #f8fafc;
	background-color: var(--iketch-tax-toggle-floating-bg);
	border-color: var(--iketch-tax-toggle-floating-border);
}

.iketch-tax-toggle-appearance-dark .iketch-tax-toggle-wrapper,
.iketch-tax-toggle-floating.iketch-tax-toggle-appearance-dark .iketch-tax-toggle-wrapper {
	color: #f8fafc;
}

.iketch-tax-toggle-appearance-dark .iketch-tax-toggle-label.is-active,
.iketch-tax-toggle-floating.iketch-tax-toggle-appearance-dark .iketch-tax-toggle-label.is-active {
	color: #ffffff;
}

/* Inline Toggle Appearance Pill / Card Styling */
.iketch-tax-toggle-wrapper:not(.iketch-tax-toggle--floating-inner).iketch-tax-toggle-appearance-light {
	background-color: var(--iketch-tax-toggle-bg, #f1f5f9) !important;
	border: 1px solid var(--iketch-tax-toggle-border, #cbd5e1) !important;
	border-radius: var(--iketch-tax-toggle-radius, 9999px) !important;
	padding: 4px 14px !important;
	color: #1e293b !important;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}

.iketch-tax-toggle-wrapper:not(.iketch-tax-toggle--floating-inner).iketch-tax-toggle-appearance-dark {
	background-color: #1e293b !important;
	border: 1px solid #475569 !important;
	border-radius: var(--iketch-tax-toggle-radius, 9999px) !important;
	padding: 4px 14px !important;
	color: #f8fafc !important;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
}

/* Toggle Shape */
.iketch-tax-toggle-wrapper.iketch-tax-toggle-shape-rounded,
.iketch-tax-toggle-floating.iketch-tax-toggle-shape-rounded {
	--iketch-tax-toggle-radius: 9999px;
}

.iketch-tax-toggle-wrapper.iketch-tax-toggle-shape-square,
.iketch-tax-toggle-floating.iketch-tax-toggle-shape-square {
	--iketch-tax-toggle-radius: 8px;
}

/* ========================================================================== 
   Responsive device visibility & Safe Spacing
   ========================================================================== */
@media (min-width: 1025px) {
	.iketch-tax-toggle-hide-desktop,
	.iketch-tax-toggle-floating.iketch-tax-toggle-hide-desktop {
		display: none !important;
	}
}

@media (min-width: 769px) and (max-width: 1024px) {
	.iketch-tax-toggle-hide-tablet,
	.iketch-tax-toggle-floating.iketch-tax-toggle-hide-tablet {
		display: none !important;
	}
}

@media (max-width: 768px) {
	.iketch-tax-toggle-hide-mobile,
	.iketch-tax-toggle-floating.iketch-tax-toggle-hide-mobile {
		display: none !important;
	}

	.iketch-tax-toggle-floating {
		max-width: calc(100vw - 32px);
	}

	.iketch-tax-toggle-floating--bottom_right,
	.iketch-tax-toggle-floating--bottom_left {
		bottom: calc(var(--iketch-tax-toggle-floating-block-offset, 24px) + env(safe-area-inset-bottom, 0px));
	}
}
