/* Critical overrides with maximum specificity */

/* Force white text in sidebar navigation */
body .page .sidebar .navbar-brand,
body .page .sidebar .nav-item a,
body .page .sidebar .nav-link,
body .page .sidebar nav a {
    color: white !important;
}

/* Ensure sidebar background uses theme colors */
body .page .sidebar {
    background-image: linear-gradient(180deg, var(--sidebar-start-color, #052767) 0%, var(--sidebar-end-color, #3a0647) 70%) !important;
}

/* Ensure top row in sidebar uses theme colors */
body .page .sidebar .top-row {
    background-color: var(--sidebar-start-color, #052767) !important;
}

/* Theme-specific overrides */
body[data-theme="default"] .page .sidebar .top-row,
body.default .page .sidebar .top-row {
    background-color: rgb(5, 39, 103) !important;
}

body[data-theme="teal-purple"] .page .sidebar .top-row,
body.teal-purple .page .sidebar .top-row {
    background-color: #00897B !important;
}

body[data-theme="forest-plum"] .page .sidebar .top-row,
body.forest-plum .page .sidebar .top-row {
    background-color: #2E7D32 !important;
}

body[data-theme="navy-coral"] .page .sidebar .top-row,
body.navy-coral .page .sidebar .top-row {
    background-color: #1A237E !important;
}

body[data-theme="emerald-indigo"] .page .sidebar .top-row,
body.emerald-indigo .page .sidebar .top-row {
    background-color: #2E7D62 !important;
}

body .page .sidebar .nav-item a.active,
body .page .sidebar .nav-link.active {
    background-color: rgba(255,255,255,0.25) !important;
    color: white !important;
}

body .page .sidebar .nav-item a:hover,
body .page .sidebar .nav-link:hover {
    background-color: rgba(255,255,255,0.1) !important;
    color: white !important;
}

/* Force light grey top row in main content */
body .page main .top-row {
    background-color: #f7f7f7 !important;
    color: #333 !important;
    border-bottom: 1px solid #d6d5d5 !important;
}

body .page main .top-row a, 
body .page main .top-row .btn-link {
    color: #333 !important;
}

/* Ensure login button has white text */
body .page main .top-row .btn-primary,
body .page main .btn-primary,
.btn-primary {
    color: white !important;
}

/* Fix spacing at top of page */
body, html, .page {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Eliminate ALL top spacing */
body, html, .page, .sidebar, .sidebar .top-row, main {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Force sidebar to start at absolute top */
.sidebar {
    position: sticky !important;
    top: 0 !important;
    height: 100vh !important;
}

.sidebar .top-row {
    position: sticky !important;
    top: 0 !important;
}

/* Reset any potential browser defaults */
* {
    margin-block-start: 0;
    margin-block-end: 0;
    padding-block-start: 0;
    padding-block-end: 0;
}

/* Ensure responsive menu works */
@media (max-width: 640.98px) {
    body .page .sidebar .collapse {
        display: none !important;
    }
    
    body .page .sidebar .collapse.show {
        display: block !important;
    }
    
    body .page .sidebar .navbar-toggler {
        display: block !important;
    }
}
