/**
 * Ganpati Cargo - Modern Clean Sidebar Design System
 * Restores original layout hierarchy with modern typography, jewel accents & crisp contrast
 * Fully supports Light, Dark & Night Shift Modes (WCAG 2.1 AA Compliant)
 */

/* ==========================================================================
   1. COLOR TOKENS & SHELL SYSTEM
   ========================================================================== */
:root {
  /* Light Theme Palette */
  --side-bg: #ffffff;
  --side-border: #e8edf3;
  --side-text: #1e293b;
  --side-text-muted: #64748b;
  --side-text-dim: #94a3b8;
  --side-hover-bg: #f1f5f9;
  --side-hover-text: #3b5bfd;
  --side-active-bg: linear-gradient(135deg, #3b5bfd 0%, #4f46e5 100%);
  --side-active-text: #ffffff;
  --side-active-shadow: 0 3px 12px rgba(59, 91, 253, 0.25);
  --side-card-bg: #f8fafc;
  --side-card-border: #e2e8f0;
  --side-accent-blue: #3b5bfd;
  --side-accent-indigo: #6366f1;
  --side-accent-teal: #0ea5e9;
  --side-accent-green: #10b981;
}

[data-theme="dark"] {
  /* Dark Theme Palette (Sleek Deep Logistics Navy) */
  --side-bg: #0c121e;
  --side-border: #1a2538;
  --side-text: #f1f5f9;
  --side-text-muted: #94a3b8;
  --side-text-dim: #64748b;
  --side-hover-bg: rgba(255, 255, 255, 0.06);
  --side-hover-text: #60a5fa;
  --side-active-bg: linear-gradient(135deg, #4364ff 0%, #6366f1 100%);
  --side-active-text: #ffffff;
  --side-active-shadow: 0 4px 16px rgba(67, 100, 255, 0.35);
  --side-card-bg: #111a2c;
  --side-card-border: #1e2c45;
  --side-accent-blue: #60a5fa;
  --side-accent-indigo: #818cf8;
  --side-accent-teal: #38bdf8;
  --side-accent-green: #34d399;
}

/* ==========================================================================
   2. SIDEBAR CONTAINER & SCROLL FRAMEWORK (CLEAN 250PX WIDTH)
   ========================================================================== */
.left-sidebar {
  width: 250px !important;
  background: var(--side-bg) !important;
  border-right: 1px solid var(--side-border) !important;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.03) !important;
  position: fixed !important;
  top: 64px !important;
  bottom: 0 !important;
  left: 0 !important;
  z-index: 100 !important;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s ease !important;
}

[data-theme="dark"] .left-sidebar {
  box-shadow: 3px 0 16px rgba(0, 0, 0, 0.35) !important;
}

.scroll-sidebar {
  height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 10px 10px 40px 10px !important;
}

/* Modern Minimalist Scrollbar */
.scroll-sidebar::-webkit-scrollbar {
  width: 5px;
}
.scroll-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.scroll-sidebar::-webkit-scrollbar-thumb {
  background: var(--side-border);
  border-radius: 8px;
}
.scroll-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--side-accent-blue);
}

.page-wrapper {
  margin-left: 250px !important;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  min-height: calc(100vh - 64px) !important;
}

@media (max-width: 767px) {
  .left-sidebar {
    left: -250px !important;
  }
  .show-sidebar .left-sidebar {
    left: 0 !important;
  }
  .page-wrapper {
    margin-left: 0 !important;
  }
}

/* ==========================================================================
   3. MODERNIZED USER PROFILE SECTION
   ========================================================================== */
.left-sidebar .user-profile {
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid var(--side-border) !important;
  border-radius: 0 !important;
  padding: 10px 8px 14px 8px !important;
  margin: 4px 6px 10px 6px !important;
  transition: all 0.2s ease !important;
  align-items: center !important;
}

