:root {
    /* Primary color and variations */
    --bs-primary: #3b82f6;
    --bs-primary-rgb: 59, 130, 246;
    --bs-primary-100: #d8e6fd;
    --bs-primary-200: #b1cdfb;
    --bs-primary-300: #89b4fa;
    --bs-primary-400: #629bf8;
    --bs-primary-500: #3b82f6;
    --bs-primary-600: #2f68c5;
    --bs-primary-700: #234e94;
    --bs-primary-800: #183462;
    --bs-primary-900: #0c1a31;
    
    /* Primary text and background variations */
    --bs-primary-text-emphasis: #234e94;
    --bs-primary-bg-subtle: #d8e6fd;
    --bs-primary-border-subtle: #b1cdfb;
    
    /* Link colors */
    --bs-link-color: #3b82f6;
    --bs-link-hover-color: #234e94;
    --bs-link-color-rgb: 59, 130, 246;
    --bs-link-hover-color-rgb: 59, 130, 246;
    
    /* Button colors */
    --bs-btn-primary-color: #fff;
    --bs-btn-primary-bg: #3b82f6;
    --bs-btn-primary-border-color: #3b82f6;
    --bs-btn-primary-hover-color: #fff;
    --bs-btn-primary-hover-bg: #2f68c5;
    --bs-btn-primary-hover-border-color: #2f68c5;
    --bs-btn-primary-focus-shadow-rgb: 59, 130, 246;
    --bs-btn-primary-active-color: #fff;
    --bs-btn-primary-active-bg: #234e94;
    --bs-btn-primary-active-border-color: #234e94;
    --bs-btn-primary-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    --bs-btn-primary-disabled-color: #fff;
    --bs-btn-primary-disabled-bg: #3b82f6;
    --bs-btn-primary-disabled-border-color: #3b82f6;
    
    /* Form controls */
    --bs-form-check-input-checked-color: #3b82f6;
    --bs-form-check-input-checked-bg-color: #3b82f6;
    --bs-form-check-input-checked-border-color: #3b82f6;
    --bs-form-check-input-focus-border: #3b82f6;
    --bs-form-check-input-focus-box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
    
    /* Form range */
    --bs-form-range-thumb-bg: #3b82f6;
    --bs-form-range-thumb-active-bg: #b1cdfb;
    --bs-form-range-thumb-disabled-bg: #3b82f6;
    
    /* Form switch */
    --bs-form-switch-checked-color: #3b82f6;
    --bs-form-switch-checked-bg-color: #3b82f6;
    --bs-form-switch-checked-border-color: #3b82f6;
    --bs-form-switch-focus-color: #b1cdfb;
    --bs-form-switch-focus-bg-color: #b1cdfb;
    
    /* Navigation */
    --bs-nav-pills-link-active-color: #fff;
    --bs-nav-pills-link-active-bg: #3b82f6;
    
    /* Nav tabs */
    --bs-nav-tabs-link-active-color: #3b82f6;
    --bs-nav-tabs-link-active-bg: #fff;
    --bs-nav-tabs-link-active-border-color: #3b82f6;
    
    /* Pagination */
    --bs-pagination-active-color: #fff;
    --bs-pagination-active-bg: #3b82f6;
    --bs-pagination-active-border-color: #3b82f6;
    --bs-pagination-focus-color: #234e94;
    --bs-pagination-focus-bg: #d8e6fd;
    --bs-pagination-focus-border-color: #89b4fa;
    --bs-pagination-hover-color: #234e94;
    --bs-pagination-hover-bg: #d8e6fd;
    --bs-pagination-hover-border-color: #89b4fa;
    
    /* Progress bar */
    --bs-progress-bar-color: #fff;
    --bs-progress-bar-bg: #3b82f6;
    
    /* Alerts */
    --bs-alert-primary-color: #234e94;
    --bs-alert-primary-bg: #d8e6fd;
    --bs-alert-primary-border-color: #b1cdfb;
    
    /* Badge */
    --bs-badge-primary-color: #fff;
    --bs-badge-primary-bg: #3b82f6;
    
    /* List group */
    --bs-list-group-active-color: #fff;
    --bs-list-group-active-bg: #3b82f6;
    --bs-list-group-active-border-color: #3b82f6;
    
    /* Dropdown */
    --bs-dropdown-link-active-color: #fff;
    --bs-dropdown-link-active-bg: #3b82f6;
    
    /* Accordion */
    --bs-accordion-active-color: #234e94;
    --bs-accordion-active-bg: #d8e6fd;
    --bs-accordion-btn-focus-border-color: #2f68c5;
    --bs-accordion-btn-focus-box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
    
    /* Carousel */
    --bs-carousel-indicator-active-bg: #3b82f6;
    
    /* Offcanvas */
    --bs-offcanvas-color: inherit;
    --bs-offcanvas-bg: #fff;
    
    /* Toast */
    --bs-toast-header-color: #234e94;
    --bs-toast-header-bg: #d8e6fd;
    --bs-toast-header-border-color: #b1cdfb;
    
    /* Tooltip */
    --bs-tooltip-color: #fff;
    --bs-tooltip-bg: #3b82f6;
    
    /* Popover */
    --bs-popover-header-bg: #d8e6fd;
    --bs-popover-header-color: #234e94;
    
    /* Table */
    --bs-table-primary-color: #234e94;
    --bs-table-primary-bg: #d8e6fd;
    --bs-table-primary-border-color: #b1cdfb;
    
    /* Text colors */
    --bs-primary-text-emphasis: #234e94;
    --bs-text-primary: #3b82f6;
    
    /* Background colors */
    --bs-bg-primary: #3b82f6;
    --bs-bg-primary-subtle: #d8e6fd;
    
    /* Border colors */
    --bs-border-primary: #3b82f6;
    --bs-border-primary-subtle: #b1cdfb;
}

