/* Shared phone translation control for Patient, Doctor and Pharmacy headers. */
.mobile-language-control {
  display: none;
  flex: 0 0 auto;
}

.mobile-language-toggle {
  width: 48px;
  height: 48px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0;
  border: 1px solid #d8e3f1;
  border-radius: 12px;
  background: #fff;
  color: #1267e8;
  box-shadow: none;
  cursor: pointer;
}

.mobile-language-toggle > i {
  color: #49c5f6;
  font-size: 1.2rem;
}

.mobile-language-toggle.dropdown-toggle::after {
  margin: 0;
  border-top: 5px solid #1267e8;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
}

.mobile-language-toggle:hover,
.mobile-language-toggle:focus-visible,
.mobile-language-toggle[aria-expanded="true"] {
  border-color: #b8d3f7;
  background: #f5f9ff;
}

.mobile-language-toggle:focus-visible {
  outline: 2px solid #1267e8;
  outline-offset: 2px;
}

.mobile-language-menu {
  z-index: 1090;
  width: 236px;
  max-height: calc(100vh - 78px);
  padding: 8px;
  overflow-y: auto;
  border: 1px solid #dce6f2;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(18, 40, 98, 0.16);
}

.mobile-language-heading {
  padding: 7px 10px 9px;
  color: #7285a1;
  font-size: 0.69rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mobile-language-menu .mobile-language-option {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #17365f;
  font-size: 0.82rem;
  font-weight: 600;
}

.mobile-language-option > span {
  width: 29px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 7px;
  background: #eaf5ff;
  color: #0874dc;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.mobile-language-menu .mobile-language-option:hover,
.mobile-language-menu .mobile-language-option:focus {
  color: #0759b8;
  background: #edf5ff;
}

@media (max-width: 767.98px) {
  body.patient-global-header .patient-mobile-language,
  body.doctor-ehr-page .doctor-mobile-language,
  body.pharmacy-workspace-page .pharmacy-mobile-language,
  body.pharmacy-dashboard-page .pharmacy-mobile-language {
    display: block;
  }

  body.patient-global-header .patient-mobile-language-menu {
    position: fixed !important;
    top: 64px !important;
    right: 12px !important;
    left: auto !important;
    width: min(236px, calc(100vw - 24px)) !important;
    min-width: 0 !important;
    transform: none !important;
  }

  body.doctor-ehr-page .doctor-mobile-language .mobile-language-toggle,
  body.pharmacy-workspace-page .pharmacy-mobile-language .mobile-language-toggle,
  body.pharmacy-dashboard-page .pharmacy-mobile-language .mobile-language-toggle {
    width: 38px;
    height: 38px;
    min-height: 38px;
    gap: 5px;
    border-radius: 9px;
  }

  body.doctor-ehr-page .doctor-mobile-language .mobile-language-toggle > i,
  body.pharmacy-workspace-page .pharmacy-mobile-language .mobile-language-toggle > i,
  body.pharmacy-dashboard-page .pharmacy-mobile-language .mobile-language-toggle > i {
    font-size: 0.95rem;
  }

  body.doctor-ehr-page .doctor-mobile-language .mobile-language-toggle.dropdown-toggle::after,
  body.pharmacy-workspace-page .pharmacy-mobile-language .mobile-language-toggle.dropdown-toggle::after,
  body.pharmacy-dashboard-page .pharmacy-mobile-language .mobile-language-toggle.dropdown-toggle::after {
    border-top-width: 4px;
    border-right-width: 4px;
    border-left-width: 4px;
  }

  body.doctor-ehr-page .doctor-mobile-language-menu {
    position: fixed !important;
    top: 66px !important;
    right: 12px !important;
    left: auto !important;
    width: min(236px, calc(100vw - 24px)) !important;
    min-width: 0 !important;
    max-height: calc(100vh - 80px) !important;
    transform: none !important;
  }

  body.pharmacy-workspace-page .pharmacy-mobile-language-menu,
  body.pharmacy-dashboard-page .pharmacy-mobile-language-menu {
    position: fixed !important;
    top: 62px !important;
    right: 12px !important;
    left: auto !important;
    width: min(236px, calc(100vw - 24px)) !important;
    min-width: 0 !important;
    max-height: calc(100vh - 76px) !important;
    transform: none !important;
  }
}

@media (max-width: 575.98px) {
  body.doctor-ehr-page .doctor-mobile-language .mobile-language-toggle {
    width: 48px;
    height: 48px;
    min-height: 48px;
    gap: 7px;
    border-radius: 12px;
  }

  body.doctor-ehr-page .doctor-mobile-language .mobile-language-toggle > i {
    font-size: 1.2rem;
  }

  body.doctor-ehr-page .doctor-mobile-language .mobile-language-toggle.dropdown-toggle::after {
    border-top-width: 5px;
    border-right-width: 5px;
    border-left-width: 5px;
  }

  body.doctor-ehr-page .doctor-mobile-language-menu {
    top: 64px !important;
    max-height: calc(100vh - 78px) !important;
  }
}

/* Five Doctor controls still fit comfortably on narrow 320-389px phones. */
@media (max-width: 389.98px) {
  body.patient-global-header .site-header .navbar > .container {
    padding-right: 10px !important;
    padding-left: 10px !important;
  }

  body.patient-global-header .site-header .navbar-toggler {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  body.patient-global-header .site-header #navbarToggle > .navbar-nav.align-items-center {
    gap: 6px;
  }

  body.patient-global-header .site-header .patient-mobile-site-menu .lang-globe-btn,
  body.patient-global-header .patient-mobile-language .mobile-language-toggle {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }

  body.patient-global-header .site-header .notification-bell {
    width: 42px;
    height: 42px;
    min-height: 42px;
  }

  body.patient-global-header .site-header .user-avatar {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  body.doctor-ehr-page .doctor-workspace-topbar,
  body.doctor-ehr-page:has(.dws-rail) .doctor-workspace-topbar {
    gap: 8px !important;
    padding-right: 12px !important;
    padding-left: 12px !important;
  }

  body.doctor-ehr-page .doctor-workspace-topbar .doctor-topbar-actions {
    gap: 8px !important;
  }

  body.doctor-ehr-page .doctor-workspace-topbar .doctor-menu-toggle,
  body.doctor-ehr-page .doctor-workspace-topbar .doctor-icon-button {
    width: 42px;
    height: 42px;
  }

  body.doctor-ehr-page .doctor-workspace-topbar .doctor-public-menu-button,
  body.doctor-ehr-page .doctor-mobile-language .mobile-language-toggle {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }

  body.doctor-ehr-page .doctor-workspace-topbar .doctor-profile-button img {
    width: 42px;
    height: 42px;
  }
}
