/* Sidebar Navigation Styles */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 250px;
  height: 100vh;
  background-color: #ffffff;
  border-right: 1px solid #e5e7eb;
  overflow-y: auto;
  z-index: 1040;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #111827;
  font-size: 1.25rem;
  font-weight: 700;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  background-color: #111827;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  color: #ffffff;
  font-weight: bold;
}

.sidebar-menu {
  padding: 1rem 0;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section-title {
  padding: 0 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #6b7280;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav-item {
  margin-bottom: 0.25rem;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  color: #4b5563;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
}

.sidebar-nav-link:hover {
  background-color: #f3f4f6;
  color: #111827;
}

.sidebar-nav-link.active {
  background-color: #eff6ff;
  color: #2563eb;
  border-left: 3px solid #2563eb;
  padding-left: calc(1.25rem - 3px);
}

.sidebar-nav-icon {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.sidebar-dropdown-toggle {
  position: relative;
}

.sidebar-dropdown-toggle::after {
  content: '\276F';
  position: absolute;
  right: 1.25rem;
  transition: transform 0.2s;
}

.sidebar-dropdown-toggle.collapsed::after {
  transform: rotate(90deg);
}

.sidebar-dropdown {
  list-style: none;
  padding: 0;
  margin: 0;
  background-color: #f9fafb;
}

.sidebar-dropdown .sidebar-nav-link {
  padding-left: 3.5rem;
  font-size: 0.813rem;
}

/* Main Content Area with Sidebar */
.main-wrapper {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: 250px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-navbar {
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.top-navbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-bar {
  flex: 1;
  max-width: 400px;
}

.search-bar input {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.875rem;
}

.search-bar input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-content {
  flex: 1;
  padding: 1.5rem;
  background-color: #f9fafb;
}

/* Footer */
.footer {
  background-color: #ffffff;
  border-top: 1px solid #e5e7eb;
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
    width: 280px; /* Slightly wider for better touch targets */
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  /* Mobile touch-friendly adjustments */
  .sidebar-header {
    padding: 1.5rem 1.5rem;
  }

  .sidebar-brand {
    font-size: 1.375rem; /* Larger for better readability */
  }

  .sidebar-brand-icon {
    width: 40px;
    height: 40px;
    margin-right: 14px;
  }

  .sidebar-section-title {
    padding: 0.75rem 1.5rem 0.5rem;
    font-size: 0.813rem;
  }

  .sidebar-nav-link {
    padding: 1rem 1.5rem; /* Increased padding for 44px minimum touch target */
    font-size: 1rem; /* Larger text for better readability */
    min-height: 48px; /* Ensure minimum touch target height */
  }

  .sidebar-nav-link.active {
    border-left: 4px solid #2563eb;
    padding-left: calc(1.5rem - 4px);
  }

  .sidebar-nav-icon {
    width: 24px; /* Larger icons */
    height: 24px;
    margin-right: 14px;
    font-size: 1.25rem;
  }

  .sidebar-nav-icon i {
    font-size: 1.25rem;
  }

  /* Add touch feedback */
  .sidebar-nav-link:active {
    background-color: #e0e7ff;
    transform: scale(0.98);
  }

  /* Increase spacing between items for easier tapping */
  .sidebar-nav-item {
    margin-bottom: 0.375rem;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1035;
  }

  .sidebar-backdrop.show {
    display: block;
  }

  .sidebar-toggle {
    display: block;
    padding: 0.75rem;
    min-height: 48px; /* Touch-friendly toggle button */
  }
}

@media (min-width: 769px) {
  .sidebar-toggle {
    display: none;
  }

  .sidebar-backdrop {
    display: none !important;
  }
}

/* Mobile dropdown improvements */
@media (max-width: 768px) {
  .dropdown-menu .dropdown-item {
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .dropdown-toggle {
    min-height: 48px;
  }
}

/* Utility classes */
.badge-count {
  background-color: #ef4444;
  color: white;
  font-size: 0.625rem;
  padding: 0.125rem 0.375rem;
  border-radius: 9999px;
  margin-left: auto;
}