// (C) Copyright 2020 Hewlett-Packard Enterprise Company, L.P.

@mixin dialog_header() {
  position: absolute;
  top: 0px;
  left: 0px;
  right: 0px;
  height: $banner-height;
  line-height: $banner-height;
  white-space: nowrap;
  font-family: 'HPRegular', Arial, Helvetica, sans-serif;
  background-color: $secondary-background;
  border-bottom: 1px solid $primary-divider;
  @include box-sizing(border-box);
  
  > * {
    display: inline-block;
    vertical-align: top;
    margin-right: -4px;

    &:last-child {
      margin-right: 0px;
    }
  }
  
  h1 {
    font-size: 24px;
    font-weight: normal;
    line-height: $banner-height;
    margin: 0px 10px 0px 30px;
    padding-right: 0px;
    overflow-x: hidden;
    text-overflow: ellipsis;
    font-family: 'HPRegular', Arial, Helvetica, sans-serif;
    
    span {
      text-overflow: ellipsis;
      display: inline-block;
      overflow: hidden;
      white-space: nowrap;
      height: $banner-height - 12px;
      line-height: $subnav-height - 2px;
      margin-top: 12px;
    }
    
    .hp-name {
      font-family: 'HPLight', Arial, Helvetica, sans-serif;
      padding-left:6px;
    }
  }
  
  .hp-panel-selector {
    position: relative;
    top: 9px;
    font-size: 22px;
    height: 42px;
    line-height: 42px;
    border-left: 1px solid $primary-divider;
    border-right: 1px solid $primary-divider;
    color: $secondary-color;
    font-family: 'HPRegular', Arial, Helvetica, sans-serif;
    
    > label {
      line-height: 40px;
      height: 40px;
      position: relative;
      right: 0px;
      left:1px;
    }
    
    > .hp-value {
      font-family: 'HPLight', Arial, Helvetica, sans-serif;
      padding-right: 25px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      
      &:after {
        content: '';
        width: 30px;
        background-image: $select-down-link-url;
        background-position: 5px -4px;
        position: absolute;
        right: -5px;
        top: 15px;
      }
    }
    
    .hp-options li {
      height: 36px;
      line-height: 36px;
      
      &.hp-sub-options {
        height: auto;
      }
    }
    
    &:hover {
      > .hp-value {
        color: #000;
        
        &:after {
          content: '';
          background-image: $select-down-over-url;
        }
      }
    }
  }
  
  > .hp-controls, > .hp-details-header-controls {
    position: absolute;
    top: 0px;
    right: 0px;
    height: 100%;
    
    .hp-help-current {
      position: relative;
      display: inline-block;
      cursor: pointer;
      width: $banner-height - 11;
      height: 100%;
      line-height: $banner-height - 11;
    
      .hp-icon {
        position: relative;
        top: 20px;
        left: 18px;
        width: 20px;
        height: 20px;
        background-image: url($img-file);
        background-repeat: no-repeat;
        background-position: $help-x -20px;
      }
      &:hover {
        background-color: $primary-background;
      }
    }
  }
}

#hp-overlay, #hp-dialog-overlay, .ui-widget-overlay, .hp-dialog-overlay {
  position: absolute;
  top: 0px;
  bottom: 0px;
  left: 0px;
  right: 0px;
  display: none;
  
  &.hp-active {
    display: block;
  }
}

#hp-overlay, .hp-overlay {
  background-color: rgba(255, 255, 255, 0.6);
  z-index: ($change-container-z-index - 1);
  
  &.hp-changing {
    background-color: rgba(0, 0, 0, 0.6);
    
    body.hp-basic-layout & {
      background-color: rgba(208, 208, 208, 0.6);
    }
  }
  
  @media print {
    background-color: transparent;
  }
}

#hp-dialog-overlay, .ui-widget-overlay, .hp-dialog-overlay {
  background-color: rgba(0, 0, 0, 0.6);
  z-index: ($dialog-z-index - 1);
  
  @media print {
    background-color: transparent;
  }
}

.ui-widget-overlay {
  display: block;
}