.left-sidebar .user-profile .user-pic img {
  width: 42px !important;
  height: 42px !important;
  border-radius: 50% !important;
  border: 2px solid var(--side-accent-blue) !important;
  box-shadow: 0 2px 8px rgba(59, 91, 253, 0.2) !important;
  object-fit: cover !important;
  background: var(--side-bg) !important;
}

.left-sidebar .user-profile .user-content {
  margin-left: 10px !important;
  min-width: 0 !important;
  flex: 1 !important;
}

.left-sidebar .user-profile .user-content h5.user-name {
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  color: var(--side-text-muted) !important;
  line-height: 1.2 !important;
  margin: 0 !important;
}

.left-sidebar .user-profile .user-content .user-email {
  font-size: 13.5px !important;
  font-weight: 700 !important;
  color: var(--side-text) !important;
  display: block !important;
  line-height: 1.3 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  margin-top: 1px !important;
}

.left-sidebar .user-profile .dropdown-menu {
  position: absolute !important;
  top: 100% !important;
  left: 6px !important;
  right: 6px !important;
  width: auto !important;
  min-width: 0 !important;
  background: var(--side-card-bg) !important;
  border: 1px solid var(--side-card-border) !important;
  border-radius: 10px !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
  padding: 6px 0 !important;
  z-index: 1000 !important;
}

[data-theme="dark"] .left-sidebar .user-profile .dropdown-menu {
  background: #111a2c !important;
  border-color: #1e2c45 !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
}

.left-sidebar .user-profile .dropdown-menu.show {
  display: block !important;
}

.left-sidebar .user-profile .dropdown-menu .dropdown-item {
  color: var(--side-text) !important;
  font-size: 13px !important;
  padding: 8px 14px !important;
  display: flex !important;
  align-items: center !important;
  transition: all 0.15s ease !important;
}

.left-sidebar .user-profile .dropdown-menu .dropdown-item:hover {
  background: var(--side-hover-bg) !important;
  color: var(--side-hover-text) !important;
  padding-left: 18px !important;
}

.left-sidebar .user-profile .dropdown-menu .dropdown-divider {
  border-top-color: var(--side-border) !important;
  margin: 4px 0 !important;
}

/* ==========================================================================
   4. QUICK ACTION BUTTONS (PRIMARY GRADIENT & SECONDARY PILL)
   ========================================================================== */
.left-sidebar .p-15 {
  padding: 0 6px !important;
  margin-bottom: 6px !important;
}

.left-sidebar .m-t-10 {
  margin-top: 4px !important;
}

/* Primary Action: Create new shipment (Vibrant Jewel Gradient) */
.left-sidebar a[href*="courier_add_new"].create-btn,
.left-sidebar a.create-btn:not([href*="courier_add.php"]) {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 9px 12px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.28) !important;
  transition: all 0.2s ease !important;
  text-decoration: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.left-sidebar a[href*="courier_add_new"].create-btn:hover,
.left-sidebar a.create-btn:not([href*="courier_add.php"]):hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.38) !important;
  color: #ffffff !important;
}

.left-sidebar a[href*="courier_add_new"].create-btn i,
.left-sidebar a.create-btn:not([href*="courier_add.php"]) i {
  font-size: 15px !important;
  margin-right: 6px !important;
  color: #ffffff !important;
}

/* Secondary Action: Add Virtual Shipment */
.left-sidebar a[href*="courier_add.php"].create-btn {
  background: var(--side-card-bg) !important;
  color: var(--side-text) !important;
  border: 1px solid var(--side-card-border) !important;
  border-radius: 8px !important;
  padding: 8px 12px !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.2s ease !important;
  text-decoration: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.left-sidebar a[href*="courier_add.php"].create-btn:hover {
  background: var(--side-hover-bg) !important;
  border-color: var(--side-accent-blue) !important;
  color: var(--side-accent-blue) !important;
  transform: translateY(-1px) !important;
}

.left-sidebar a[href*="courier_add.php"].create-btn i {
  font-size: 15px !important;
  margin-right: 6px !important;
  color: var(--side-accent-blue) !important;
}

/* ==========================================================================
   5. NAVIGATION MENU (SIDEBARNAV) STRUCTURE & LINKS
   ========================================================================== */
.left-sidebar .sidebar-nav {
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
}

.left-sidebar #sidebarnav {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
}

