/*
 * @copyright   Copyright (C) 2010-2024 Combodo SAS
 * @license     http://opensource.org/licenses/AGPL-3.0
 */

$ibo-panel-within-modal--sticky-sentinel-top--top: -1 * $ibo-vendors-jqueryui--ui-dialog-content--padding-y !default;
$ibo-panel-within-modal--sticky-sentinel-top--height: $ibo-vendors-jqueryui--ui-dialog-content--padding-y !default;

$ibo-panel-within-modal--header--top--is-sticky: -1 * $ibo-vendors-jqueryui--ui-dialog-content--padding-y !default;

.ui-dialog-content {
  /*
   * Careful: Here we get all the "descendants" instead of the first closest panel in the modal, which could cause some glitches in the future.
   * For now we decided to stay that way for the following reasons, if that changes in the future keep the repercussions on descendants panels in mind.
   * - We don't have nested sticky panels (yet)
   * - We don't want to hardcode the modal's markup selector if not necessary as it could change in the future (and is already different in read-only vs edition)
   * - Unlike in JS, there no easy way to find the closest descendant
   */
  .ibo-panel.ibo-has-sticky-header {
    /* Sticky header rules */
    > .ibo-sticky-sentinel-top {
      top: $ibo-panel-within-modal--sticky-sentinel-top--top;
      height: $ibo-panel-within-modal--sticky-sentinel-top--height;
    }
    > .ibo-panel--header.ibo-is-sticking {
        top: $ibo-panel-within-modal--header--top--is-sticky;
    }
  }
}