.hp-modal-overlay {
  background:#ffffff none repeat scroll 0 0;
  display:none;
  height:100%;
  left:0;
  filter:alpha(opacity=50);
  opacity: 0.5;
  top:0;
  width:100%;
  z-index: ($dialog-z-index - 1);
  display:none;
  position:fixed;
}

.hp-modal {
  position:absolute;
  left:20%;
  right:20%;
  top:20%;
  margin-left: auto;
  margin-right: auto;
  z-index: $dialog-z-index;
  
  > * {
    margin: 0px auto;
  }
}

// need this so IE9 can center the actual container
#hp-change-page-container-wrapper {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 10px;
  right: 10px;
  
  body.hp-basic-layout & {
    top: 30px;
    bottom: 30px;
    left: 30px;
    right: 30px;
  }
  
  @media print {
    @include print-position();
  }
}

// need this so IE9 can center the actual container
#hp-dialog-container-wrapper, .hp-dialog-container-wrapper {
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 20px;
  right: 20px;
  text-align: center;
  
  @media print {
    @include print-position();
  }
}

#hp-dialog-container, .hp-dialog-container {
  max-width: 920px;
  min-width: 300px;
  margin: 0px auto;
  background-color: $primary-background;
  color: $primary-color;
  z-index: $dialog-z-index;
  display: none;
  text-align: left;

  &.hp-active {
    display: inline-block;
  }
  
  @media print {
    @include print-position();
    border-left: 20px solid $secondary-background;
    border-right: 20px solid $secondary-background;
  }
}

.hp-dialog {
  position: relative;
  padding-top: $banner-height;
  padding-bottom: $form-footer-height;
  @include box-sizing(border-box);
  overflow: hidden;
  
  > header {
    @include dialog_header();
  }
  
  footer {
    position: absolute;
    bottom: 0px;
    left: 0px;
    right: 0px;
    height: $form-footer-height;
    line-height: $form-footer-height;
    border-top: 1px solid #d9d9d9;
    white-space: nowrap;
    @include box-sizing(border-box);
    
    .hp-spinner {
      position: absolute;
      left: 0px;
      top: 0px;
      display: inline-block;
      width: auto;
      margin: 7px 10px;
      .hp-spinner-image {
        margin: 0px;
      }
    }
    
    .hp-control-message {
      display: block;
      vertical-align: top;
      color: $secondary-color;
      white-space: nowrap;
      overflow-x: hidden;
      text-overflow: ellipsis;
      padding: 0px 15px;
      @include box-sizing(border-box);
      
      &.hp-error {
        background-color: $attention-background;
        border-right: 1px solid $primary-divider;
      }
    }
    
    .hp-controls {
      position: absolute;
      right: 0px;
      top: 0px;
      padding: 0px 30px;
      white-space: nowrap;
      
      > * {
        margin-left: 5px;
      }
    }
  }
  
  .hp-dialog-variable-contents {
    margin: 0px;
    padding: 15px 30px 20px 30px;
    overflow-y: auto;
    overflow-x: hidden;
    @include box-sizing(border-box);
    
    .hp-dialog-notification:last-child {
      margin-bottom: 0px;
    }
    
    &.hp-stacked-panels {
      padding: 0px;
    }
  }
  
  > .hp-dialog-notification {
    margin: 15px 30px 20px 30px;
  }
  
  .hp-prompt {
    margin: 10px 0px 10px 0px;
    font-weight: bold;
  }
  
  > .hp-prompt {
    margin: 10px 30px 20px 30px;
  }
  
  p {
    max-width: 460px;
  }
  
  .hp-notify {
    display: block;
    margin: 0px auto 20px auto;
    height: auto;
    width: auto;
    color: $primary-color;
  }
  
  .hp-collapsible {
    margin: 10px auto;
    
    label {
      span:first-child {
        font-size: 14px;
      }
    }
  }
  
  .hp-dependencies {
    line-height: 16px;
    margin-bottom: 0px;
    margin-left: 15px;
    max-height: 200px;
    overflow-y: auto;
  }
  
  .hp-add-form, .hp-edit-form {
    //position: static;
    > footer {
      bottom: -60px;
    }
  }
  
  .hp-stacked-panel {
    > label {
      @include box-sizing(border-box);
      padding: 10px 30px;
      color: #000;
      border-color: #e6e6e6;
    }
    
    @media print {
      height: auto !important;
      padding-top: 10px !important;
    }
  }
  
  .hp-filters {
    position: relative;
    
    .hp-search {
      width: 100%;
      padding-right: 30px;
    }
    
    .hp-search-icon {
      position: absolute;
      top: 8px;
      right: 7px;
      width: 15px;
      height: 16px;
      background-image: url($img-file);
      background-position: -120px -120px;
      background-repeat: no-repeat;
    }
  }
  
  .hp-column-form {
    min-width: 600px;
  }
}

