/*
 * Global Style Overrides
 * This file is loaded last to override all theme-specific styles.
 * Use this for fixes and styles that need to apply across all themes.
 */

/*
 * Button Focus State Fix
 * Reset to normal colors after mouse click while preserving keyboard focus
 * Uses --kt-* variables for theme compatibility
 */

.btn:focus:not(:focus-visible) {
	box-shadow: none !important;
}

.btn.btn-primary:focus:not(:focus-visible) {
	background-color: var(--kt-primary) !important;
	border-color: var(--kt-primary) !important;
	color: var(--kt-primary-inverse) !important;
}

.btn.btn-secondary:focus:not(:focus-visible) {
	background-color: var(--kt-secondary) !important;
	border-color: var(--kt-secondary) !important;
	color: var(--kt-secondary-inverse) !important;
}

.btn.btn-success:focus:not(:focus-visible) {
	background-color: var(--kt-success) !important;
	border-color: var(--kt-success) !important;
	color: var(--kt-success-inverse) !important;
}

.btn.btn-danger:focus:not(:focus-visible) {
	background-color: var(--kt-danger) !important;
	border-color: var(--kt-danger) !important;
	color: var(--kt-danger-inverse) !important;
}

.btn.btn-warning:focus:not(:focus-visible) {
	background-color: var(--kt-warning) !important;
	border-color: var(--kt-warning) !important;
	color: var(--kt-warning-inverse) !important;
}

.btn.btn-info:focus:not(:focus-visible) {
	background-color: var(--kt-info) !important;
	border-color: var(--kt-info) !important;
	color: var(--kt-info-inverse) !important;
}

.btn.btn-light:focus:not(:focus-visible) {
	background-color: var(--kt-light) !important;
	border-color: var(--kt-light) !important;
	color: var(--kt-light-inverse) !important;
}

.btn.btn-dark:focus:not(:focus-visible) {
	background-color: var(--kt-dark) !important;
	border-color: var(--kt-dark) !important;
	color: var(--kt-dark-inverse) !important;
}

/*
 * Search Input Icon Overlap Fix
 * Fixes icon overlapping with placeholder text in search inputs
 */

/* Fix for Blazorise Addons pattern - icon addon needs right padding */
.input-group .input-group-text.pe-0 {
	padding-right: 0.75rem !important;
}

/* Fix for absolute positioned icon pattern (.eld-form-icon-span) */
.eld-form-icon-span + input,
.eld-form-icon-span + .form-control,
.eld-form-icon-span ~ input,
.eld-form-icon-span ~ .form-control {
	padding-left: 38px !important;
}

/*
 * Global Scrollbar Visibility Fix
 * Makes scrollbars visible across all themes and containers.
 * Uses explicit colors to avoid dependency on theme variables.
 */

* {
	scrollbar-width: thin !important;
	scrollbar-color: #B5B5C3 #F5F8FA !important;
}

*::-webkit-scrollbar {
	width: 8px !important;
	height: 8px !important;
}

*::-webkit-scrollbar-track {
	background: #F5F8FA !important;
	border-radius: 4px !important;
}

*::-webkit-scrollbar-thumb {
	background-color: #B5B5C3 !important;
	border-radius: 4px !important;
}

	*::-webkit-scrollbar-thumb:hover {
		background-color: #A1A5B7 !important;
	}

/*
 * Blazorise Dark Sidebar - Theme-Aware Color Overrides
 * The sidebar uses Blazorise's <Bar ThemeContrast="Dark"> which renders .b-bar-dark.
 * Sidebar background is set to var(--kt-navbar-bg) = var(--kt-primary) in eld-styles.css.
 * These overrides make text, icons, and selection states harmonize with any theme color.
 * Uses --kt-* CSS custom properties so all themes auto-adapt without per-theme CSS.
 *
 * --kt-sidebar-active-bg: Defined per-theme in each SCSS entry file (:root block).
 * Falls back to --kt-primary-active for themes that don't define it.
 */

/* Default state: full white text/icons on colored sidebar background */
.b-bar-dark .b-bar-link,
.b-bar-dark .b-bar-dropdown-toggle {
	color: #ffffff !important;
}

.b-bar-dark .b-bar-link i,
.b-bar-dark .b-bar-dropdown-toggle i {
	color: #ffffff !important;
}

