/**
 * Consolidated Navigation Styles
 * This file contains all styles related to the navigation (sidebar and topbar)
 */

/* ======== Sidebar Styles ======== */

/* Base sidebar styling */
#accordionSidebar {
  position: fixed;
  height: 100vh;
  width: 280px;
  overflow-y: auto;
  background: linear-gradient(135deg, #2b5876 0%, #4e4376 100%);
  z-index: 1000;
  transition: all 0.25s ease;
}

/* Sidebar brand styling */
.sidebar-brand {
  height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.sidebar-brand img {
  max-width: 100%;
  height: auto;
}

/* Sidebar dividers */
.sidebar-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin: 1rem 0;
}

/* Navigation link styling */
.nav-item {
  position: relative;
  margin-bottom: 0.25rem;
}

.nav-item .nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  margin: 0 0.5rem;
  border-radius: 0.5rem;
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.2s;
}

.nav-item .nav-link:hover, 
.nav-item .nav-link:focus {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-item .nav-link:active {
  background-color: rgba(255, 255, 255, 0.15);
}

/* Icon wrapper for navigation items */
.nav-link-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-right: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
}

.nav-item .nav-link:hover .nav-link-icon-wrapper {
  color: #fff;
}

/* Dropdown toggle icon */
.toggle-icon {
  transition: transform 0.2s;
}

.nav-link[aria-expanded="true"] .toggle-icon {
  transform: rotate(180deg);
}

/* Dropdown/collapse styles */
.collapse-inner {
  padding: 0.5rem 0;
  border-radius: 0.35rem;
  box-shadow: 0 0.15rem 1.75rem rgba(0, 0, 0, 0.15);
}

.collapse-item {
  display: block;
  padding: 0.5rem 1rem;
  margin: 0 0.5rem;
  color: #3a3b45;
  font-size: 0.85rem;
  border-radius: 0.25rem;
  transition: all 0.15s;
}

.collapse-item:hover {
  background-color: #f8f9fc;
  color: #4e73df;
  font-weight: 600;
}

.collapse-header {
  font-size: 0.75rem;
  letter-spacing: 0.05rem;
  padding: 0.5rem 1rem;
  text-transform: uppercase;
  font-weight: bold;
  color: #b7b9cc;
}

/* Badge styling */
.badge-pill {
  padding: 0.25rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.badge-danger {
  background-color: #e74a3b;
  box-shadow: 0 2px 4px rgba(231, 74, 59, 0.3);
}

/* Pulse animation for notifications */
.pulse {
  position: relative;
}

.pulse:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: rgba(255, 82, 82, 0.6);
  animation: pulse 1.5s infinite;
  z-index: -1;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.7;
  }
  70% {
    transform: scale(1.1);
    opacity: 0.3;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.7;
  }
}

/* ======== Content Wrapper Styles ======== */

/* Content wrapper positioning */
#content-wrapper {
  margin-left: 280px;
  transition: margin-left 0.3s ease;
  width: calc(100% - 280px);
  min-height: 100vh;
  padding-top: 0; /* Fix the gap */
  padding-bottom: 0; /* Fix the gap */
  margin-top: 0; /* Fix the gap */
  margin-bottom: 0; /* Fix the gap */
}

/* Fix for the main content container */
#content {
  padding-top: 0; /* Fix the gap */
  margin-top: 0; /* Fix the gap */
}

/* Toggled sidebar adjustments */
.sidebar.toggled {
  width: 0;
  overflow: hidden;
}

.sidebar.toggled + #content-wrapper {
  margin-left: 0;
  width: 100%;
}

/* ======== Topbar Styles ======== */

/* Topbar styling */
.topbar {
  height: 4.5rem;
  position: relative;
  z-index: 1;
  margin-bottom: 0; /* Fix the gap */
  padding-bottom: 0; /* Fix the gap */
}

/* Sidebar toggle button */
#sidebarToggleTop {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: transparent;
  border: none;
  color: #3a3b45;
  transition: all 0.15s;
}

#sidebarToggleTop:hover {
  background-color: #eaecf4;
}

#sidebarToggleTop:focus {
  outline: none;
}

/* User dropdown in topbar */
.img-profile {
  height: 2rem;
  width: 2rem;
  object-fit: cover;
}

.topbar-divider {
  width: 0;
  border-right: 1px solid #e3e6f0;
  height: calc(4.5rem - 2rem);
  margin: auto 1rem;
}

/* ======== Responsive Styles ======== */

/* Mobile (< 768px) */
@media (max-width: 767.98px) {
  /* Default sidebar state on mobile */
  #accordionSidebar {
    transform: translateX(-100%);
  }
  
  body.sidebar-toggled #accordionSidebar {
    transform: translateX(0);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  }
  
  /* Content wrapper takes full width by default on mobile */
  #content-wrapper {
    margin-left: 0;
    width: 100%;
  }
  
  /* Make the topbar more compact */
  .topbar {
    padding: 0 0.5rem;
  }
  
  /* Reduce padding in container for more content space */
  .container-fluid {
    padding: 1rem;
    padding-top: 0; /* Fix the gap */
    margin-top: 0; /* Fix the gap */
  }
  
  /* Improve dropdown menu positioning */
  .dropdown-menu {
    position: fixed;
    top: 4rem;
    right: 0.5rem;
    width: calc(100% - 1rem);
    max-width: 20rem;
  }
}

/* Tablet (768px - 992px) */
@media (min-width: 768px) and (max-width: 991.98px) {
  #accordionSidebar {
    width: 240px;
  }
  
  #content-wrapper {
    margin-left: 240px;
    width: calc(100% - 240px);
  }
  
  /* Make nav items more compact */
  .nav-item .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
  
  .nav-link-icon-wrapper {
    width: 1.75rem;
    height: 1.75rem;
    margin-right: 0.5rem;
  }
}

/* Fix for container-fluid spacing */
.container-fluid {
  padding-top: 0; /* Fix the gap */
  margin-top: 0; /* Fix the gap */
}

/* Fix for page headings */
.d-sm-flex.align-items-center.justify-content-between.mb-4 {
  margin-top: 0.5rem; /* Add a little space at the top */
}

/* Fix for topbar margins */
.topbar.mb-4 {
  margin-bottom: 0 !important; /* Override bootstrap margin */
}

/* Dark Mode Adjustments */
body.dark-theme #accordionSidebar {
  background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%) !important;
}

body.dark-theme .collapse-inner {
  background-color: #2d3748 !important;
}

body.dark-theme .collapse-item {
  color: #e2e8f0 !important;
}

body.dark-theme .collapse-item:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}