/* Section Dividers */
.left-sidebar .nav-small-cap {
  padding: 12px 10px 4px 10px !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  color: var(--side-text-dim) !important;
  background: transparent !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  line-height: 1.2 !important;
}

/* Hide empty section headers that create awkward blank vertical space */
.left-sidebar .nav-small-cap:empty,
.left-sidebar .nav-small-cap > span.hide-menu:empty:only-child {
  display: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.left-sidebar .nav-small-cap i {
  font-size: 13px !important;
  opacity: 0.7 !important;
}

/* Sidebar Item & Link */
.left-sidebar #sidebarnav .sidebar-item {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  position: relative !important;
}

.left-sidebar #sidebarnav .sidebar-link {
  display: flex !important;
  align-items: center !important;
  padding: 8px 12px !important;
  margin: 1px 4px !important;
  border-radius: 8px !important;
  color: var(--side-text) !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  letter-spacing: -0.01em !important;
  text-decoration: none !important;
  transition: all 0.15s ease !important;
  background: transparent !important;
  border: 1px solid transparent !important;
}

.left-sidebar #sidebarnav .sidebar-link:hover {
  background: var(--side-hover-bg) !important;
  color: var(--side-hover-text) !important;
  padding-left: 14px !important;
}

.left-sidebar #sidebarnav .sidebar-link i {
  font-size: 18px !important;
  margin-right: 10px !important;
  color: var(--side-accent-blue) !important;
  transition: transform 0.15s ease, color 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 20px !important;
  flex-shrink: 0 !important;
}

.left-sidebar #sidebarnav .sidebar-link:hover i {
  transform: scale(1.1) !important;
}

.left-sidebar #sidebarnav .sidebar-link .hide-menu {
  flex: 1 !important;
  color: inherit !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
}

/* Accordion Rotating Arrow */
.left-sidebar #sidebarnav .sidebar-link.has-arrow::after {
  content: "\F142";
  font-family: "Material Design Icons";
  font-size: 17px !important;
  margin-left: auto !important;
  color: var(--side-text-dim) !important;
  transition: transform 0.2s ease, color 0.2s ease !important;
  display: inline-block !important;
  border: none !important;
  width: auto !important;
  height: auto !important;
  transform: rotate(0deg);
}

.left-sidebar #sidebarnav .sidebar-link.has-arrow[aria-expanded="true"]::after,
.left-sidebar #sidebarnav .sidebar-item.selected > .sidebar-link.has-arrow::after,
.left-sidebar #sidebarnav .sidebar-link.has-arrow.active::after {
  transform: rotate(90deg) !important;
  color: var(--side-accent-blue) !important;
}

/* ==========================================================================
   6. ACTIVE STATE (JEWEL GRADIENT CAPSULE)
   ========================================================================== */
.left-sidebar #sidebarnav .sidebar-item.selected > .sidebar-link:not(.has-arrow),
.left-sidebar #sidebarnav .sidebar-link.active:not(.has-arrow),
.left-sidebar #sidebarnav a.sidebar-link.active {
  background: var(--side-active-bg) !important;
  color: #ffffff !important;
  box-shadow: var(--side-active-shadow) !important;
  font-weight: 600 !important;
}

.left-sidebar #sidebarnav .sidebar-item.selected > .sidebar-link:not(.has-arrow) i,
.left-sidebar #sidebarnav .sidebar-link.active:not(.has-arrow) i,
.left-sidebar #sidebarnav a.sidebar-link.active i {
  color: #ffffff !important;
}

.left-sidebar #sidebarnav .sidebar-item.selected > .sidebar-link:not(.has-arrow) .hide-menu,
.left-sidebar #sidebarnav .sidebar-link.active:not(.has-arrow) .hide-menu,
.left-sidebar #sidebarnav a.sidebar-link.active .hide-menu {
  color: #ffffff !important;
  font-weight: 600 !important;
}

