@import '../../style/themes/index';
@import '../../style/mixins/index';

@yee-layout-prefix-cls: ~'@{yee-prefix}-layout';

.@{yee-layout-prefix-cls} {
  display: flex;
  flex: auto;
  flex-direction: column;
  /* fix firefox can't set height smaller than content on flex item */
  min-height: 0;
  background: @yee-layout-body-background;

  &,
  * {
    box-sizing: border-box;
  }

  &&-has-sider {
    flex-direction: row;
    > .@{yee-layout-prefix-cls},
    > .@{yee-layout-prefix-cls}-content {
      overflow-x: hidden;
    }
  }

  &-header,
  &-footer {
    flex: 0 0 auto;
  }

  &-header {
    height: @yee-layout-header-height;
    padding: @yee-layout-header-padding;
    line-height: @yee-layout-header-height;
    background: @yee-layout-header-background;
  }

  &-footer {
    padding: @yee-layout-footer-padding;
    color: @yee-text-color;
    font-size: @yee-font-size-base;
    background: @yee-layout-footer-background;
  }

  &-content {
    flex: auto;
    /* fix firefox can't set height smaller than content on flex item */
    min-height: 0;
  }

  &-sider {
    position: relative;

    /* fix firefox can't set width smaller than content on flex item */
    min-width: 0;
    background: @yee-layout-sider-background;
    transition: all 0.2s;

    &-children {
      height: 100%;
      margin-top: -0.1px;
      // Hack for fixing margin collaspe bug
      // https://github.com/ant-design/ant-design/issues/7967
      // solution from https://stackoverflow.com/a/33132624/3040605
      padding-top: 0.1px;
    }

    &-has-trigger {
      padding-bottom: @yee-layout-trigger-height;
    }

    &-right {
      order: 1;
    }

    &-trigger {
      position: fixed;
      bottom: 0;
      z-index: 1;
      height: @yee-layout-trigger-height;
      color: @yee-layout-trigger-color;
      line-height: @yee-layout-trigger-height;
      text-align: center;
      background: @yee-layout-trigger-background;
      cursor: pointer;
      transition: all 0.2s;
    }

    &-zero-width {
      & > * {
        overflow: hidden;
      }

      &-trigger {
        position: absolute;
        top: @yee-layout-header-height;
        right: -@yee-layout-zero-trigger-width;
        z-index: 1;
        width: @yee-layout-zero-trigger-width;
        height: @yee-layout-zero-trigger-height;
        color: @yee-layout-trigger-color;
        font-size: @yee-layout-zero-trigger-width / 2;
        line-height: @yee-layout-zero-trigger-height;
        text-align: center;
        background: @yee-layout-sider-background;
        border-radius: 0 @yee-border-radius-base @yee-border-radius-base 0;
        cursor: pointer;
        transition: background 0.3s ease;

        &:hover {
          background: tint(@yee-layout-sider-background, 10%);
        }

        &-right {
          left: -@yee-layout-zero-trigger-width;
          border-radius: @yee-border-radius-base 0 0 @yee-border-radius-base;
        }
      }
    }
  }
}

@import './light';
