/**
 * Copyright © 2016-2019 The Thingsboard Authors
 *
 * 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.
 */
@import "~compass-sass-mixins/lib/compass";

@import "../../scss/constants";

$toolbar-height: 50px !default;
$fullscreen-toolbar-height: 64px !default;
$mobile-toolbar-height: 80px !default;
$half-mobile-toolbar-height: 40px !default;
$mobile-toolbar-height-total: 84px !default;

tb-dashboard-toolbar {
  md-fab-toolbar {
    &.md-is-open {
      md-fab-trigger {
        .md-button {
          &.md-fab {
            opacity: 1;

            transition: opacity .3s cubic-bezier(.55, 0, .55, .2);

            .md-fab-toolbar-background {
              background-color: $primary-default !important;
            }
          }
        }
      }
    }

    md-fab-trigger {
      .md-button {
        &.md-fab {
          width: 36px;
          height: 36px;
          margin: 4px 0 0 4px;
          line-height: 36px;
          opacity: .5;

          transition: opacity .3s cubic-bezier(.55, 0, .55, .2) .2s;

          md-icon {
            position: absolute;
            top: 25%;
            width: 18px;
            min-width: 18px;
            height: 18px;
            min-height: 18px;
            margin: 0;
            line-height: 18px;
          }
        }
      }
    }

    &.is-fullscreen {
      &.md-is-open {
        md-fab-trigger {
          .md-button {
            &.md-fab {
              .md-fab-toolbar-background {
                transition-delay: 0ms !important;
                transition-duration: 0ms !important;
              }
            }
          }
        }
      }

      .md-fab-toolbar-wrapper {
        height: $mobile-toolbar-height-total;

        @media (min-width: $layout-breakpoint-sm) {
          height: $fullscreen-toolbar-height;
        }

        md-toolbar {
          height: $mobile-toolbar-height;
          min-height: $mobile-toolbar-height;

          @media (min-width: $layout-breakpoint-sm) {
            height: $fullscreen-toolbar-height;
            min-height: $fullscreen-toolbar-height;
          }
        }
      }
    }

    .md-fab-toolbar-wrapper {
      height: $mobile-toolbar-height-total;

      @media (min-width: $layout-breakpoint-sm) {
        height: $toolbar-height;
      }

      md-toolbar {
        height: $mobile-toolbar-height;
        min-height: $mobile-toolbar-height;

        @media (min-width: $layout-breakpoint-sm) {
          height: $toolbar-height;
          min-height: $toolbar-height;
        }

        md-fab-actions {
          margin-top: 0;
          font-size: 16px;

          @media (max-width: $layout-breakpoint-sm) {
            height: $mobile-toolbar-height;
            max-height: $mobile-toolbar-height;
          }

          .close-action {
            margin-right: -18px;
          }

          .md-fab-action-item {
            width: 100%;
            height: $mobile-toolbar-height;

            @media (min-width: $layout-breakpoint-sm) {
              height: 46px;
            }

            .tb-dashboard-action-panels {
              flex-direction: column-reverse;
              height: $mobile-toolbar-height;

              @media (min-width: $layout-breakpoint-sm) {
                height: 46px;
              }

              @media (min-width: $layout-breakpoint-sm) {
                flex-direction: row-reverse;
              }

              .tb-dashboard-action-panel {
                flex-direction: row-reverse;
                min-width: 0;
                height: $half-mobile-toolbar-height;

                @media (min-width: $layout-breakpoint-sm) {
                  height: 46px;
                }

                div {
                  height: $half-mobile-toolbar-height;

                  @media (min-width: $layout-breakpoint-sm) {
                    height: 46px;
                  }
                }

                md-select {
                  pointer-events: all;
                }

                tb-states-component {
                  pointer-events: all;
                }

                button.md-icon-button {
                  min-width: 40px;

                  @media (max-width: $layout-breakpoint-sm) {
                    min-width: 28px;
                    padding: 2px;
                    margin: 0;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
