.m-0 {
  margin: 0 !important;
}

.mx-1 {
  margin-right: .25rem !important;
  margin-left: .25rem !important;
}

.mx-3 {
  margin-right: 1rem !important;
  margin-left: 1rem !important;
}

.my-0 {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.my-2 {
  margin-top: .5rem !important;
  margin-bottom: .5rem !important;
}

.my-5 {
  margin-top: 3rem !important;
  margin-bottom: 3rem !important;
}

.my-auto {
  margin-top: auto !important;
  margin-bottom: auto !important;
}

.mt-2 {
  margin-top: .5rem !important;
}

.mt-4 {
  margin-top: 1.5rem !important;
}

.me-2 {
  margin-right: .5rem !important;
}

.me-3 {
  margin-right: 1rem !important;
}

.me-auto {
  margin-right: auto !important;
}

.mb-0 {
  margin-bottom: 0 !important;
}

.mb-1 {
  margin-bottom: .25rem !important;
}

.mb-2 {
  margin-bottom: .5rem !important;
}

.mb-3 {
  margin-bottom: 1rem !important;
}

.mb-4 {
  margin-bottom: 1.5rem !important;
}

.mb-5 {
  margin-bottom: 3rem !important;
}

.ms-auto {
  margin-left: auto !important;
}

@media (min-width: 576px) {
  .mb-sm-0 {
    margin-bottom: 0rem !important;
  }
}

@media (min-width: 768px) {
  .my-md-0 {
    margin-top: 0rem !important;
    margin-bottom: 0rem !important;
  }
}

@media (min-width: 768px) {
  .ms-md-3 {
    margin-left: 1rem !important;
  }
}

/* ========================================
   FIXED SIDEBAR LAYOUT SYSTEM
   ======================================== */

/* Wrapper Layout */
#wrapper {
  display: flex;
  min-height: 100vh;
}

/* Fixed Sidebar Styles - Desktop First */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 224px;
  height: 100vh;
  z-index: 1040;
  overflow-x: hidden;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar internal structure */
.sidebar .sidebar-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* Brand section - fixed height */
.sidebar .sidebar-brand {
  flex-shrink: 0;
  height: 4.375rem;
  margin: 0;
  text-decoration: none;
}

/* Divider - no extra spacing */
.sidebar .sidebar-divider {
  flex-shrink: 0;
  margin: 0;
  border-color: rgba(255, 255, 255, 0.15);
}

/* Navigation list - scrollable area */
.sidebar .navbar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 0;
  min-height: 0;
}

/* Nav items */
.sidebar .nav-item {
  margin-bottom: 0;
}

.sidebar .nav-link {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.8);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}

.sidebar .nav-link i {
  margin-right: 0.5rem;
  width: 1rem;
  text-align: center;
}

/* Sidebar toggle button container */
.sidebar .text-center.d-none.d-md-inline {
  flex-shrink: 0;
  padding: 1rem 0;
  margin-top: auto;
}

/* Content wrapper adjustment for fixed sidebar */
#content-wrapper {
  flex: 1;
  margin-left: 224px;
  min-height: 100vh;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: calc(100% - 224px);
}

/* Sidebar Toggled (Collapsed) State - Desktop */
body.sidebar-toggled .sidebar {
  width: 104px;
}

body.sidebar-toggled #content-wrapper {
  margin-left: 104px;
  width: calc(100% - 104px);
}

body.sidebar-toggled .sidebar .sidebar-brand-text {
  display: none;
}

body.sidebar-toggled .sidebar .nav-link span {
  display: none;
}

/* Sticky Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  width: 100%;
}

/* Custom Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* ========================================
   MOBILE RESPONSIVE STYLES (Below 768px)
   ======================================== */

@media (max-width: 767.98px) {
  /* Content takes full width on mobile */
  #content-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }

  /* Hide desktop sidebar on mobile */
  #desktopSidebar {
    display: none !important;
  }
}

/* ========================================
   MOBILE OFFCANVAS STYLING
   ======================================== */