/* Parent active when submenu item is selected */
.left-sidebar #sidebarnav .sidebar-item.selected > .sidebar-link.has-arrow {
  background: var(--side-hover-bg) !important;
  color: var(--side-accent-blue) !important;
  font-weight: 600 !important;
  border-left: 3px solid var(--side-accent-blue) !important;
  border-radius: 0 8px 8px 0 !important;
}

.left-sidebar #sidebarnav .sidebar-item.selected > .sidebar-link.has-arrow .hide-menu {
  color: var(--side-accent-blue) !important;
  font-weight: 600 !important;
}

/* ==========================================================================
   7. NESTED SUBMENUS (FIRST LEVEL & SECOND LEVEL)
   ========================================================================== */
.left-sidebar .sidebar-nav ul.collapse,
.left-sidebar .sidebar-nav ul.first-level {
  list-style: none !important;
  padding: 4px 0 4px 12px !important;
  margin: 2px 4px 2px 14px !important;
  border-left: 1.5px solid var(--side-border) !important;
  display: none !important;
  flex-direction: column !important;
  gap: 2px !important;
  background: transparent !important;
}

.left-sidebar .sidebar-nav ul.collapse.in,
.left-sidebar .sidebar-nav ul.collapse.show,
.left-sidebar .sidebar-nav ul.first-level.in,
.left-sidebar .sidebar-nav ul.first-level.show {
  display: flex !important;
}

/* Deeper level submenus (Level 2 inside Level 1) */
.left-sidebar .sidebar-nav ul.first-level ul.first-level,
.left-sidebar .sidebar-nav ul.collapse ul.collapse {
  margin: 2px 2px 2px 8px !important;
  padding: 3px 0 3px 10px !important;
  border-left: 1.5px dashed var(--side-border) !important;
}

.left-sidebar .sidebar-nav ul .first-level .sidebar-item {
  background: transparent !important;
}

.left-sidebar .sidebar-nav ul .first-level .sidebar-link {
  padding: 6px 10px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: var(--side-text-muted) !important;
  border-radius: 6px !important;
  background: transparent !important;
  margin: 1px 0 !important;
}

.left-sidebar .sidebar-nav ul .first-level .sidebar-link .hide-menu {
  color: var(--side-text-muted) !important;
  font-size: 13px !important;
}

.left-sidebar .sidebar-nav ul .first-level .sidebar-link i {
  font-size: 14px !important;
  width: 16px !important;
  margin-right: 8px !important;
  color: var(--side-accent-teal) !important;
}

/* Submenu checkmarks: soft elegant tint */
.left-sidebar .sidebar-nav ul .first-level .sidebar-link i.ti-check {
  color: #8b5cf6 !important;
}

.left-sidebar .sidebar-nav ul .first-level .sidebar-link:hover {
  background: var(--side-hover-bg) !important;
  color: var(--side-hover-text) !important;
  padding-left: 12px !important;
}

.left-sidebar .sidebar-nav ul .first-level .sidebar-link:hover .hide-menu {
  color: var(--side-hover-text) !important;
}

/* Active Submenu Link */
.left-sidebar .sidebar-nav ul .first-level .sidebar-item.active > .sidebar-link,
.left-sidebar .sidebar-nav ul .first-level .sidebar-link.active {
  background: rgba(59, 91, 253, 0.1) !important;
  color: var(--side-accent-blue) !important;
  font-weight: 600 !important;
}

.left-sidebar .sidebar-nav ul .first-level .sidebar-item.active > .sidebar-link .hide-menu,
.left-sidebar .sidebar-nav ul .first-level .sidebar-link.active .hide-menu {
  color: var(--side-accent-blue) !important;
  font-weight: 600 !important;
}

.left-sidebar .sidebar-nav ul .first-level .sidebar-item.active > .sidebar-link i,
.left-sidebar .sidebar-nav ul .first-level .sidebar-link.active i {
  color: var(--side-accent-blue) !important;
}