/* Additional CSS rules to ensure proper styling */

/* Primary buttons */
.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #3b82f6;
    --bs-btn-border-color: #3b82f6;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #2f68c5;
    --bs-btn-hover-border-color: #2f68c5;
    --bs-btn-focus-shadow-rgb: 59, 130, 246;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #234e94;
    --bs-btn-active-border-color: #234e94;
    --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: #3b82f6;
    --bs-btn-disabled-border-color: #3b82f6;
}

/* Primary outline buttons */
.btn-outline-primary {
    --bs-btn-color: #3b82f6;
    --bs-btn-border-color: #3b82f6;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #3b82f6;
    --bs-btn-hover-border-color: #3b82f6;
    --bs-btn-focus-shadow-rgb: 59, 130, 246;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #3b82f6;
    --bs-btn-active-border-color: #3b82f6;
    --bs-btn-disabled-color: #3b82f6;
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: #3b82f6;
}

/* Force primary button colors */
.btn-primary,
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.btn-primary.show {
    background-color: var(--bs-btn-bg) !important;
    border-color: var(--bs-btn-border-color) !important;
}

.btn-primary:hover {
    background-color: #2f68c5 !important;
    border-color: #3b82f6 !important;
}

.btn-primary:focus,
.btn-primary.focus {
    background-color: #2f68c5 !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.5) !important;
}

.btn-primary:active,
.btn-primary.active,
.btn-primary.show {
    background-color: #234e94 !important;
    border-color: #3b82f6 !important;
}

.btn-primary:disabled,
.btn-primary.disabled {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
    opacity: 0.65;
}

/* Force outline primary button colors */
.btn-outline-primary {
    color: #3b82f6;
    border-color: #3b82f6;
}

.btn-outline-primary:hover {
    color: #fff;
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.btn-outline-primary:focus,
.btn-outline-primary.focus {
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.5);
}

.btn-outline-primary:active,
.btn-outline-primary.active,
.btn-outline-primary.show {
    color: #fff;
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.btn-outline-primary:disabled,
.btn-outline-primary.disabled {
    color: #3b82f6;
    background-color: transparent;
}

/* List group active items */
.list-group-item.active {
    color: #fff;
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.list-group-item-primary {
    color: #234e94;
    background-color: #d8e6fd;
    border-color: #b1cdfb;
}

.list-group-item-primary.list-group-item-action:hover,
.list-group-item-primary.list-group-item-action:focus {
    color: #234e94;
    background-color: #b1cdfb;
}

.list-group-item-primary.list-group-item-action.active {
    color: #fff;
    background-color: #234e94;
    border-color: #234e94;
}

/* Dropdown active items */
.dropdown-item.active,
.dropdown-item:active {
    color: #fff;
    text-decoration: none;
    background-color: #3b82f6;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: #234e94;
    background-color: #d8e6fd;
}

/* Nav pills active */
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
    color: #fff;
    background-color: #3b82f6;
}

/* Nav tabs active */
/*
.nav-tabs .nav-link.active,
.nav-tabs .nav-item.show .nav-link {
    color: #3b82f6;
    background-color: var(--bs-nav-tabs-link-active-bg);
    border-color: var(--bs-nav-tabs-link-active-border-color);
}
*/

/* Pagination active */
.pagination .page-item.active .page-link {
    color: #fff;
    background-color: #3b82f6;
    border-color: #3b82f6;
}

.pagination .page-link:hover {
    color: #234e94;
}

.pagination .page-link:focus {
    color: #234e94;
    background-color: #d8e6fd;
    border-color: #89b4fa;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
}

/* Progress bar */
.progress-bar {
    background-color: #3b82f6;
}

/* Alerts */
.alert-primary {
    --bs-alert-color: #234e94;
    --bs-alert-bg: #d8e6fd;
    --bs-alert-border-color: #b1cdfb;
    --bs-alert-link-color: #234e94;
}

/* Badges */
.badge.bg-primary {
    background-color: #3b82f6 !important;
}

.badge.text-primary {
    color: #3b82f6 !important;
}

/* Form controls */
.form-check-input:checked {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
}

.form-check-input:focus {
    border-color: #2f68c5 !important;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
}

.form-check-input:checked:focus {
    border-color: #234e94 !important;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
}

/* Form range */
.form-range::-webkit-slider-thumb {
    background-color: #3b82f6 !important;
}

.form-range::-moz-range-thumb {
    background-color: #3b82f6 !important;
}

.form-range::-webkit-slider-thumb:active {
    background-color: #b1cdfb !important;
}

.form-range:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 1px #fff, 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
}

