/*
 * IMPORTANT:
 * In order to preserve the uniform grid appearance, all cell styles need to have padding, margin and border sizes.
 * No built-in (selected, editable, highlight, flashing, invalid, loading, :focus) or user-specified CSS
 * classes should alter those!
 */

.slickgrid-container {
  .slick-header-columns,
  .slick-header-column {
    background: $grid-header-background;
    // background-color: #EBECEE;
  }

  .slick-header-columns {
    border-bottom: 1px solid $grid-border-color;
    //background: linear-gradient(rgba(0,0,0,0) 60%, rgba(0,0,0,.1));
  }

  .slick-header-column {
    border-right: 1px solid $grid-border-color;
    border-bottom: 1px solid $grid-border-color;
  }

  .slick-header-column:hover {
    background: darken($grid-header-background, 2%);
  }

  .slick-header-column-active {
    background: darken($grid-header-background, 5%) !important;
  }

  .slick-headerrow {
    background: $grid-header-background;
  }

  .slick-headerrow-column {
    background: #fafafa;
    border-bottom: 0;
  }

  .grid-canvas {
    background: white;
  }

  .slick-row {
    background: white;
    border: 0;
    line-height: 20px;

    .slick-cell {
      background: white;

      padding-top: $cell-padding-top;
      padding-bottom: $cell-padding-bottom;
      padding-left: $cell-padding-left;
      padding-right: $cell-padding-right;
      box-sizing: border-box;

      &.invalid {
        border-color: red;
        -moz-animation-duration: 0.2s;
        -webkit-animation-duration: 0.2s;
        -moz-animation-name: slickgrid-invalid-hilite;
        -webkit-animation-name: slickgrid-invalid-hilite;
      }

      &.selected {
        background-color: $grid-cell-selected-color;
      }

      &.active {
        border-color: rgba(0, 0, 0, .3);
        border-style: solid;
        border-width: 1px;

        // We compensate for the all-around border (now 1px at top and left too!) by reducing the padding
        padding-top: 2px;
        padding-left: 3px;

        input.editor-text {
          position: absolute;
          width: 100%;
          height: 100%;
          border: 0;
          margin: 0;
          background: transparent;
          padding: 2px 3px 2px 3px;
          transform: translate(-3px, -2px);
        }

      }
    }

    &.odd .slick-cell {
      background: darken($grid-cell-color, 2%);

      // make sure we override the regular background color:
      &.selected {
        background-color: $grid-cell-selected-color;
      }
    }

    &.active-row .slick-cell {
      background-color: rgb(226, 255, 253);

      // make sure we override the regular background color:
      &.selected {
        background-color: $grid-cell-selected-color;
      }
    }

    &.active-row.odd .slick-cell {
      background-color: rgb(226, 255, 253);

      // make sure we override the regular background color:
      &.selected {
        background-color: green;
      }
    }

    &.loading {
      opacity: 0.5;
    }
  }

  .slick-group {
    border-bottom: 2px solid silver;
  }

  .slick-group-toggle {
    width: 9px;
    height: 9px;
    margin-right: 5px;

    &.expanded {
      background: url('../images/collapse.gif') no-repeat center center;
    }

    &.collapsed {
      background: url('../images/expand.gif') no-repeat center center;
    }
  }

  .slick-group-totals {
    color: gray;
    background: white;
  }

  .slick-sortable-placeholder {
    background: silver !important;
  }

  @-moz-keyframes slickgrid-invalid-hilite {
    from {
      box-shadow: 0 0 6px red;
    }
    to {
      box-shadow: none;
    }
  }

  @-webkit-keyframes slickgrid-invalid-hilite {
    from {
      box-shadow: 0 0 6px red;
    }
    to {
      box-shadow: none;
    }
  }

  // ----------------------------------------------
  // Excel-like header
  // ----------------------------------------------

  .slick-header-menubutton {
    background-position: center center;
    background-repeat: no-repeat;
    border-left: thin ridge silver;
    cursor: pointer;
    display: inline-block;
    position: absolute;

    // The next few items are already defined in the slick-headermenu.scss file and it should stay that way, *unless* you also replace the button image included there.
    //bottom: 0;
    //right: 0;
    //top: 0;
    //width: 14px;
  }

  .slick-header-menu {
    background: none repeat scroll 0 0 white;
    border: 1px solid #BFBDBD;
    min-width: 175px;
    padding: 4px;
    z-index: 100000;
    cursor: default;
    display: inline-block;
    margin: 0;
    position: absolute;

    button {
      border: 1px solid #BFBDBD;
      background-color: white;
      width: 45px;
      padding: 4px;
      margin: 4px 4px 4px 0;
    }

    .filter {
      border: 1px solid #BFBDBD;
      font-size: 8pt;
      height: 400px;
      margin-top: 6px;
      overflow: scroll;
      padding: 4px;
      white-space: nowrap;
      width: 200px;
    }

    .textfilter {
      & > label {
        display: inline-block;
        margin-left: 5px;
        margin-right: 10px;
      }

      & > input[type=text] {
        width: 70%;
      }
    }
  }

  label {
    display: block;
    margin-bottom: 5px;
  }

  .slick-header-menuitem {
    border: 1px solid transparent;
    padding: 2px 4px;
    cursor: pointer;
    list-style: none outside none;
    margin: 0;
  }

  .slick-header-menuicon {
    background-position: center center;
    background-repeat: no-repeat;
    display: inline-block;
    height: 16px;
    margin-right: 4px;
    vertical-align: middle;
    width: 16px;
  }

  .slick-header-menucontent {
    display: inline-block;
    vertical-align: middle;
  }

  .slick-header-menuitem:hover {
    border-color: #BFBDBD;
  }

  .header-overlay,
  .cell-overlay,
  .selection-cell-overlay {
    display: block;
    position: absolute;
    z-index: 999;
  }

  .slick-cell > .editor-select {
    position: absolute;
    left: 0;
    right: 0;
    width: auto;
    top: 0;
    bottom: 0;
    max-width: 100%;
    min-width: 0;
    margin: 0;
  }

  .slick-range-decorator {
    z-index: 100;
    pointer-events: none;
    background: transparent;
    border: none;
    outline: black;
  }
}

div.slick-large-editor-text {
  z-index: 10000;
  position: absolute;
  background: $grid-cell-color;
  padding: 5px;
  border: 1px solid rgba(0, 0, 0, .5);
  box-shadow: 1px 1px 2px 1px rgba(0, 0, 0, .3);
  textarea {
    backround: transparent;
    width: 250px;
    height: 80px;
    border: 0;
    outline: 0
  }
  div {
    text-align: right;
    button {
      background-color: darken($grid-cell-color, 10%);
      border: 1px solid $grid-border-color;
      cursor: pointer;
      justify-content: center;
      padding-left: 0.75em;
      padding-right: 0.75em;
      text-align: center;
      white-space: nowrap;
    }
  }
}
