/*
 * 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.
 *
 */

@mixin halo-cuba-fieldgrouplayout($primary-stylename: c-fglayout) {
  @include valo-gridlayout-global($primary-stylename);
  @include valo-gridlayout($primary-stylename);

  .#{$primary-stylename} {
    outline: none;
  }

  .#{$primary-stylename}-inline-caption .#{$primary-stylename}-spacing-on {
    padding-top: $v-layout-spacing-vertical/2;
  }

  .#{$primary-stylename}-slot > .v-caption {
    line-height: $v-line-height;

    .c-context-help-button {
      line-height: $v-line-height;
    }
  }

  .#{$primary-stylename}-slot.inline > .v-caption {
    margin-right: $v-layout-spacing-horizontal/2;
    line-height: $v-unit-size;
    vertical-align: middle;
  }

  .#{$primary-stylename}-slot.inline > .v-caption:not(.v-caption-inline-icon) {
    overflow: hidden;

    // replace margin-left with padding-left so that the padding value is taken into account when calculating
    // the caption width
    .v-icon + .v-captiontext {
      margin-left: 0;
      padding-left: ceil($v-unit-size/5);
    }
  }

  .#{$primary-stylename}-slot > .v-checkbox {
    top: round($v-unit-size/4);
  }

  .#{$primary-stylename}-slot.inline > .v-caption.caption-indicators {
    margin-right: 0;
    line-height: inherit;
  }

  .#{$primary-stylename}-slot.inline > .v-caption .v-captiontext {
    padding-bottom: 0;
  }

  .#{$primary-stylename}-slot.c-full-height-widget .v-caption .v-captiontext {
    line-height: $v-line-height;

    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;

    &.c-captiontext-preformatted {
      white-space: pre-wrap;
    }
  }
}