/* ==========================================================================
   8. MINI-SIDEBAR (COLLAPSED MODE) COMPATIBILITY
   ========================================================================== */
body[data-sidebartype="mini-sidebar"] .left-sidebar {
  width: 70px !important;
}

body[data-sidebartype="mini-sidebar"] .page-wrapper {
  margin-left: 70px !important;
}

body[data-sidebartype="mini-sidebar"] .left-sidebar .user-content,
body[data-sidebartype="mini-sidebar"] .left-sidebar .hide-menu,
body[data-sidebartype="mini-sidebar"] .left-sidebar .nav-small-cap,
body[data-sidebartype="mini-sidebar"] .left-sidebar .has-arrow::after,
body[data-sidebartype="mini-sidebar"] .left-sidebar .first-level {
  display: none !important;
}

body[data-sidebartype="mini-sidebar"] .left-sidebar .scroll-sidebar {
  padding: 8px 4px !important;
  align-items: center !important;
}

body[data-sidebartype="mini-sidebar"] .left-sidebar .user-profile {
  padding: 6px !important;
  justify-content: center !important;
  margin: 4px 2px !important;
}

body[data-sidebartype="mini-sidebar"] .left-sidebar .create-btn {
  padding: 9px 0 !important;
  justify-content: center !important;
}

body[data-sidebartype="mini-sidebar"] .left-sidebar .create-btn i {
  margin: 0 !important;
}

body[data-sidebartype="mini-sidebar"] .left-sidebar .sidebar-link {
  padding: 8px 0 !important;
  justify-content: center !important;
  margin: 2px 2px !important;
}

body[data-sidebartype="mini-sidebar"] .left-sidebar .sidebar-link i {
  margin: 0 !important;
}

/* ==========================================================================
   9. NAVBAR-HEADER & TOPBAR BRAND ALIGNMENT (250PX)
   ========================================================================== */
.topbar .top-navbar .navbar-header {
  width: 250px !important;
  background: var(--side-bg) !important;
  border-right: 1px solid var(--side-border) !important;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 64px !important;
}

body[data-sidebartype="mini-sidebar"] .topbar .top-navbar .navbar-header {
  width: 70px !important;
}

.topbar .navbar-brand {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 14px !important;
  height: 64px !important;
  line-height: 64px !important;
}

.topbar .navbar-brand img {
  max-height: 44px !important;
  width: auto !important;
  object-fit: contain !important;
}

[data-theme="dark"] .topbar .top-navbar .navbar-header {
  background: var(--side-bg) !important;
  border-right-color: var(--side-border) !important;
}

/* ==========================================================================
   10. TOPBAR BUTTONS HARMONIZATION
   ========================================================================== */
.topbar .topbar-btn {
  background: var(--side-bg) !important;
  color: var(--side-text) !important;
  border: 1px solid var(--side-border) !important;
  border-radius: 8px !important;
  padding: 6px 12px !important;
  font-weight: 600 !important;
  font-size: 12.5px !important;
  transition: all 0.15s ease !important;
}

.topbar .topbar-btn:hover {
  background: var(--side-hover-bg) !important;
  border-color: var(--side-accent-blue) !important;
  color: var(--side-accent-blue) !important;
  transform: translateY(-1px) !important;
}

.topbar .topbar-btn-primary {
  background: linear-gradient(135deg, #3b5bfd 0%, #4f46e5 100%) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(59, 91, 253, 0.3) !important;
}

.topbar .topbar-btn-primary:hover {
  background: linear-gradient(135deg, #2544e8 0%, #4338ca 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(59, 91, 253, 0.4) !important;
  transform: translateY(-1px) !important;
}

.topbar .topbar-search-btn {
  background: var(--side-card-bg) !important;
  border: 1px solid var(--side-border) !important;
  color: var(--side-text-muted) !important;
  border-radius: 20px !important;
  padding: 6px 14px !important;
}

.topbar .topbar-search-btn:hover {
  border-color: var(--side-accent-blue) !important;
  color: var(--side-accent-blue) !important;
}
