/* OMU DSpace RTL Tools Left Safe V1.2 */
/* CSS only. Arabic tools remain far-left; dropdowns open inward and remain visible. */

@media (min-width: 992px) {

  html[dir="rtl"] header,
  body[dir="rtl"] header,
  html[lang^="ar"] header {
    position: relative !important;
    overflow: visible !important;
    z-index: 2000 !important;
  }

  html[dir="rtl"] header nav,
  html[dir="rtl"] header .navbar,
  html[dir="rtl"] header .container,
  html[dir="rtl"] header .container-fluid,
  html[dir="rtl"] header .navbar-collapse,
  body[dir="rtl"] header nav,
  body[dir="rtl"] header .navbar,
  body[dir="rtl"] header .container,
  body[dir="rtl"] header .container-fluid,
  body[dir="rtl"] header .navbar-collapse,
  html[lang^="ar"] header nav,
  html[lang^="ar"] header .navbar,
  html[lang^="ar"] header .container,
  html[lang^="ar"] header .container-fluid,
  html[lang^="ar"] header .navbar-collapse {
    overflow: visible !important;
  }

  /* Reset inner real components to avoid double offset */
  html[dir="rtl"] header ds-themed-search-navbar ds-search-navbar,
  body[dir="rtl"] header ds-themed-search-navbar ds-search-navbar,
  html[lang^="ar"] header ds-themed-search-navbar ds-search-navbar,
  html[dir="rtl"] header ds-themed-lang-switch ds-lang-switch,
  body[dir="rtl"] header ds-themed-lang-switch ds-lang-switch,
  html[lang^="ar"] header ds-themed-lang-switch ds-lang-switch,
  html[dir="rtl"] header ds-themed-auth-nav-menu ds-auth-nav-menu,
  body[dir="rtl"] header ds-themed-auth-nav-menu ds-auth-nav-menu,
  html[lang^="ar"] header ds-themed-auth-nav-menu ds-auth-nav-menu {
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: auto !important;
  }

  /* Search: far left */
  html[dir="rtl"] header ds-themed-search-navbar,
  body[dir="rtl"] header ds-themed-search-navbar,
  html[lang^="ar"] header ds-themed-search-navbar {
    position: absolute !important;
    left: clamp(48px, 4.6vw, 82px) !important;
    top: 24px !important;
    z-index: 3000 !important;
    margin: 0 !important;
    transform: none !important;
    pointer-events: auto !important;
    overflow: visible !important;
  }

  /* Language: next to search */
  html[dir="rtl"] header ds-themed-lang-switch,
  body[dir="rtl"] header ds-themed-lang-switch,
  html[lang^="ar"] header ds-themed-lang-switch {
    position: absolute !important;
    left: clamp(118px, calc(4.6vw + 70px), 152px) !important;
    top: 38px !important;
    z-index: 3000 !important;
    margin: 0 !important;
    transform: none !important;
    pointer-events: auto !important;
    overflow: visible !important;
  }

  /* Login: next to language */
  html[dir="rtl"] header ds-themed-auth-nav-menu,
  body[dir="rtl"] header ds-themed-auth-nav-menu,
  html[lang^="ar"] header ds-themed-auth-nav-menu {
    position: absolute !important;
    left: clamp(166px, calc(4.6vw + 118px), 214px) !important;
    top: 34px !important;
    z-index: 3000 !important;
    margin: 0 !important;
    transform: none !important;
    pointer-events: auto !important;
    min-width: 150px !important;
    text-align: left !important;
    white-space: nowrap !important;
    overflow: visible !important;
  }

  /* Make inner dropdown containers relative, but without moving them */
  html[dir="rtl"] header ds-themed-lang-switch ds-lang-switch,
  body[dir="rtl"] header ds-themed-lang-switch ds-lang-switch,
  html[lang^="ar"] header ds-themed-lang-switch ds-lang-switch,
  html[dir="rtl"] header ds-themed-auth-nav-menu ds-auth-nav-menu,
  body[dir="rtl"] header ds-themed-auth-nav-menu ds-auth-nav-menu,
  html[lang^="ar"] header ds-themed-auth-nav-menu ds-auth-nav-menu {
    position: relative !important;
    overflow: visible !important;
  }

  /* Language dropdown: open inward from far-left, never outside viewport */
  html[dir="rtl"] header ds-themed-lang-switch .dropdown-menu,
  body[dir="rtl"] header ds-themed-lang-switch .dropdown-menu,
  html[lang^="ar"] header ds-themed-lang-switch .dropdown-menu,
  html[dir="rtl"] header ds-themed-lang-switch [class*="dropdown-menu"],
  body[dir="rtl"] header ds-themed-lang-switch [class*="dropdown-menu"],
  html[lang^="ar"] header ds-themed-lang-switch [class*="dropdown-menu"] {
    position: absolute !important;
    left: 0 !important;
    right: auto !important;
    top: calc(100% + 10px) !important;
    bottom: auto !important;
    transform: none !important;
    min-width: 220px !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 270px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 4000 !important;
    text-align: center !important;
  }

  /* Login dropdown: open inward from far-left, never outside viewport */
  html[dir="rtl"] header ds-themed-auth-nav-menu .dropdown-menu,
  body[dir="rtl"] header ds-themed-auth-nav-menu .dropdown-menu,
  html[lang^="ar"] header ds-themed-auth-nav-menu .dropdown-menu,
  html[dir="rtl"] header ds-themed-auth-nav-menu [class*="dropdown-menu"],
  body[dir="rtl"] header ds-themed-auth-nav-menu [class*="dropdown-menu"],
  html[lang^="ar"] header ds-themed-auth-nav-menu [class*="dropdown-menu"] {
    position: absolute !important;
    left: 0 !important;
    right: auto !important;
    top: calc(100% + 10px) !important;
    bottom: auto !important;
    transform: none !important;
    min-width: 360px !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 270px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 4000 !important;
    text-align: right !important;
  }

  html[dir="rtl"] header ds-themed-auth-nav-menu .nav-link,
  body[dir="rtl"] header ds-themed-auth-nav-menu .nav-link,
  html[lang^="ar"] header ds-themed-auth-nav-menu .nav-link,
  html[dir="rtl"] header ds-themed-lang-switch .nav-link,
  body[dir="rtl"] header ds-themed-lang-switch .nav-link,
  html[lang^="ar"] header ds-themed-lang-switch .nav-link {
    margin: 0 !important;
    pointer-events: auto !important;
  }
}
