/**
 * SmartTR Address — Plugin-specific admin styles.
 *
 * Framework-level styles (card chrome, buttons, forms, spacing, brand colors)
 * are provided by cecom-plugin-admin-ui-framework.css (Bootstrap 5.3 overrides).
 * Only plugin-specific overrides live here.
 *
 * @package CecomsmaradAddress
 */

/* ── Stat card value ─────────────────────────────────── */

.stat-value {
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.3;
}

/* ── Shortcode copy button ───────────────────────────── */

.shortcode-copy-btn code {
	font-size: .8125rem;
}

/* ── Reimport progress area ──────────────────────────── */

#cecomsmarad-reimport-progress {
	font-size: .8125rem;
	padding: .5rem .75rem;
	border-radius: .375rem;
	background: var(--bs-primary-bg-subtle);
	color: var(--bs-primary-text-emphasis);
}

/* ── Locked data stat card ───────────────────────────── */

.data-stat-locked {
	opacity: .85;
}

/* ── Form switch — reset WP admin checkbox overrides ────── */

#cecomsmaradWrap .form-switch .form-check-input::before {
	display: none !important;
	content: none !important;
}

#cecomsmaradWrap .form-switch .form-check-input {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	background-image: var(--bs-form-switch-bg) !important;
	background-color: var(--bs-secondary-bg) !important;
	background-repeat: no-repeat !important;
	background-position: left center !important;
	background-size: 1em auto !important;
	border: var(--bs-border-width) solid var(--bs-border-color) !important;
	transition: background-position .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

#cecomsmaradWrap .form-switch .form-check-input:checked {
	background-color: var(--bs-primary) !important;
	border-color: var(--bs-primary) !important;
	background-position: right center !important;
}

#cecomsmaradWrap .form-switch .form-check-input:focus {
	box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .25) !important;
	border-color: rgba(var(--bs-primary-rgb), .5) !important;
	background-image: var(--bs-form-switch-bg) !important;
}

/* ── Offcanvas sidebar — open inside #wpcontent (not body) ────────
 *
 * Scope the sidebar's offcanvas presentation to WordPress's admin
 * content area so it doesn't cover the WP admin menu. The panel is
 * positioned absolutely inside #wpcontent with a -20px left offset
 * so it sits flush against the WP menu gutter. Bootstrap's backdrop
 * is re-parented into #wpcontent by cecomsmarad-admin.js
 * (`show.bs.offcanvas` handler) so the dim overlay is confined to
 * the settings area — click-outside-to-close stays functional.
 */

#wpcontent {
	position: relative;
	overflow-x: clip;
}

@media (max-width: 959.98px) {
	#cecomsmaradWrap #sidebarTabs.offcanvas-lg {
		position: absolute !important;
		top: 0 !important;
		/*left: -20px !important;*/
		right: auto !important;
		bottom: 0 !important;
		height: auto !important;
		min-height: 100%;
		max-height: none !important;
		z-index: 1045;
	}

	/* Constrain Bootstrap's backdrop to #wpcontent once JS reparents it. */
	#wpcontent > .offcanvas-backdrop {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
	}
}

/* ── WP admin sidebar parity — collapse to hamburger at 960px ──
 *
 * WordPress auto-folds its admin sidebar at 960px, while Bootstrap's
 * `offcanvas-lg` / `col-lg-3` / `d-lg-none` classes transition at 992px.
 * The rules below force desktop (in-place) sidebar behavior in the
 * 960–991.98px range so the plugin collapses in lock-step with WP core.
 */

@media (min-width: 960px) and (max-width: 991.98px) {
	/* Drop offcanvas positioning (override Bootstrap <992px offcanvas-lg rules). */
	#cecomsmaradWrap #sidebarTabs.offcanvas-lg {
		position: static;
		visibility: visible;
		background-color: transparent !important;
		transition: none;
	}
	#cecomsmaradWrap #sidebarTabs.offcanvas-lg.offcanvas-start {
		top: auto;
		left: auto;
		width: auto;
		border-right: 0;
		transform: none;
	}
	/* Apply col-lg-3 width manually (Bootstrap only applies it at ≥992px). */
	#cecomsmaradWrap #sidebarTabs.col-lg-3 {
		flex: 0 0 auto;
		width: 25%;
	}
	/* Hide the in-sidebar offcanvas header (mobile close bar). */
	#cecomsmaradWrap #sidebarTabs .offcanvas-header {
		display: none;
	}
	/* Reset offcanvas-body layout to desktop state. */
	#cecomsmaradWrap #sidebarTabs .offcanvas-body {
		display: flex;
		flex-grow: 0;
		padding: 0;
		overflow-y: visible;
		background-color: transparent !important;
	}
	/* Hide the hamburger toggle button in the page header. */
	#cecomsmaradWrap header .btn.d-lg-none[data-bs-target="#sidebarTabs"] {
		display: none !important;
	}
}
