/* sidebar.css */
/* Comprehensive sidebar styling for IMES application */

/* Main sidebar container */
.imes-sidebar {
  padding: 0px 15px;
  height: auto;
  min-height: calc(100vh - 80px);
  overflow-y: visible;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  box-sizing: border-box;
  transition: width 0.3s ease, transform 0.3s ease;
  position: relative;
}

/* Main navigation container */
.page-wrapper.compact-wrapper .page-body-wrapper header.main-nav {
  height: 100vh;
  overflow-y: auto !important;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 100px;
  /* Add padding at the bottom to ensure last items are visible */
}

/* Page body wrapper */
.page-wrapper.compact-wrapper .page-body-wrapper {
  height: 100vh;
  position: relative;
}

/* User profile section */
.page-wrapper.compact-wrapper .page-body-wrapper header.main-nav .sidebar-user {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: white;
}

/* ===== SCROLLBAR STYLING ===== */
/* Modern scrollbar styles (Firefox) */
.imes-sidebar {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* Webkit scrollbar styles (Chrome, Safari, Edge) */
.imes-sidebar::-webkit-scrollbar,
.page-wrapper.compact-wrapper .page-body-wrapper header.main-nav::-webkit-scrollbar {
  width: 6px;
}

.imes-sidebar::-webkit-scrollbar-track,
.page-wrapper.compact-wrapper .page-body-wrapper header.main-nav::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 10px;
}

.imes-sidebar::-webkit-scrollbar-thumb,
.page-wrapper.compact-wrapper .page-body-wrapper header.main-nav::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.imes-sidebar::-webkit-scrollbar-thumb:hover,
.page-wrapper.compact-wrapper .page-body-wrapper header.main-nav::-webkit-scrollbar-thumb:hover {
  background-color: rgba(0, 0, 0, 0.4);
}

/* ===== SECTION TITLES ===== */
.imes-section-title {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
  margin-bottom: 10px;
  width: 100%;
  display: block;
}

/* ===== MENU ITEMS ===== */
.imes-menu-item {
  display: flex;
  align-items: flex-start;
  padding: 12px 20px;
  color: #2c3e50;
  border-radius: 8px;
  margin: 5px 0;
  transition: all 0.25s ease;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  overflow: visible;
}

.imes-menu-item:hover {
  background-color: rgba(36, 105, 92, 0.08);
  color: #24695c;
  padding-left: 23px;
  /* Instead of transform which can cause layout issues */
  width: 100%;
  box-sizing: border-box;
}

.imes-menu-item:active {
  padding-left: 20px;
  /* Reset padding on active */
  background-color: rgba(36, 105, 92, 0.12);
}

.imes-active-menu-item {
  background-color: #e7f3ef;
  color: #24695c;
  font-weight: 600;
}

.imes-active-menu-item:hover {
  background-color: #e7f3ef;
  transform: none;
}

/* ===== SUBMENU STYLING ===== */
.imes-submenu {
  padding-left: 20px;
  margin-top: 5px;
  transition: all 0.3s ease;
  width: 100%;
  overflow: hidden;
}

.imes-submenu-expanded {
  margin-bottom: 10px;
}

.imes-submenu-collapsed {
  margin-bottom: 0;
}

.imes-submenu-item {
  display: flex;
  align-items: flex-start;
  padding: 10px 15px;
  margin: 5px 0;
  border-radius: 6px;
  color: #2c3e50;
  text-decoration: none;
  transition: all 0.25s ease;
  font-size: 14px;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  overflow: visible;
}

.imes-submenu-item:hover {
  background-color: rgba(36, 105, 92, 0.08);
  color: #24695c;
  padding-left: 18px;
  /* Instead of transform which can cause layout issues */
  width: 100%;
  box-sizing: border-box;
}

.imes-submenu-item:active {
  padding-left: 15px;
  /* Reset padding on active */
  background-color: rgba(36, 105, 92, 0.12);
}

.imes-active-submenu-item {
  background-color: #e7f3ef;
  color: #24695c;
  font-weight: 500;
}

.imes-active-submenu-item:hover {
  background-color: #e7f3ef;
  transform: none;
}

/* ===== CHEVRON ICON ===== */
.imes-chevron {
  margin-left: auto;
  transition: transform 0.3s ease;
  color: #6c757d;
  flex-shrink: 0;
}

/* ===== LEGACY FIXES ===== */
/* Fix for any potential template overrides */
.page-wrapper .page-body-wrapper .page-sidebar .sidebar-menu .sidebar-header.active>.sidebar-submenu,
.page-wrapper .page-body-wrapper .page-sidebar .sidebar-menu>li.active>.sidebar-submenu {
  position: relative !important;
  transform: none !important;
  visibility: visible !important;
  opacity: 1 !important;
  display: block !important;
}

/* Active indicator animation */
.nav-link span[style] {
  transition: all 0.3s ease-in-out !important;
}

/* Ensure dropdown menu items are properly styled */
.main-nav .nav-menu .dropdown>.nav-link {
  width: 100% !important;
  display: block !important;
  box-sizing: border-box !important;
  position: relative !important;
  transition: all 0.3s ease !important;
}

/* Sidebar toggle button and collapsed styles removed as requested */

/* Active module highlight */
.imes-active-module>.imes-menu-item {
  border-left: 3px solid #24695c;
  padding-left: 17px;
}

/* Icon wrapper styling */
.imes-icon-wrapper {
  margin-right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Submenu icon styling */
.imes-submenu-icon {
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #24695c;
  flex-shrink: 0;
  margin-top: 6px;
}

/* Add a subtle hover effect for menu items */
.imes-menu-item:hover .imes-icon-wrapper {
  transform: scale(1.1);
  transition: transform 0.2s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .imes-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    background: white;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    width: 250px;
  }
}

/* Ensure proper background color for active items */
.main-nav .nav-menu .dropdown.active,
.main-nav .nav-menu .dropdown.imes-active-link {
  background-color: transparent !important;
}