html {
    font-size: 0.9rem;
}

body {
    /* background-color: #ffffff; Handled by .bg-white in layout */
}

.feather {
    width: 16px;
    height: 16px;
    vertical-align: text-bottom;
}

/*
 * Sidebar
 */

.sidebar {
    position: fixed;
    top: 0;
    /* rtl:raw:
    right: 0;
    */
    bottom: 0;
    /* rtl:remove */
    left: 0;
    z-index: 100; /* Behind the navbar */
    padding: 48px 0 0; /* Height of navbar */
    border-right: 1px solid var(--bs-border-color);
}

@media (max-width: 767.98px) {
    .sidebar {
        top: 5rem;
    }
}

.sidebar-sticky {
    position: relative;
    top: 0;
    height: calc(100vh - 48px);
    padding-top: .5rem;
    overflow-x: hidden;
    overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
    display: flex;
    flex-direction: column;
}

/* .sidebar-footer removed - unused */

.sidebar .nav-link {
    font-weight: 500;
    color: var(--bs-gray-800);
    padding: 0.5rem 8px;
    border-radius: 0.25rem;
    margin: 0.1rem 8px;
}

[data-bs-theme="dark"] .sidebar .nav-link {
    color: var(--bs-gray-200);
}

.sidebar .nav-link i {
    width: 24px;
    text-align: center;
    display: inline-block;
}

.sidebar .nav-link .feather {
    margin-right: 4px;
    color: var(--bs-secondary-color);
}

.sidebar .nav-link.active {
    color: var(--bs-primary);
    background-color: rgba(var(--bs-primary-rgb), 0.1);
}

