/*!
 * Copyright (c) 2008-2016 Haulmont.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Cell border color of selected row
 */
$c-datagrid-selected-row-cell-border-color: #9bb3d3 !default;

/*
 * Header cell background color
 */
$c-datagrid-header-cell-background-color: #e6eaef !default;

/*
 * Header cell hover background color
 */
$c-datagrid-header-cell-hover-background-color: #f2f5f7 !default;

@mixin havana-datagrid($primary-stylename: v-grid) {

  .c-data-grid-composition {
    &.no-stripes {
      .#{$primary-stylename} .#{$primary-stylename}-body .#{$primary-stylename}-row-selected  > .#{$primary-stylename}-cell {
        color: $c-row-selection-text-color;

        @include linear-gradient(to bottom, $c-row-selection-background-color 0%, $c-row-selection-background-color 100%);
      }
    }
  }

  .#{$primary-stylename}-row-selected > .#{$primary-stylename}-cell {
    background-color: $c-row-selection-background-color;
    border-color: $c-datagrid-selected-row-cell-border-color;
    color: $c-row-selection-text-color;

    @include linear-gradient(to bottom, $c-row-selection-background-color 0%, $c-row-selection-background-color 100%);
  }

  .#{$primary-stylename}-body .#{$primary-stylename}-row-selected:hover > td {
    background-color: $c-row-selection-background-color;
    color: $c-row-selection-text-color;

    @include linear-gradient(to bottom, $c-row-selection-background-color 0%, $c-row-selection-background-color 100%);
  }

  .#{$primary-stylename}-header .#{$primary-stylename}-cell {
    @include linear-gradient(to bottom, $c-datagrid-header-cell-background-color 0%, $c-datagrid-header-cell-background-color 100%);
  }

  .#{$primary-stylename}-header:hover {
    .#{$primary-stylename}-cell:hover {
      background: $c-datagrid-header-cell-hover-background-color;
    }
  }

  .#{$primary-stylename}-cell .boolean-value-true {
    height: round($v-unit-size/2);
    width: round($v-unit-size/2);
    background: no-repeat left center;
    margin-left: $v-table-cell-padding-horizontal;
    background-image: url(images/checkbox-checked.png);

    &:before {
      content: none;
    }
  }

  .#{$primary-stylename}-cell .boolean-value-false {
    height: round($v-unit-size/2);
    width: round($v-unit-size/2);

    background: no-repeat left center;
    margin-left: $v-table-cell-padding-horizontal;
    background-image: url(images/checkbox-unchecked.png);

    &:before {
      content: none;
    }
  }
}