#hp-change-page-container {
  position: relative;
  top: 0px;
  bottom: 0px;
  height: 100%;
  max-width: 960px;
  min-width: 400px;
  margin: 0px auto;
  background-color: $primary-background;
  color: $primary-color;
  z-index: $change-container-z-index;
  display: none;
  overflow: hidden;

  &.hp-active {
    display: block;
  }
  
  .hp-details-header {
    @include dialog_header();
  }
  
  .hp-stacked-panel {
    > label {
      @include box-sizing(border-box);
      padding: 10px 30px;
      color: #000;
      border-color: #e6e6e6;
    }
    
    @media print {
      height: auto !important;
      padding-top: 10px !important;
    }
  }
  
  @media print {
    @include print-position();
  }
}

// jQueryUI dialog, deprecated
.ui-dialog {
  background-color: $primary-background;
  color: $primary-color;
  @include box-shadow(3px, 3px, 12px, 0px, #999);
  padding: 0px;
  max-width: 600px;
  border: none;
  border-radius: 0px;
  
  html.hp-high-contrast & {
    color: $projection-color;
  }
  
  .ui-dialog-titlebar {
    position: relative;
    background-color: $secondary-background;
    border-bottom: 1px solid $primary-divider;
    padding: 10px 20px;
    font-size: 16px;
    
    .ui-dialog-titlebar-close {
      position: absolute;
      top: 7px;
      right: 7px;
      width: 11px;
      height: 11px;
      margin: 0px;
      background-image: url($img-file);
      background-position: $close-x -20px;
      background-repeat: no-repeat;

      &:hover {
        background-position: $close-x 0px;
      }
      
      .ui-icon {
        display: none;
      }
    }
  }
  
  &.hp-response-dialog {
    // dialog contains controls to dismiss it
    .ui-dialog-titlebar-close {
      display: none;
    }
  }
  
  .ui-dialog-content {
    margin: 0px;
    padding: 30px;
    background-color: inherit;
    
    .hp-progress {
      width: 100%;
    }
    
    > * {
      margin: 15px 0px;
      
      &:first-of-type {
        margin-top: 0px;
      }
      &:last-of-type {
        margin-bottom: 0px;
      }
    }
  }
  
  &.hp-simple-dialog {
    .ui-dialog-titlebar {
      display: none;
    }
    .ui-dialog-content {
      margin: 20px 0px;
    }
    .hp-controls {
      margin-top: 20px;
      text-align: right;
    }
  }
  
  &.hp-splash-dialog {
    .ui-dialog-titlebar {
      display: none;
    }
    .ui-dialog-content {
      margin: 40px;
    }
  }
  
  .ui-dialog-buttonpane {
    padding: 10px;
    padding-bottom: 15px;
    
    .ui-dialog-buttonset {
      text-align: right;
    }
    
    button {
      margin-left: 10px;
    }
  }
}

.hp-dialog-button-stack {
  margin-bottom: 0px;
  li {
    display: table;
    margin-bottom: 15px;
    &:last-of-type {
      margin-bottom: 0px;
    }
    > * {
      display: table-cell;
    }
    button {
      width: 190px;
      cursor: pointer;
    }
    label {
      padding-left: 20px;
    }
  }
}

// where did this come from? needs cleanup
.hp-dialog-remote-console-verification {
  .float-left-div {
    line-height: 28px;
    float: left;
  }
  .float-right-div {
    float: right;
  }
  .centered-text-div {
    text-align: center;
  }
}
