@media (max-width: 1200px) {
  .table-responsive {
    overflow-x: auto;
  }
  
  .d-flex.justify-content-between {
    flex-wrap: wrap;
    gap: 10px;
  }
}

/* Medium devices (tablets, less than 992px) */
@media (max-width: 991.98px) {
  /* Sidebar responsive behavior */
  aside.sidebar {
    width: 65px;
    transition: width 0.3s ease;
    overflow: visible;
    z-index: 1040;
  }
  
  aside.sidebar:hover {
    width: 220px;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
  }
  
  /* Adjust logo when sidebar is collapsed */
  header.logo-container {
    justify-content: center;
    padding: 1rem 0.5rem;
  }
  
  aside.sidebar .logo-text {
    display: none;
  }
  
  aside.sidebar:hover .logo-text {
    display: inline;
  }
  
  /* Adjust nav items when sidebar is collapsed */
  .nav-link span,
  .nav-link .ms-auto {
    display: none;
  }
  
  aside.sidebar:hover .nav-link span,
  aside.sidebar:hover .nav-link .ms-auto {
    display: inline-block;
  }
  
  /* Hide submenu by default in collapsed mode */
  .sub-menu {
    position: absolute;
    left: 65px;
    top: 0;
    width: 200px;
    background: white;
    box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.1);
    border-radius: 0 4px 4px 0;
    display: none;
    max-height: none;
  }
  
  /* Only show submenu when parent is hovered in collapsed mode */
  aside.sidebar:not(:hover) .nav-item:hover .sub-menu {
    display: block;
  }
  
  /* Show submenu normally when sidebar is expanded */
  aside.sidebar:hover .sub-menu {
    position: static;
    box-shadow: none;
    width: auto;
  }
  
  aside.sidebar:hover .sub-menu.show {
    display: block;
  }
  
  /* Adjust main content margin */
  main {
    margin-left: 65px;
  }
  
  /* Adjust topbar position */
  header.topbar {
    left: 65px;
  }
  
  /* When sidebar is hovered, don't change main content/topbar */
  /* This prevents content shifting when hovering sidebar */
}

/* Small devices (landscape phones, less than 768px) */
@media (max-width: 767.98px) {
  /* Mobile view adjustments */
  .year-selector,
  .dropdown-sort {
    width: 100%;
    margin-top: 10px;
  }
  
  .d-flex.justify-content-between {
    flex-direction: column;
    align-items: center !important;
  }
  
  .container-fluid .d-flex.justify-content-between.mb-3 {
    flex-direction: column;
    align-items: center !important;
    gap: 15px;
  }
  .container-fluid .d-flex.justify-content-between.mb-3 .d-flex.align-items-center {
    margin-bottom: 10px;
    width: 100%;
    justify-content: center !important;
  }
  .d-flex.justify-content-between.align-items-center.mt-4 {
    align-items: center !important;
    flex-direction: row;
  }
  
  .d-flex.align-items-center {
    margin-bottom: 10px;
    width: 100%;
  }
  
  /* Table adjustments */
  .sort-icon {
    display: none;
  }
  
  /* Pagination for mobile */
  .d-flex.justify-content-between.align-items-center.mt-4 {
    flex-wrap: wrap;
    justify-content: center !important;
  }
  
  .text-muted {
    width: 100%;
    text-align: center;
    margin-bottom: 10px;
  }
  
  /* Make topbar responsive */
  .user-profile {
    width: 100%;
    justify-content: flex-end;
  }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
  /* Make sidebar toggle-able for very small screens */
  aside.sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 220px;
  }
  
  aside.sidebar.show {
    transform: translateX(0);
  }
  
  aside.sidebar .logo-text {
    display: inline;
  }
  
  .nav-link span,
  .nav-link .ms-auto {
    display: inline-block;
  }
  
  /* Reset main content margin on mobile */
  main {
    margin-left: 0;
  }
  
  /* Reset topbar on mobile */
  header.topbar {
    left: 0;
  }
  
  /* Add mobile menu toggle button */
  .mobile-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1050;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Table adjustments for very small screens */
  table {
    min-width: 800px; /* Ensure horizontal scroll on small screens */
  }
  
  /* Entry selector adjustment */
  .d-flex.align-items-center span {
    font-size: 12px;
  }
  
  #entriesSelector {
    width: 60px !important;
    padding-left: 5px;
    padding-right: 5px;
  }
  
  /* Pagination button size reduction */
  .btn {
    padding: 0.25rem 0.5rem;
    font-size: 14px;
  }
}