.form-range:focus::-moz-range-thumb {
    box-shadow: 0 0 0 1px #fff, 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
}

/* Form switch - more specific selectors */
.form-switch .form-check-input {
    /* background-color: #dee2e6; /* Generates a visual bug */
}

.form-switch .form-check-input:checked {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e") !important;
}

.form-switch .form-check-input:focus {
    background-color: #b1cdfb !important;
    border-color: #89b4fa !important;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
    --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%233b82f6'/%3e%3c/svg%3e") !important;
}

.form-switch .form-check-input:checked:focus {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
}

.form-switch .form-check-input:disabled {
    background-color: #e9ecef !important;
}

.form-switch .form-check-input:checked:disabled {
    background-color: rgba(59, 130, 246, 0.5) !important;
}

/* Accordion */
.accordion-button:not(.collapsed) {
    color: #234e94;
    background-color: #d8e6fd;
    border-color: #b1cdfb;
}

.accordion-button:focus {
    z-index: 3;
    border-color: #2f68c5;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
}

/* Carousel indicators */
.carousel-indicators [data-bs-target] {
    background-color: #3b82f6;
}

/* Text utilities */
.text-primary {
    --bs-text-opacity: 1;
    color: rgba(59, 130, 246, var(--bs-text-opacity)) !important;
}

.text-primary-emphasis {
    color: #234e94 !important;
}

/* Background utilities */
.bg-primary {
    --bs-bg-opacity: 1;
    background-color: rgba(59, 130, 246, var(--bs-bg-opacity)) !important;
}

.bg-primary-subtle {
    background-color: #d8e6fd !important;
}

/* Border utilities */
.border-primary {
    --bs-border-opacity: 1;
    border-color: rgba(59, 130, 246, var(--bs-border-opacity)) !important;
}

.border-primary-subtle {
    border-color: #b1cdfb !important;
}

/* Links */
a {
    color: #3b82f6;
}

a:hover {
    color: #234e94;
}

/* Link utilities */
.link-primary {
    color: #3b82f6 !important;
    text-decoration-color: #3b82f6 !important;
}

.link-primary:hover,
.link-primary:focus {
    color: #2f68c5 !important;
    text-decoration-color: #2f68c5 !important;
}

.link-primary:active {
    color: #183462 !important;
    text-decoration-color: #234e94 !important;
}

/* Link underline utilities */
.link-underline-primary {
    --bs-link-underline-color: #3b82f6;
    text-decoration-color: #3b82f6 !important;
}

.link-underline-primary:hover,
.link-underline-primary:focus {
    --bs-link-underline-color: #2f68c5;
    text-decoration-color: #2f68c5 !important;
}

/* Link offset and opacity utilities */
.link-primary.link-offset-1:hover,
.link-primary.link-offset-2:hover,
.link-primary.link-offset-3:hover {
    color: #2f68c5 !important;
}

.link-primary.link-opacity-10,
.link-primary.link-opacity-25,
.link-primary.link-opacity-50,
.link-primary.link-opacity-75 {
    color: #3b82f6 !important;
}

.link-primary.link-opacity-10:hover,
.link-primary.link-opacity-25:hover,
.link-primary.link-opacity-50:hover,
.link-primary.link-opacity-75:hover {
    color: #2f68c5 !important;
}

/* Table */
.table-primary {
    --bs-table-color: #234e94;
    --bs-table-bg: #d8e6fd;
    --bs-table-border-color: #b1cdfb;
    --bs-table-striped-bg: #d8e6fd;
    --bs-table-striped-color: #234e94;
    --bs-table-active-bg: #b1cdfb;
    --bs-table-active-color: #234e94;
    --bs-table-hover-bg: #b1cdfb;
    --bs-table-hover-color: #234e94;
}

/* Toast */
.toast-header {
    color: #234e94;
    background-color: #d8e6fd;
    border-bottom: 1px solid #b1cdfb;
}

/* Offcanvas */
.offcanvas-primary {
    --bs-offcanvas-bg: #d8e6fd;
    --bs-offcanvas-color: #234e94;
}

/* Modal */
.modal-primary .modal-header {
    color: #234e94;
    background-color: #d8e6fd;
    border-bottom: 1px solid #b1cdfb;
}

/* Spinner */
.spinner-border-primary {
    --bs-spinner-border-color: #3b82f6;
    --bs-spinner-border-right-color: transparent;
}

.spinner-grow-primary {
    --bs-spinner-color: #3b82f6;
}

/* Placeholder */
.placeholder-primary {
    background-color: #3b82f6;
}

.form-control:focus {
    background-color: var(--bs-body-bg);
    border-color: #2f68c5 !important;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
    color: var(--bs-body-color);
    outline: 0;
}
