/* OmniVenta R415 - Employee permission location picker, hardened against legacy styles. */
.ov-employee-permissions .panel.panel-piluku{
  margin-bottom:12px!important;
  overflow:visible!important;
}
.ov-employee-permissions .panel-heading.list-group-item,
.ov-employee-permissions .permission-action-item{
  position:relative!important;
  min-height:46px!important;
  height:auto!important;
  padding:10px 190px 10px 12px!important;
  overflow:visible!important;
  line-height:1.35!important;
}
.ov-employee-permissions .permission-action-item{padding-left:22px!important}
.ov-employee-permissions .panel-heading.list-group-item>.text-success{font-weight:700!important}
.ov-employee-permissions .panel-heading.list-group-item>.text-warning,
.ov-employee-permissions .permission-action-item>.text-info{
  margin:0!important;
  white-space:normal!important;
  word-break:normal!important;
}
.ov-employee-permissions .ov-location-picker{
  position:absolute!important;
  right:12px!important;
  top:50%!important;
  transform:translateY(-50%)!important;
  z-index:30!important;
  display:block!important;
}
.ov-employee-permissions .ov-location-trigger{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:6px!important;
  width:auto!important;
  min-width:142px!important;
  min-height:32px!important;
  margin:0!important;
  padding:6px 10px!important;
  border:1px solid #d9cfea!important;
  border-radius:8px!important;
  background:#fff!important;
  color:#7350a6!important;
  font-size:12px!important;
  font-weight:600!important;
  white-space:nowrap!important;
  line-height:1.2!important;
  box-shadow:none!important;
}
.ov-employee-permissions .ov-location-trigger:hover,
.ov-employee-permissions .ov-location-trigger:focus,
.ov-employee-permissions .ov-location-picker.is-open .ov-location-trigger{
  background:#f5f0fb!important;
  border-color:#bda8d7!important;
  color:#5f3d8e!important;
}
.ov-employee-permissions .ov-location-chevron{transition:transform .16s ease}
.ov-employee-permissions .ov-location-picker.is-open .ov-location-chevron{transform:rotate(180deg)}
.ov-employee-permissions .ov-location-menu,
.ov-employee-permissions .ov-location-menu[hidden]{display:none!important}
.ov-employee-permissions .ov-location-picker.is-open .ov-location-menu:not([hidden]){
  display:block!important;
  position:absolute!important;
  top:calc(100% + 6px)!important;
  right:0!important;
  left:auto!important;
  min-width:230px!important;
  max-width:320px!important;
  padding:8px!important;
  margin:0!important;
  background:#fff!important;
  border:1px solid #d8cfe2!important;
  border-radius:10px!important;
  box-shadow:0 12px 32px rgba(40,28,60,.20)!important;
  z-index:99999!important;
}
.ov-employee-permissions .ov-location-option{
  display:flex!important;
  align-items:center!important;
  gap:9px!important;
  min-height:36px!important;
  margin:0!important;
  padding:7px 8px!important;
  border-radius:7px!important;
  color:#334155!important;
  font-size:13px!important;
  font-weight:500!important;
  line-height:1.2!important;
  cursor:pointer!important;
}
.ov-employee-permissions .ov-location-option:hover{background:#f7f4fa!important}
.ov-employee-permissions .ov-location-option input[type=checkbox]{
  display:inline-block!important;
  position:static!important;
  opacity:1!important;
  visibility:visible!important;
  width:17px!important;
  height:17px!important;
  margin:0!important;
  flex:0 0 17px!important;
}
.ov-employee-permissions .ov-location-separator{height:1px!important;background:#ece7f1!important;margin:5px 2px!important}
.ov-employee-permissions .ov-location-all span{font-weight:700!important}
.ov-employee-permissions .list-group{margin-bottom:0!important}

@media(max-width:767px){
  .ov-employee-permissions .panel-heading.list-group-item,
  .ov-employee-permissions .permission-action-item{
    padding-right:12px!important;
    padding-bottom:52px!important;
  }
  .ov-employee-permissions .ov-location-picker{
    left:38px!important;
    right:auto!important;
    top:auto!important;
    bottom:8px!important;
    transform:none!important;
  }
  .ov-employee-permissions .ov-location-trigger{min-width:150px!important}
  .ov-employee-permissions .ov-location-picker.is-open .ov-location-menu:not([hidden]){
    position:fixed!important;
    left:12px!important;
    right:12px!important;
    bottom:14px!important;
    top:auto!important;
    min-width:0!important;
    max-width:none!important;
    max-height:55vh!important;
    overflow:auto!important;
  }
}

/* OmniVenta R418 - desktop panel opens to the LEFT of the Localidades button.
   Keeps the location list clear of the stacked buttons in the right action column. */
@media (min-width: 901px) {
  .ov-employee-permissions .panel-heading.list-group-item,
  .ov-employee-permissions .permission-action-item {
    overflow: visible !important;
  }

  .ov-employee-permissions .ov-location-picker {
    z-index: 60 !important;
  }

  .ov-employee-permissions .ov-location-picker.is-open {
    z-index: 200000 !important;
  }

  .ov-employee-permissions .ov-location-picker.is-open .ov-location-menu:not([hidden]) {
    display: block !important;
    position: absolute !important;
    top: -7px !important;
    right: calc(100% + 14px) !important;
    left: auto !important;
    width: 300px !important;
    min-width: 260px !important;
    max-width: min(360px, calc(100vw - 260px)) !important;
    max-height: 320px !important;
    overflow: auto !important;
    transform: none !important;
    margin: 0 !important;
    z-index: 200001 !important;
    box-shadow: 0 14px 34px rgba(38, 28, 57, .22) !important;
  }

  /* Small pointer aimed at the invoking button. */
  .ov-employee-permissions .ov-location-picker.is-open .ov-location-menu:not([hidden])::after {
    content: "";
    position: absolute;
    top: 18px;
    right: -6px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-top: 1px solid #d8cfe2;
    border-right: 1px solid #d8cfe2;
    transform: rotate(45deg);
  }

  /* Do not let neighboring location buttons paint over the open selector. */
  .ov-employee-permissions .panel-heading.list-group-item:has(.ov-location-picker.is-open),
  .ov-employee-permissions .permission-action-item:has(.ov-location-picker.is-open) {
    z-index: 100000 !important;
  }
}

/* Tablet: still prefer an in-flow full-width panel. */
@media (min-width: 768px) and (max-width: 900px) {
  .ov-employee-permissions .panel-heading.list-group-item,
  .ov-employee-permissions .permission-action-item {
    padding-right: 12px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 8px !important;
  }
  .ov-employee-permissions .ov-location-picker,
  .ov-employee-permissions .ov-location-picker.is-open {
    position: static !important;
    transform: none !important;
    width: 100% !important;
    margin-left: 28px !important;
  }
  .ov-employee-permissions .ov-location-picker.is-open .ov-location-menu:not([hidden]) {
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    margin-top: 7px !important;
  }
}