.sidebar .nav-link:hover {
    color: var(--bs-primary);
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

/* Submenu Indentation */
.sidebar .btn-toggle-nav .nav-link {
    padding-left: 2.8rem; /* Align with text of parent (increased to match icon width + gap) */
}

.sidebar-heading {
    font-size: .75rem;
    text-transform: uppercase;
}

/*
 * Navbar
 */

/* .navbar-brand-container moved to utility classes */

.navbar-brand {
    font-size: 1rem;
}

.brand-text {
    color: var(--bs-gray-700);
}

[data-bs-theme="dark"] .brand-text {
    color: var(--bs-gray-300);
}

/* Sidebar Width Overrides - Adjusted width */
@media (min-width: 992px) {
    #sidebarMenu.col-lg-2,
    .navbar-brand-container.col-lg-2 {
        flex: 0 0 13.375%;
        max-width: 13.375%;
    }
    
    main.col-lg-10 {
        flex: 0 0 86.625%;
        max-width: 86.625%;
    }
}

.navbar .navbar-toggler {
    top: .25rem;
    right: 1rem;
}

.navbar-utilex {
    border-bottom: 1px solid var(--bs-border-color);
}

/* Modern Card Style */
.card {
    border: none;
    box-shadow: none;
    border-radius: 0;
    margin-bottom: 1.5rem;
    background-color: transparent;
}

.card-header {
    background-color: transparent;
    border-bottom: none;
    font-weight: 600;
}

/* Page Title - Simplified */
.pageTitle {
    /* margin-bottom: 1.5rem; */
    padding-bottom: 0;
    border-bottom: none; /* Removed separator */
    color: var(--bs-secondary-color);
}

.pageTitle h4 {
    font-weight: 600; /* Bolder title */
    margin-bottom: 0;
}

/* Table Improvements */
.table thead th {
    border-top: none;
    border-bottom: 2px solid var(--bs-border-color);
    font-weight: 600;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
}

/* Button Tweaks */
/* .btn {
    border-radius: 0.25rem;
    font-weight: 500;
} */

.btn-outline-adaptive,
button.dt-button.btn-outline-adaptive {
    color: var(--bs-body-color) !important;
    border: 1px solid var(--bs-border-color) !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

.btn-outline-adaptive:hover,
.btn-outline-adaptive:focus,
.btn-outline-adaptive:active,
.btn-outline-adaptive.active,
button.dt-button.btn-outline-adaptive:hover,
button.dt-button.btn-outline-adaptive:active,
button.dt-button.btn-outline-adaptive.active {
    color: var(--bs-body-color) !important;
    background: var(--bs-secondary-bg) !important;
    background-color: var(--bs-secondary-bg) !important;
    border-color: var(--bs-border-color) !important;
}

/* Sidebar Collapse Styles */
body.sidebar-collapsed .sidebar .sidebar-text {
    display: none;
}

body.sidebar-collapsed .sidebar .nav-link {
    /* text-align: center; Removed to fix 0.5px shift */
    padding-left: 8px; /* Match expanded padding */
    padding-right: 0;
}

body.sidebar-collapsed .sidebar .nav-link i {
    margin-right: 0 !important;
}

/* Hide submenus when collapsed */
body.sidebar-collapsed .sidebar .collapse {
    display: none !important;
}

@media (min-width: 768px) {
    body.sidebar-collapsed #sidebarMenu {
        flex: 0 0 56px !important;
        max-width: 56px !important;
        width: 56px !important;
        padding-left: 0;
        padding-right: 0;
    }

    body.sidebar-collapsed main {
        flex: 0 0 calc(100% - 56px) !important;
        max-width: calc(100% - 56px) !important;
        width: calc(100% - 56px) !important;
    }
}

/* Tempus Dominus Dark Mode Support */
[data-bs-theme="dark"] {
    --td-background: var(--bs-body-bg);
    --td-color: var(--bs-body-color);
    --td-surface: var(--bs-tertiary-bg);
}

[data-bs-theme="dark"] .tempus-dominus-widget {
    background-color: var(--bs-body-bg) !important;
    color: var(--bs-body-color) !important;
    border: 1px solid var(--bs-border-color) !important;
}

[data-bs-theme="dark"] .tempus-dominus-widget .date-container-days .day.old, 
[data-bs-theme="dark"] .tempus-dominus-widget .date-container-days .day.new {
    color: var(--bs-secondary-color) !important;
}

[data-bs-theme="dark"] .tempus-dominus-widget .date-container-days .dow {
    color: var(--bs-secondary-color) !important;
}

[data-bs-theme="dark"] .tempus-dominus-widget .date-container-days .day:hover,
[data-bs-theme="dark"] .tempus-dominus-widget .date-container-months .month:hover,
[data-bs-theme="dark"] .tempus-dominus-widget .date-container-years .year:hover,
[data-bs-theme="dark"] .tempus-dominus-widget .date-container-decades .decade:hover,
[data-bs-theme="dark"] .tempus-dominus-widget .time-container-clock .time-container-hour:hover,
[data-bs-theme="dark"] .tempus-dominus-widget .time-container-clock .time-container-minute:hover,
[data-bs-theme="dark"] .tempus-dominus-widget .time-container-clock .time-container-second:hover {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .tempus-dominus-widget .picker-switch:hover {
    background-color: var(--bs-secondary-bg) !important;
}

/* Tom Select Dark Mode Support */
[data-bs-theme="dark"] .ts-control,
[data-bs-theme="dark"] .ts-control input {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .ts-dropdown {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .ts-dropdown .option {
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .ts-dropdown .option.active,
[data-bs-theme="dark"] .ts-dropdown .option:hover {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
}

[data-bs-theme="dark"] .ts-dropdown .option.selected {
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
}

[data-bs-theme="dark"] .ts-control .item {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
    border: 1px solid var(--bs-border-color) !important;
    border-radius: 3px;
    padding: 0 4px;
}

[data-bs-theme="dark"] .ts-wrapper.multi .ts-control > div {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-body-color) !important;
    border: 1px solid var(--bs-border-color) !important;
}

[data-bs-theme="dark"] .ts-wrapper.plugin-remove_button .item .remove {
    border-left: 1px solid var(--bs-border-color) !important;
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .ts-wrapper.plugin-remove_button .item .remove:hover {
    background-color: var(--bs-tertiary-bg) !important;
}

/* Dark Mode Table Header Overrides */
[data-bs-theme="dark"] .table thead th.table-primary {
    background-color: rgba(var(--bs-primary-rgb), 0.15) !important;
    color: var(--bs-primary-text-emphasis) !important;
}

[data-bs-theme="dark"] .table thead th.table-secondary {
    background-color: rgba(var(--bs-secondary-rgb), 0.15) !important;
    color: var(--bs-secondary-text-emphasis) !important;
}

[data-bs-theme="dark"] .table thead th.table-success {
    background-color: rgba(var(--bs-success-rgb), 0.15) !important;
    color: var(--bs-success-text-emphasis) !important;
}

[data-bs-theme="dark"] .table thead th.table-info {
    background-color: rgba(var(--bs-info-rgb), 0.15) !important;
    color: var(--bs-info-text-emphasis) !important;
}

[data-bs-theme="dark"] .table thead th.table-warning {
    background-color: rgba(var(--bs-warning-rgb), 0.15) !important;
    color: var(--bs-warning-text-emphasis) !important;
}

[data-bs-theme="dark"] .table thead th.table-danger {
    background-color: rgba(var(--bs-danger-rgb), 0.15) !important;
    color: var(--bs-danger-text-emphasis) !important;
}
