#mobileSidebarOpenBtn {
  display: none;
}

/* sidebar logo */
.sidebar-logo-container {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  border-bottom: 1px solid var(--grey);
  margin-bottom: 0.75rem;
  height: 64px;
}

.sidebar-logo {
  margin: 0;
  width: 112px;
  height: auto;
}

.btn-sidebar {
  width: 200px;
  padding: 10px 1rem;
}

.sidebar .btn-sidebar-toggle {
  position: absolute;
  background-color: transparent;
  font-size: 1rem;
  right: 0;

  top: 50%;
  transform: translateY(-50%);

  border: none;
  color: var(--tertiaryText);
}
.sidebar.collapsed .btn-sidebar-toggle {
  width: 100%;
}

/* Sidebar styles */
.sidebar {
  border-right: 1px solid var(--grey);
  display: flex;
  flex-direction: column;
  position: fixed; /* Ensure fixed positioning */
  background-color: var(--baseColor);
  left: 0;
  height: 100%; /* Adjusted height for header */
  justify-content: space-between;
  align-items: center;
  z-index: 1;
  padding-left: 0;
  padding-right: 0;
  overflow-y: auto;
  width: var(--sidebar-width);

  /* Optional: Add transitions for smoother sidebar toggle */
  transition:
    display 0.3s ease,
    width 0.3s ease;
}

/* collapsed in desktop */
.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  padding-left: 0;
  padding-right: 0;
  overflow-x: hidden;
}

/* hide text in collapsed mode (keep icons) */
.sidebar.collapsed .sidebar-logo-container img,
.sidebar.collapsed .search-input-wrapper,
.sidebar.collapsed .patient-list-heading-container,
.sidebar.collapsed .patient-item-container,
.sidebar.collapsed .sidebar-footer-button span,
.sidebar.collapsed .btn-general span,
.sidebar.collapsed .btn-general span,
.sidebar.collapsed .patient-item.healthie-patient-group,
.sidebar.collapsed .healthie-patient-search-btn,
.sidebar.collapsed .btn-sidebar-delete-encounter, /* Hide trash cans */
.sidebar.collapsed .patient-name,                 /* Hide patient names */
.sidebar.collapsed .patient-date,                 /* Hide patient dates */
.sidebar.collapsed .encounter-date,               /* Hide encounter dates */
.sidebar.collapsed .healthie-patient-name,        /* Hide group header text */
.sidebar.collapsed .athena-patient-name,
.sidebar.collapsed .healthie-encounter-count,     /* Hide group counts */
.sidebar.collapsed .athena-encounter-count,
.sidebar.collapsed .healthie-expand-icon,         /* Hide expand arrows */
.sidebar.collapsed .athena-expand-icon,
.sidebar.collapsed .patient-item, 
.sidebar.collapsed .healthie-patient-group,
.sidebar.collapsed .athena-appointments-btn,
.sidebar.collapsed .athena-patient-group {
  display: none !important;
}

.sidebar.collapsed .new-encounter-btn {
  width: 44px;
  padding: 0px;
}

/* tighten list padding */
.sidebar.collapsed #patient-list {
  padding-left: 6px;
  padding-right: 6px;
}

/* center icons nicely */
.sidebar.collapsed .sidebar-footer-button,
.sidebar.collapsed .new-encounter-btn,
.sidebar.collapsed .modmed-patient-search-btn,
.sidebar.collapsed .athena-appointments-btn {
  justify-content: center;
}

/* make plus icon not absolutely offset when collapsed */
.sidebar.collapsed .new-encounter-btn > i {
  position: static;
}

.sidebar h3 {
  margin-top: 0;
}

.sidebar-header-wrapper {
  padding-top: 0;
  margin-top: 0;
  gap: 0;
  position: relative; /* Ensure position context */
  width: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* encounter btn */
.new-encounter-btn {
  color: var(--primaryTextInverse);
  background-color: var(--primaryAccent);
  border: none;
  cursor: pointer;
  position: relative;
  justify-self: center;

  margin: 10px 0;
  margin-bottom: 10px;
  height: 44px;
  font-size: 16px;
  font-weight: 500;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  padding: 0 16px;

  transition: background-color 0.3s ease;

  overflow: hidden;

  flex-shrink: 0;
  flex-grow: 0;
}

/* patient search */
.search-input-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;

  padding: 0 28px;
  margin-top: 0;
  margin-bottom: 6px;

  width: 200px;
  height: 36px;
  border-radius: 8px;

  border: 1px solid var(--grey);
  background-color: var(--lightGrey);
}

