/* Global card font size reduction */
.card {
    font-size: 0.8rem;
}

.card-header {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

.card-title {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.card-body {
    font-size: 0.8rem;
    padding: 0.75rem;
}

.card-footer {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
}

/* Adjust heading sizes inside cards */
.card h1, .card .h1 { font-size: 1.3rem; }
.card h2, .card .h2 { font-size: 1.1rem; }
.card h3, .card .h3 { font-size: 1rem; }
.card h4, .card .h4 { font-size: 0.9rem; }
.card h5, .card .h5 { font-size: 0.85rem; }
.card h6, .card .h6 { font-size: 0.8rem; }

/* Ultra-compact DataTables */
#settingsTable {
    font-size: 0.8rem !important;
}

#settingsTable th,
#settingsTable td {
    padding: 0.2rem 0.3rem !important;
    line-height: 1.2 !important;
}

#settingsTable thead th {
    font-size: 0.65rem !important;
    padding: 0.3rem !important;
}

.dataTables_wrapper {
    font-size: 0.8rem !important;
}

.dataTables_length select,
.dataTables_filter input {
    font-size: 0.8rem !important;
    padding: 0.15rem 0.3rem !important;
    height: 1.8rem !important;
}

.dataTables_paginate .paginate_button {
    font-size: 0.65rem !important;
    padding: 0.15rem 0.4rem !important;
    margin: 0 0.05rem !important;
}

.dataTables_info {
    font-size: 0.65rem !important;
    padding-top: 0.3rem !important;
}

#settingsTable .badge {
    font-size: 0.6rem !important;
    padding: 0.15rem 0.3rem !important;
}

#settingsTable .btn {
    font-size: 0.65rem !important;
    padding: 0.15rem 0.3rem !important;
}

.btn-sm {
    font-size: 0.65rem !important;
    padding: 0.15rem 0.3rem !important;
}

.navbar .dropdown-toggle {
    display: flex !important;
    align-items: center !important;
    height: 56px !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.navbar .dropdown-menu {
    margin-top: 0 !important;
}

/* ===== SIDEBAR COLLAPSE STYLES ===== */
/* ===== SIDEBAR COLLAPSE STYLES ===== */
.sidebar {
    transition: all 0.3s ease;
    height: 100vh;
    overflow-y: auto;
    position: sticky;
    top: 0;


}

.sidebar.collapsed {
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
    flex: 0 0 60px !important;
}

/* Hide sidebar text when collapsed */
.sidebar.collapsed .sidebar-text {
    display: none !important;
}

/* Show/hide main and mini sidebars */
.sidebar.collapsed #mainSidebar {
    display: none !important;
}

.sidebar.collapsed #miniSidebar {
    display: block !important;
}

.sidebar:not(.collapsed) #mainSidebar {
    display: block !important;
}

.sidebar:not(.collapsed) #miniSidebar {
    display: none !important;
}

/* Mini sidebar styles */
#miniSidebar .nav-link {
    text-align: center;
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
    border-radius: 0.25rem;
    margin: 0.1rem 0.3rem;
    display: block;
}

#miniSidebar .nav-link i {
    margin-right: 0;
}

#miniSidebar .nav-link.active {
    background-color: #0d6efd;
    color: white !important;
}

/* Main sidebar styles */
#mainSidebar .nav-link {
    padding: 0.5rem 1rem;
    color: #333;
    border-radius: 0.25rem;
    margin: 0.1rem 0.5rem;
    display: flex;
    align-items: center;
}

#mainSidebar .nav-link i {
    width: 1.2rem;
    text-align: center;
    margin-right: 0.5rem;
}

/* Main content adjustment */
main {
    transition: all 0.3s ease;
    min-height: calc(100vh - 400px); 
}

/* FIX: Only apply flex-nowrap to the container-fluid row, not all rows */
.container-fluid > .row {
    flex-wrap: nowrap !important;
    margin-left: 0;
    margin-right: 0;
}

/* Allow other rows to wrap normally */
.row {
    flex-wrap: wrap !important;
}

.sidebar.collapsed + main {
    margin-left: 0 !important;
    width: calc(100vw - 60px) !important;
    flex: 0 0 calc(100vw - 60px) !important;
    max-width: calc(100vw - 60px) !important;
}

/* Sidebar toggle button */
#sidebarToggle {
    border: none;
    background: transparent;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

#sidebarToggle:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Active state for both sidebars */
.sidebar .nav-link.active {
    background-color: #0d6efd;
    color: white !important;
}

.sidebar .nav-link:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.sidebar .nav-link.active:hover {
    background-color: #0b5ed7;
}

/* Ensure proper Bootstrap grid behavior */
.col-md-3.col-lg-2.d-md-block.bg-light.sidebar.collapsed {
    flex: 0 0 60px !important;
    max-width: 60px !important;
}

.col-md-9.ms-sm-auto.col-lg-10.px-md-4 {
    transition: all 0.3s ease;
}

/* Responsive behavior */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 1040;
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
    }
    
    #sidebarToggle {
        position: fixed;
        top: 70px;
        left: 10px;
        z-index: 1050;
        background: white;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
    }
}

/* Footer Styles */
.footer {
    margin-top: auto;
    font-size: 0.875rem;
}

/* Ensure proper page layout */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container-fluid:has(.row > .sidebar) {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Make sure main content area grows to push footer down */
main {
    flex: 1;
}

/* Dark footer styling */
.bg-dark {
    background-color: #343a40 !important;
}

/* Responsive footer */
@media (max-width: 768px) {
    .footer {
        text-align: center;
    }
    
    .footer .text-md-end {
        text-align: center !important;
    }
}

/* Fix for sidebar gap */
body {
    margin: 0;
    padding: 0;
}

#sidebarMenu {
    margin-left: 0 !important;
    padding-left: 8px !important;
}

.container-fluid {
    padding-left: 0;
}

.row {
    margin-left: 0;
    margin-right: 0;
}
