html, body {
    font-family: var(--font-primary);
    font-size: var(--font-size-normal);
    height: 100%;
    overflow: hidden;
}

#wrapper {
    height: 100vh;
    display: flex;
}

#main-title {
    color: var(--sidebar-body-bg) !important;
    font-size: 2rem;
    font-weight: 700;
}

#data-validator-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: 73px;
    border-color: var(--header-border-color);
    background-color: #f9f9f9;
}

#dropdown-user-menu {
    color: var(--sidebar-body-bg) !important;
}

#container-breadcrumb {
    position: sticky;
    top: 73px;
    z-index: 1010;
    border-color: var(--header-border-color);
    background-color: #f9f9f9;
}

.breadcrumb-item a {
    color: #0d6efd;
    font-weight: 400;
    text-decoration: none;
}

.breadcrumb-item a:hover {
    font-weight: 500;
}

.breadcrumb-item.active {
    color: #6c757d;
    pointer-events: none;
    cursor: default;
}

.sidebar {
    width: 260px;
    min-width: 260px;
    transition: all 0.3s ease;
    background-color: var(--sidebar-body-bg);
    height: 100vh;
    /*overflow: hidden;*/
    position: relative;
}

#sidebar-content {
    overflow-y: auto;
    max-height: calc(100vh - 73px - 59px);
    scrollbar-width: thin; /* Firefox: makes the scrollbar thinner */
    scrollbar-color: transparent transparent; /* Firefox: hides the scrollbar by setting both thumb and track to transparent */
    transition: scrollbar-color 0.8s ease-in-out 0.1s; /* Firefox: smooth transition for hiding the scrollbar after scroll ends */
}

#sidebar-content.scrolling {
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent; /* Firefox: when scrolling, show a semi-transparent scrollbar thumb */
    transition: scrollbar-color 0.2s ease-in-out; /* Firefox: make the scrollbar appear faster */
}

/* Chrome/Safari/Edge: define a thin scrollbar with no visible track */
#sidebar-content::-webkit-scrollbar {
    width: 6px;
    background: transparent;
}

#sidebar-content::-webkit-scrollbar-thumb {
    background-color: transparent; /* Chrome/Safari/Edge: hide the scrollbar thumb by default */
    border-radius: 3px;
    transition: background-color 0.6s ease-in-out 0.1s; /* Smoothly fade out the thumb when not scrolling */
}

#sidebar-content.scrolling::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3); /* Chrome/Safari/Edge: show a visible scrollbar thumb when scrolling */
    transition: background-color 0.2s ease-in-out; /* Make the scrollbar thumb appear quickly when scrolling starts */
}

/* Applies a default transition to all chevron-down icons inside the sidebar toggle buttons
   - This makes the rotation animation when the collapse state changes
   - Only targets elements within the #sidebar navigation area */
#sidebar [data-bs-toggle="collapse"] .svg-inline--fa.fa-chevron-down { /* Can be svg */
    transition: transform 0.3s ease;
}

/* Rotates the chevron-down icon 180 degrees when its parent toggle button is expanded
   - Happens when Bootstrap updates `aria-expanded="true"` on the toggle element
   - The chevron appears to point upwards, indicating the section is open */
#sidebar [data-bs-toggle="collapse"][aria-expanded="true"] .svg-inline--fa.fa-chevron-down { /* Can be svg */
    transform: rotate(-180deg);
}

#sidebar .svg-inline--fa.fa-chevron-down {
    color: var(--sidebar-tertiary-color);
    font-size: 0.7rem;
}

/* ---------- NAVIGATION LEVEL STYLE ---------- */

/* Level 1: Business Areas / Documentation Sections */
.level-1 > .nav-item > .nav-link {
    font-size: var(--sidebar-font-size-level-1);
    font-weight: var(--sidebar-font-weight-level-1);
    border-radius: 6px;
}

.level-1 > .nav-item > .nav-link:hover {
    background-color: var(--sidebar-hover-bg);
}

.level-1 > .nav-item > .nav-link.active {
    background-color: var(--sidebar-active-bg);
    border-left: 3px solid var(--sidebar-active-border);
    transition: none;
}

.level-1 > .nav-item > .nav-link a {
    color: var(--sidebar-text-color-level-1); /* Text color in sidebar for each business area */
}

.level-1 > .nav-item > .nav-link a:hover {
    color: var(--sidebar-hover-text);
}

/* Level 2: Templates / Function Categories */
.level-2 {
    border-left: 2px solid rgba(255, 255, 255, 0.07);
    padding-left: 8px;
    margin-top: 4px;
}