/* Offcanvas nav styling */
.offcanvas .nav-link {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.offcanvas .nav-link i {
  margin-right: 0.5rem;
  width: 1rem;
  text-align: center;
}

.offcanvas .nav-link:hover,
.offcanvas .nav-link:focus {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.offcanvas .nav-link.active {
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.offcanvas .collapse-inner {
  margin: 0.5rem 0;
}

.offcanvas .collapse-item {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  display: block;
  color: #3a3b45;
  text-decoration: none;
}

.offcanvas .collapse-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.offcanvas .collapse-item.active {
  color: #4e73df;
  font-weight: 700;
}

.offcanvas .collapse-header {
  padding: 0.5rem 1rem;
  margin: 0;
  font-size: 0.65rem;
  font-weight: 800;
  color: #b7b9cc;
  text-transform: uppercase;
}

.offcanvas .collapse-divider {
  border-top: 1px solid #eaecf4;
  margin: 0.5rem 0;
}

/* ========================================
   TABLET RESPONSIVE (768px to 991px)
   ======================================== */

@media (min-width: 768px) and (max-width: 991.98px) {
  /* Sidebar slightly narrower on tablets */
  .sidebar {
    width: 200px !important;
  }

  #content-wrapper {
    margin-left: 200px;
    width: calc(100% - 200px);
  }

  body.sidebar-toggled .sidebar {
    width: 90px !important;
  }

  body.sidebar-toggled #content-wrapper {
    margin-left: 90px;
    width: calc(100% - 90px);
  }
}

/* ========================================
   SIDEBAR TOGGLE BUTTON
   ======================================== */

#sidebarToggle {
  width: 2.5rem;
  height: 2.5rem;
  background-color: rgba(255, 255, 255, 0.2);
  transition: background-color 0.2s ease;
}

#sidebarToggle:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

#sidebarToggle::after {
  content: '\f104'; /* FontAwesome chevron-left */
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  color: rgba(255, 255, 255, 0.8);
}

body.sidebar-toggled #sidebarToggle::after {
  content: '\f105'; /* FontAwesome chevron-right */
}

/* ========================================
   NAVIGATION IMPROVEMENTS
   ======================================== */

/* Smoother nav-link transitions */
.sidebar .nav-link {
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Only apply hover on non-touch devices */
@media (hover: hover) and (pointer: fine) {
  .sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
}

.sidebar .nav-link.active {
  background-color: rgba(255, 255, 255, 0.15);
}

/* Active state for touch devices */
.sidebar .nav-link:active {
  background-color: rgba(255, 255, 255, 0.08);
}

/* Collapse items styling */
.sidebar .collapse-inner {
  transition: all 0.3s ease;
  margin: 0.5rem 0;
}

.sidebar .collapse-item {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  -webkit-tap-highlight-color: transparent;
}

/* Only apply hover on non-touch devices */
@media (hover: hover) and (pointer: fine) {
  .sidebar .collapse-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
  }
}

.sidebar .collapse {
  margin: 0;
}

.sidebar .nav-link.collapsed {
  border-radius: 0;
}

/* ========================================
   SCROLL TO TOP BUTTON
   ======================================== */

.scroll-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1020;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.scroll-to-top:hover {
  transform: translateY(-3px);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Prevent body scroll when mobile sidebar is open */
@media (max-width: 767.98px) {
  body.sidebar-open {
    overflow: hidden;
  }
}

/* Smooth transitions for all interactive elements */
.sidebar,
#content-wrapper,
.sidebar .nav-link,
.sidebar .collapse {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   VISIBLE SCROLLBAR FOR SIDEBAR LIST
   ======================================== */
#accordionSidebar {
  /* Force scrollbar to be visible for discoverability */
  overflow-y: scroll;
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: rgba(0,0,0,0.25) transparent; /* Firefox */
}

/* Chrome/Edge/Safari */
#accordionSidebar::-webkit-scrollbar {
  width: 8px;
}
#accordionSidebar::-webkit-scrollbar-track {
  background: transparent;
}
#accordionSidebar::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.25);
  border-radius: 6px;
}
#accordionSidebar:hover::-webkit-scrollbar-thumb {
  background-color: rgba(0,0,0,0.4);
}

