:root {
  --sidebar-width: 280px;
}

body {
  font-size: 0.9rem;
  background-color: #f8f9fa;
  overflow-x: hidden;
}

.sidebar {
  position: static; /* FIX for Bootstrap layout */
  height: auto;
  box-shadow: none;
}

/* Desktop - Sidebar always visible and pushes content */
@media (min-width: 992px) {
  .sidebar {
    transform: translateX(0) !important;
  }

  main {
    margin-left: var(--sidebar-width) !important;
  }
}

/* Main content default */
main {
  padding: 1rem;
  transition: margin-left 0.3s ease-in-out;
}

/* Sidebar nav links */
.sidebar .nav-link {
  font-weight: 500;
  color: #333;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  margin: 0.125rem 0.75rem;
  transition: all 0.15s ease-in-out;
}

.sidebar .nav-link:hover {
  color: #000000;
  background-color: rgba(13, 110, 253, 0.1);
}

.sidebar .nav-link.active {
  color: #fff;
  background-color: #000000;
}

.sidebar .nav-link i {
  margin-right: 0.5rem;
  width: 16px;
  text-align: center;
}

/* Mobile Sidebar */
@media (max-width: 991.98px) {
  .sidebar {
    top: 0;
    height: 100vh;
    transform: translateX(-100%);
    z-index: 1050;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  }

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

  main {
    margin-left: 0 !important;
    padding: 0.75rem;
  }

  /* Overlay */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
  }

  .sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
  }
}

/* Small mobile devices */
@media (max-width: 575.98px) {
  main {
    padding: 0.5rem;
  }

  .card {
    margin-bottom: 0.75rem;
  }

  .card-body {
    padding: 0.75rem;
  }

  .table-responsive {
    font-size: 0.8rem;
  }

  .table th,
  .table td {
    padding: 0.375rem 0.25rem;
    font-size: 0.75rem;
  }

  .btn {
    font-size: 0.8rem;
    padding: 0.625rem 0.875rem;
  }

  /* Stack buttons */
  .d-grid.gap-2.d-md-flex {
    display: grid !important;
    gap: 0.5rem;
  }

  .d-grid.gap-2.d-md-flex .btn {
    width: 100%;
    margin: 0;
  }

  /* Make sidebar full width */
  .sidebar {
    width: 100%;
  }
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Print mode */
@media print {
  .sidebar,
  .navbar,
  .no-print,
  .sidebar-overlay {
    display: none !important;
  }

  main {
    margin-left: 0 !important;
  }
}