.level-2 > .nav-item > .nav-link,
.sidebar-span-no-templates {
    font-size: var(--sidebar-font-size-level-2);
    font-weight: var(--sidebar-font-weight-level-2);
    border-radius: 4px;
}

.level-2 > .nav-item > .nav-link:hover {
    background-color: var(--sidebar-hover-bg);
}

.level-2 > .nav-item > .nav-link.active {
    background-color: var(--sidebar-active-bg);
    border-left: 3px solid var(--sidebar-active-border) !important;
    transition: none;
}

.level-2 > .nav-item > .nav-link a,
.sidebar-span-no-templates {
    color: var(--sidebar-text-color-level-2); /* Text color in sidebar for each templates */
}

.level-2 > .nav-item > .nav-link a:hover {
    color: var(--sidebar-hover-text);
}

/* Level 3: Rules */
.level-3 {
    border-left: 2px dotted rgba(255, 255, 255, 0.10);
    padding-left: 8px;
}

.level-3 > .nav-item > .nav-link,
.sidebar-span-no-rules {
    font-size: var(--sidebar-font-size-level-3);
    font-weight: var(--sidebar-font-weight-level-3);
    color: var(--sidebar-text-color-level-3); /* Text color in sidebar for each rules */
    border-radius: 4px;
}

.level-3 > .nav-item > .nav-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--sidebar-hover-text);
}

.custom-border-color-sidebar {
    border-color: var(--sidebar-border-color) !important;
}

body.sidebar-collapsed .sidebar {
    margin-left: -260px;
}

body.sidebar-collapsed .flex-grow-1 {
    margin-left: 0;
}

.toggle-sidebar-btn {
    position: absolute;
    right: -15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1050;

    width: 30px;
    height: 30px;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.toggle-sidebar-btn:hover {
    background-color: #f8f9fa;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.toggle-icon {
    color: #343a40;
    font-size: 0.95rem;
    transition: color 0.2s ease, transform 0.3s ease;
}

body.sidebar-collapsed .toggle-sidebar-btn {
    right: -18px;
    background-color: var(--sidebar-body-bg);
}

body.sidebar-collapsed .toggle-icon {
    color: white;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 450;
    margin-bottom: 0.25rem;
    color: #212529;
}

.page-subtitle {
    font-size: 1.05rem;
    color: #6c757d;
    margin-bottom: 0;
}

#main-content {
    overflow-y: auto;
    flex-grow: 1;
    background-color: var(--color-tertiar-bg);
}

.nav-link.active {
    font-weight: bold;
}

.nav-link:hover {
    color: var(--sidebar-emphasis-color);
}

.sidebar h6 {
    color: var(--sidebar-tertiary-color);
    margin-bottom: 0.5rem;
}

.sidebar-icon {
    color: var(--sidebar-tertiary-color);
}

.sidebar .nav-link i {
    width: 20px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 35px;
    padding: 0;
    border-radius: 5px;
    font-size: 1rem;
    line-height: 1;
}

.btn, .btn-outline-primary, .btn-outline-danger, .btn-outline-success {
    font-family: var(--font-secondary);
    font-size: var(--font-size-normal);
}

.mh-150px {
    max-height: 150px;
}

.minH-150px {
    min-height: 150px;
}

.minH-300px {
    min-height: 300px;
}

.minH-400px {
    min-height: 400px;
}

.mw-350px {
    max-width: 350px;
}

.mw-375px {
    max-width: 375px;
}

.mw-400px {
    max-width: 400px;
}

.minW-75px {
    min-width: 75px;
}

.minW-100px {
    min-width: 100px;
}

.minW-125px {
    min-width: 125px;
}

.minW-135px {
    min-width: 135px;
}

.minW-150px {
    min-width: 150px;
}

.minW-200px {
    min-width: 200px;
}

.minW-300px {
    min-width: 300px;
}

.minW-400px {
    min-width: 400px;
}

.w-150px {
    width: 150px;
}

.w-125px {
    width: 125px;
}

.btn-xs {
    background-color: transparent;
    border: 1px solid var(--sidebar-body-bg);
    color: var(--sidebar-body-bg);
    font-size: 0.9rem;
    padding: 0.3rem 0.5rem;
    line-height: 1;
    border-radius: 0.2rem;
}

.btn-xs:hover,
.btn-xs:active {
    background-color: var(--color-header-hover) !important;
    border-color: var(--sidebar-body-bg);
    color: var(--color-text-header) !important;
    box-shadow: var(--box-shadow-light) !important;
}