.search-input-wrapper > i {
  color: #666;
  font-size: 14px;
  color: var(--tertiaryText);
}

.search-input-wrapper::placeholder {
  color: var(--grey);
}

/* Sidebar and Search Styles */
#patientSearchInput {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 14px;
  background-color: transparent;
  border: none;
  outline: none;
  cursor: text;
  padding: 0;
  padding-top: 4px; /* Add top padding to move text down a bit */
}

#patientSearchInput::placeholder {
  color: var(--tertiaryText);
}

/* Sidebar Footer */
.sidebar-footer {
  /* margin-top: auto; */
  padding: 8px;
  width: 100%;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--grey);
}

.sidebar-footer-top {
  height: 132px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--grey);
  padding-bottom: 1rem;
}

.sidebar-footer-button {
  text-align: left;
  font-size: 16px !important;
  font-weight: 200px;
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  color: var(--primaryText);
  text-decoration: none;
  border-radius: 0.5rem;
}

.sidebar-footer-button:hover {
  background-color: var(--baseColorHover);
}

.sidebar-footer-button:active {
  background-color: var(--baseColorActive);
}

.sidebar-footer-button i {
  font-size: 1rem;
  width: 1rem;
  text-align: center;
}

/* Sidebar encounter Btn */

/* Sidebar Search Input */
.sidebar input[type='text'] {
  width: 100%;
  padding: 8px;
  margin-bottom: 5px;
  text-align: center;
}

/* Patient List Styles */
.patient-list-heading-container {
  display: flex;
  width: 100%;
  justify-content: start;
  padding-left: 10px;
}
.patient-list-heading {
  font-size: 0.75rem;
  color: rgb(107, 114, 128);
  font-weight: 600;
  letter-spacing: 0.6px;
}
.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: start;
  overflow-y: scroll;
  overflow-x: hidden;
  max-height: 400px;
}

.sidebar > li:hover {
  background-color: #f9f9f9;
}

.sidebar li button {
  visibility: hidden;
}

.sidebar li:hover button {
  visibility: visible;
}

/* Patient List Styles */
#patient-list {
  width: 100%;
  list-style: none;
  min-height: 200px; /* Ensure minimum height for the list */
  max-height: calc(100vh - 230px); /* Adjust max height for more space */
  overflow-y: auto;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  margin-top: 0.5rem;
  position: relative; /* Ensure position context */
}

.patient-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
  position: relative;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  user-select: none;
}

.patient-item:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.patient-item-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.5rem;
}

.patient-name {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  font-size: 1rem;
  max-width: 172px;
}
.patient-date {
  font-size: 0.75rem;
  color: var(--tertiaryText);
}

.btn-sidebar-delete-encounter {
  cursor: pointer;
  border: 0;
  background-color: transparent;
  padding: 2px;
  width: 26px;
  max-width: 26px;
  height: 26px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

.btn-sidebar-delete-encounter > i {
  font-size: 16px;
  /* color: red; */
}

/* Current patient highlighting */
.patient-item-current {
  background-color: #f0f6ff !important; /* Blue at 70% opacity */
  /* color: var(--white) !important;  */
  border-radius: 8px;
  border: 1px solid var(--primaryAccentLight);
  transition: all 0.2s ease;
}

/* Override hover for current patient */
.patient-item-current:hover {
  background-color: var(--primaryAccentLighter);
}

/* ModMed Patient Search Button */
.modmed-patient-search-btn {
  margin-top: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.modmed-patient-search-btn:hover {
  background-color: #3730a3;
  color: var(--primaryTextInverse);
}

.modmed-patient-search-btn:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}
/* patient search EHR integration BTN */
/* Healthie Patient Search Button */
.healthie-patient-search-btn {
  margin-top: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.healthie-patient-search-btn:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

body.dark-mode .sidebar {
  background-color: #1b263b; /* Dark blue for sidebars */
}

/* Athena Appointments Button */
.athena-appointments-btn {
  margin-top: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.athena-appointments-btn:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.modmed-patient-search-btn,
.healthie-patient-search-btn,
.athena-appointments-btn {
  margin-bottom: 1.25rem;
  height: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 !important;
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(85vw, 280px);
    height: 100dvh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

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

  #mobileSidebarOpenBtn {
    position: fixed;
    top: 8px;
    left: 12px;
    z-index: 800;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
  }
  #mobileSidebarOpenBtn i {
    font-size: 20px;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;

    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }
  .sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }
  .search-input-wrapper,
  .btn-sidebar {
    width: 240px;
    height: 52px;
  }
}
