/*
The MIT License (MIT)

Copyright (c) 2017 akveo.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
 */
@import '../../styles/themes';
@import '~@nebular/theme/styles/global/bootstrap/hero-buttons';
@import '~bootstrap/scss/mixins/breakpoints';
@import '~@nebular/theme/styles/global/bootstrap/breakpoints';

@include nb-install-component() {
  .switch-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin: 0;

    &.vertical {
      flex-direction: column;
      align-items: flex-start;

      .first,
      .second {
        padding: 0;
      }

      .switch {
        margin-top: 0.5em;
      }
    }

    & > span {
      font-size: 1.125rem;
      font-weight: nb-theme(font-weight-bold);
      transition: opacity 0.3s ease;
      color: nb-theme(color-fg);

      &.first {
        @include nb-ltr(padding-right, 10px);
        @include nb-rtl(padding-left, 10px);
      }

      &.second {
        @include nb-ltr(padding-left, 10px);
        @include nb-rtl(padding-right, 10px);
      }

      &.active {
        color: nb-theme(color-fg-text);
      }

      @include nb-for-theme(cosmic) {
        color: nb-theme(color-fg);

        &.active {
          color: nb-theme(color-white);
        }
      }

      &:active {
        opacity: 0.78;
      }
    }
  }

  .switch {
    position: relative;
    display: inline-block;
    width: 3rem;
    height: 1.5rem;
    margin: 0;

    input {
      display: none;

      &:checked + .slider::before {
        @include nb-ltr(transform, translateX(1.5rem));
        @include nb-rtl(transform, translateX(-1.5rem));
      }
    }

    .slider {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      border-radius: 1.75rem;
      background-color: nb-theme(layout-bg);
    }

    .slider::before {
      position: absolute;
      content: '';
      height: 1.5rem;
      width: 1.5rem;
      border-radius: 50%;
      background-color: nb-theme(color-success);
      transition: 0.2s;

      box-shadow: 0 0 0.25rem 0 rgba(nb-theme(color-fg), 0.4);

      @include nb-for-theme(cosmic) {
        @include btn-hero-primary-gradient();
      }

      @include nb-for-theme(corporate) {
        background-color: nb-theme(color-primary);
      }
    }
  }

  @include media-breakpoint-down(xs) {
    align-items: flex-end;
  }
}