.accordion-button {
    background-color: #f8f9fa;
    color: #495057;
    box-shadow: none !important;
    font-family: var(--font-secondary);
    font-weight: 500;
    font-size: 14px;
}

.accordion-button:not(.collapsed) {
    color: #343a40;
    background-color: #dee2e6;
}

.accordion-button:hover {
    background-color: #e9ecef;
    color: #000;
}

.accordion-button::after {
    color: #495057;
}

.accordion-button .business-line-name {
    font-family: var(--font-primary);
    font-size: var(--font-size-large);
}

.accordion-header small.text-muted {
    font-family: var(--font-secondary);
    font-size: var(--font-size-small);
    color: #6c757d;
}

.accordion-item {
    background-color: var(--color-accordion-bg);
    border: var(--border-width-normal) solid var(--color-border);
    border-radius: 5px;
    margin-bottom: 25px;
    box-shadow: var(--box-shadow-light);
}

.accordion-body {
    background-color: #f5f6f7 !important;
}

.accordion-body .accordion-body {
    background-color: #f8f9fa !important;
}

.accordion-body .accordion-body .accordion-body {
    background-color: white !important;
}

.dropdown-item:focus,
.dropdown-item:active {
    color: #0f0f0f;
    background-color: transparent;
    outline: none;
    box-shadow: none;
}

.no-templates-p {
    font-size: 0.9rem;
}

/* Default switch (unchecked state, default background) */
.dropdown-item .form-check-input {
    background-color: #e0e0e0 !important; /* Light gray for the unchecked state */
    border-color: #ccc !important; /* Light gray for the border */
    box-shadow: none !important; /* Removes any shadow effect */
}

/* Unchecked switch on hover */
.dropdown-item .form-check-input:hover {
    background-color: #d6d6d6 !important; /* Slightly darker gray on hover */
    border-color: #b3b3b3 !important; /* Darker border on hover */
}

/* Unchecked switch when active (on click) */
.dropdown-item .form-check-input:active {
    background-color: #222 !important; /* Dark gray during click */
    border-color: #222 !important; /* Dark gray border during click */
}

/* Checked switch (already styled elsewhere in the CSS) */
.dropdown-item .form-check-input:checked {
    background-color: #000 !important; /* Black background */
    border-color: #000 !important; /* Black border */
    box-shadow: none !important; /* Removes shadow effect */
}

/* Round button inside the checked switch */
.dropdown-item .form-check-input:checked::before {
    background-color: #fff; /* White circle for contrast */
}

/* Enforce gray styling when the switch is unchecked */
.dropdown-item .form-check-input:not(:checked)::before {
    background-color: #e0e0e0 !important; /* Gray for the round button when unchecked */
    border-color: #ccc !important; /* Light gray border */
}

/* Remove blue color on focus */
.dropdown-item .form-check-input:focus {
    box-shadow: none !important; /* Ensures no blue outline on focus */
    --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='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e") !important;
}

/* Disable active state */
.dropdown-item .form-check-input:active {
    background-color: #e0e0e0 !important; /* Gray background */
    border-color: #ccc !important; /* Light gray border */
}

/* Adjust unchecked hover state */
.dropdown-item .form-check-input:not(:checked):hover::before {
    background-color: #d6d6d6 !important; /* Slightly darker gray for hover */
}

/* Remove blue color on the round button when active or focused */
.dropdown-item .form-check-input:active::before,
.dropdown-item .form-check-input:focus::before {
    background-color: #e0e0e0 !important; /* Matches the unchecked color */
    border-color: #ccc !important; /* Matches the unchecked border color */
    box-shadow: none !important; /* Removes shadow effects */
}

/* Ensure the round button stays white when the switch is checked and active/focused */
.dropdown-item .form-check-input:checked:active::before,
.dropdown-item .form-check-input:checked:focus::before {
    background-color: #fff !important; /* White background */
    border-color: #000 !important; /* Black border for contrast */
    box-shadow: none !important; /* Removes shadow effects */
}

/* Badge styling */
.badge {
    white-space: normal !important; /* Allows text to wrap to the next line */
    word-break: break-word; /* Breaks long words to prevent overflow */
}

.btn-link i {
    color: #495057;
    font-size: 0.85rem;
    transition: transform 0.2s;
}

.btn-link[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.spinner-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2F9FF4;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

.percentage {
    position: absolute;
    font-size: 10px;
    font-weight: bold;
    color: #2F9FF4;
}