/* Hover state: full white text/icons (background unchanged from theme default) */
.b-bar-dark .b-bar-link:hover,
.b-bar-dark .b-bar-dropdown-toggle:hover {
	color: #ffffff !important;
}

.b-bar-dark .b-bar-link:hover i,
.b-bar-dark .b-bar-dropdown-toggle:hover i {
	color: #ffffff !important;
}

/* Active state: full white text/icon with theme-specific sidebar active background */
.b-bar-dark .b-bar-item > .b-bar-link.active,
.b-bar-dark .b-bar-item.active > .b-bar-link,
.b-bar-dark .b-bar-item.active > .b-bar-dropdown > .b-bar-dropdown-toggle {
	color: #ffffff !important;
	background-color: var(--kt-sidebar-active-bg, var(--kt-primary-active)) !important;
}

.b-bar-dark .b-bar-item > .b-bar-link.active i,
.b-bar-dark .b-bar-item.active > .b-bar-link i,
.b-bar-dark .b-bar-item.active > .b-bar-dropdown > .b-bar-dropdown-toggle i {
	color: #ffffff !important;
}

/*
 * Prevent brand/logo area from getting active highlight.
 * BarBrand renders .b-bar-brand on its own wrapper element, while the
 * BarItem inside it only has .b-bar-item. The descendant selector
 * .b-bar-brand .b-bar-item gives higher specificity (0,5,0) than the
 * active rules above (0,4,0), so this override wins correctly.
 */
.b-bar-dark .b-bar-brand .b-bar-item > .b-bar-link,
.b-bar-dark .b-bar-brand .b-bar-item > .b-bar-link.active {
	background-color: transparent !important;
}

/* Dropdown submenu items */
.b-bar-dark .b-bar-dropdown-item {
	color: #ffffff !important;
}

.b-bar-dark .b-bar-dropdown-item i {
	color: #ffffff !important;
}

.b-bar-dark .b-bar-dropdown-item:hover {
	color: #ffffff !important;
}

.b-bar-dark .b-bar-dropdown-item:hover i {
	color: #ffffff !important;
}

.b-bar-dark .b-bar-dropdown-item.active {
	color: #ffffff !important;
	background-color: var(--kt-sidebar-active-bg, var(--kt-primary-active)) !important;
}

.b-bar-dark .b-bar-dropdown-item.active i {
	color: #ffffff !important;
}

/* Bar toggler (hamburger icon) */
.b-bar-dark .b-bar-toggler {
	color: rgba(255, 255, 255, 0.7) !important;
}

.b-bar-dark .b-bar-toggler:hover {
	color: rgba(255, 255, 255, 1) !important;
}

/*
 * Nav Line Tabs Left Padding Fix
 */
.nav-line-tabs {
	padding-left: 20px !important;
}

/*
 * Native Form Controls - Theme-Aware Color Overrides
 */

select,
select option,
::picker(select) {
	appearance: base-select !important;
	color: var(--kt-dropdown-color) !important;
	background: var(--kt-dropdown-bg) !important;
}

:root {
	accent-color: var(--kt-primary);
}

select, select.form-select {
	border: 1px solid var(--kt-input-border-color) !important;
}

select option {
	padding: 0.25rem 1rem;
}

::picker(select) {
	max-height: var(--autocomplete-menu-max-height, 200px);
	overflow-y: scroll;
	z-index: 1000;
	padding: 0.5rem 0;
	margin: 0;
	font-size: 1rem;
	font-weight: 400;
	color: var(--kt-dropdown-color);
	text-align: left;
	list-style: none;
	border: 0 solid rgba(0, 0, 0, 0.175);
	border-radius: 0.25rem;
	box-shadow: var(--kt-dropdown-box-shadow);
}

select::picker-icon {
	display: none;
}

option:hover {
	color: var(--kt-dropdown-link-hover-color) !important;
	background-color: var(--kt-dropdown-link-hover-bg) !important;
}

option:checked, option:focus {
	color: #1e2125 !important;
	background-color: #e9ecef !important;
}

option::checkmark {
	display: none;
}

::selection {
	background-color: var(--kt-primary);
	color: var(--kt-primary-inverse, #ffffff);
}
