/* Responsive adjustments for CoreUI Sidebar */
:root {
  --cui-sidebar-width: 16rem;
  --cui-sidebar-narrow-width: 4rem;
}

@media (min-width: 992px) {

  /* Default Desktop: Wrapper adjustment */
  .wrapper {
    margin-left: var(--cui-sidebar-width);
    transition: margin-left 0.3s ease;
  }

  /* When sidebar is narrow (minimized) -> wrapper stays at 4rem */
  #sidebar.sidebar-narrow~.wrapper {
    margin-left: var(--cui-sidebar-narrow-width);
  }

  /* When sidebar is hidden completely */
  #sidebar.hide~.wrapper {
    margin-left: 0;
  }
}

/* Sidebar Width and Transitions */
.sidebar {
  transition: width 0.3s ease, margin-left 0.3s ease !important;
}

/* Sidebar Narrow Styles */
.sidebar-narrow,
.sidebar-narrow .sidebar-nav,
.sidebar-narrow .simplebar-wrapper,
.sidebar-narrow .simplebar-mask,
.sidebar-narrow .simplebar-offset,
.sidebar-narrow .simplebar-content-wrapper,
.sidebar-narrow .simplebar-content {
  overflow: visible !important;
  /* Prevent parent clipping of tooltips */
}

.sidebar-narrow {
  width: var(--cui-sidebar-narrow-width) !important;
}

/* Icons are ALWAYS visible and centered in narrow mode */
.sidebar-narrow .nav-icon {
  min-width: var(--cui-sidebar-narrow-width) !important;
  margin: 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  font-size: 1.25rem !important;
  opacity: 1 !important;
}

.sidebar-narrow .nav-link {
  padding: 0 !important;
  height: 3.5rem;
  display: flex;
  align-items: center;
  position: relative;
  overflow: visible !important;
}

/* Hide navigation labels and titles by default when narrow */
.sidebar-narrow .nav-link>span,
.sidebar-narrow .nav-title,
.sidebar-narrow .sidebar-brand-full {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  /* Take out of flow so they don't affect icon centering */
}

/* Floating Label (Tooltip) on Hover */
.sidebar-narrow .nav-link:hover>span {
  visibility: visible !important;
  opacity: 1 !important;
  display: block !important;
  position: absolute;
  left: 100% !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  background: #212631 !important;
  /* Darker, more premium gray */
  color: #ebedef !important;
  padding: 0.6rem 1.25rem !important;
  border-radius: 6px !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  white-space: nowrap !important;
  z-index: 10000 !important;
  box-shadow: 6px 6px 15px rgba(0, 0, 0, 0.4) !important;
  margin-left: 12px !important;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Add a small arrow to the tooltip */
.sidebar-narrow .nav-link:hover>span::before {
  content: "" !important;
  position: absolute !important;
  right: 100% !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  border-width: 6px !important;
  border-style: solid !important;
  border-color: transparent #212631 transparent transparent !important;
}

/* Logo toggling in narrow mode */
.sidebar-narrow .sidebar-brand-narrow {
  display: flex !important;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  font-size: 1.5rem;
}

.sidebar:not(.sidebar-narrow) .sidebar-brand-narrow {
  display: none !important;
}

/* Card Consistency */
.card {
  margin-bottom: 24px;
  border: none;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Badges more noticeable */
.badge {
  padding: 0.5em 0.8em;
}

/* Table Alignment */
.table td {
  vertical-align: middle;
}