@import "bootstrap/scss/mixins/buttons";
@import "variables";
@import "themes";

$link-decoration: none;
$dark-bootstrap-theme: map-get($dark-theme, bootstrap);
$light-bootstrap-theme: map-get($light-theme, bootstrap);

$dark-theme-input: map-get($dark-theme, input);
$light-theme-input: map-get($light-theme, input);

$btn-font-weight: 500;
$font-family-base: $font-family-base;

// BUTTONS
//override bootstrap
$btn-focus-box-shadow: none;
$btn-active-box-shadow: none;
$input-btn-focus-color: none;
$btn-focus-width: 0;
$btn-font-family: $font-family-base;

// ----------------------------------------------
//                  DARK THEME
// ----------------------------------------------

.dark-theme {
  $primary: map-get($dark-bootstrap-theme, primary);
  $input-color: map-get($dark-theme-input, color);
  $input-placeholder-color: map-get($dark-theme-input, place-holder-color);
  $input-bg: map-get($dark-theme-input, background-color);
  //$input-disabled-bg: map-get($dark-theme-input, background-color-disabled);
  $input-border-radius: map-get($dark-theme-input, border-radius);
  $input-border-color: map-get($dark-theme-input, border-color);
  $input-border-width: map-get($dark-theme-input, border-width);
  $input-focus-color: map-get($dark-theme-input, focus-color);
  $input-focus-border-color: map-get($dark-theme-input, focus-border-color);
  $input-height: map-get($light-theme-input, height);
  $link-hover-color: $blue-200;
  $link-color: $blue-300;
  $link-decoration: none;
  $label-margin-bottom: 0;

  $button: map-get($dark-theme, button);

  --bs-border-width: 1px;


  // @import '~bootstrap/scss/bootstrap.scss';
  @import 'bootstrap/scss/bootstrap-reboot';
  @import 'bootstrap/scss/bootstrap-grid';
  @import 'bootstrap/scss/bootstrap-utilities';
  @import "bootstrap/scss/buttons";
  @import "bootstrap/scss/button-group";
  @import "bootstrap/scss/card";

  label {
    display: inline-flex;
  }

  .btn {
    font-size: 12px;
    line-height: normal;
    letter-spacing: 0.03em;
    padding: 6px 12px;
    border-radius: 4px;
    transition: opacity 0.2s ease-in;
  }

  .btn-neon {
    @include button-variant(
      $neon-yellow,
      $neon-yellow,
      $color: $blue-500,
      $hover-background: $neon-yellow-hover,
    );
    font-weight: 500;
    &:not(.narrow) {
      height: 32px;
      padding: 0 32px;
    }
  }

  .btn-dark-fill {
    @include button-variant(
      $blue-600,
      $blue-600,
      $color: $blue-280,
      $hover-background: $blue-500,
      $hover-border: $blue-500,
      $hover-color: $white,
      $active-background: $purple,
      $active-border: $purple,
      $active-color: $white,
      $disabled-background: $grey-purple,
      $disabled-border: $grey-purple,
      $disabled-color: $white
    );
    --bs-btn-border-width: 0;
    height: 32px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;

    &:disabled {
      cursor: auto;
      pointer-events: none !important;
    }
  }

  .btn-cml-primary {
    @include button-variant(
      map-get($button, background-color),
      map-get($button, border-color),
      $color: map-get($button, color),
      $hover-background: map-get($button, background-color-hover),
      $hover-border: map-get($button, border-color-hover),
      $hover-color: $blue-200,
      $active-background: map-get($button, background-color-focus),
      $active-border: map-get($button, border-color-focus)
    );
    &:focus {
      background-color: $blue-600;
      border-color: $blue-600;
      color: $blue-300;
      &:hover {
        background-color: $blue-500;
        border-color: $blue-500;
        color: $blue-200;
      }
    }
  }

  .btn:disabled {
    opacity: 0.4;
  }

  .form-control {
    display: block;
    width: 100%;
    height: 32px;
    padding: .375rem .75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: $blue-200;
    background-color: $black;
    background-clip: padding-box;
    border: 1px solid $blue-500;
    border-radius: 4px;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;

    &:disabled {
      background-color: $black;
    }

    &:hover {
      border-color: $blue-400
    }

    &:hover:focus {
      border-color: $blue-300
    }
  }

  .btn-outline-neon {
    height: 32px;
    border-radius: 4px;
    font-weight: 500;
    background-color: $white;
    border: solid 1px $neon-yellow;
    padding: 0 32px;
    font-size: 12px;
    color: $blue-500;
    box-shadow: none !important;

    &:hover {
      background-color: #f8f9fa; // TODO: ask brio.
      border: solid 1px $neon-yellow-hover;
    }

    &:focus {
      background-color: #f8f9fa;
      border: solid 1px $neon-yellow-hover;
    }
  }

  .btn-outline-dark {
    border-color: $blue-600;
    color: $blue-300;
    background-color: transparent;
    &:hover {
      color: $blue-200;
      border-color: $blue-500;
      background-color: $blue-500;
    }
  }

  .btn.btn-icon {
    color: $blue-300;
    &:hover {
      background-color: $blue-500;
    }
  }

  .btn-link {
    color: $blue-300;
    &:hover {
      color: $blue-200;
      text-decoration: underline;
    }
  }

}


// ----------------------------------------------
//                  LIGHT THEME
// ----------------------------------------------

.light-theme {
  $primary: map-get($light-bootstrap-theme, primary);
  $secondary: $white;

  $input-color: map-get($light-theme-input, color);
  $input-placeholder-color: map-get($light-theme-input, place-holder-color);
  $input-bg: map-get($light-theme-input, background-color);
  //$input-disabled-bg: map-get($light-theme-input, background-color-disabled);
  $input-border-radius: map-get($light-theme-input, border-radius);
  $input-border-color: map-get($light-theme-input, border-color);
  $input-border-width: map-get($light-theme-input, border-width);
  $input-focus-color: map-get($light-theme-input, focus-color);
  $input-focus-border-color: map-get($light-theme-input, focus-border-color);
  $input-active-border-color: map-get($light-theme-input, focus-border-color);
  $input-focus-box-shadow: map-get($light-theme-input, focus-box-shadow);
  $input-focus-bg: map-get($light-theme-input, focus-bg);
  $input-height: map-get($light-theme-input, height);
  $label-margin-bottom: 0;

  //@import '~bootstrap/scss/bootstrap.scss';
  @import 'bootstrap/scss/bootstrap-reboot';
  @import 'bootstrap/scss/bootstrap-grid';
  @import 'bootstrap/scss/bootstrap-utilities';
  @import "bootstrap/scss/grid";
  @import "bootstrap/scss/buttons";
  @import "bootstrap/scss/button-group";
  @import "bootstrap/scss/card";

  --bs-border-width: 1px;

  .btn {
    font-size: 12px;
    line-height: normal;
    letter-spacing: 0.03em;
    border-radius: 4px;
  }

  .btn-primary {
    color: map-get($light-bootstrap-theme, primary-font-color) !important;

    &:focus {
      background-color: $primary;
      border-color: $primary;
    }
  }

  .btn-cml-primary {
    @include button-variant(
      $primary,
      $primary,
    );
    &:focus {
      background-color: $blue-100;
      border-color: $blue-100;
      color: $blue-500;
      &:hover {
        background-color: $blue-100;
        border-color: $blue-100;
        color: $blue-500;
      }
    }
  }

  .btn-secondary {
    height: 36px;
    border: solid 1px $cloudy-blue;
    color: $blue-500;
    font-size: 12px;

    &:hover {
      border: solid 1px $cloudy-blue-two;
      color: $blue-600;
      background-color: $white;
    }

    &:active,
    &:focus {
      border: solid 1px $blue-400 !important;
      color: $blue-600 !important;
      background-color: white !important;
      box-shadow: none !important;
    }

    &:disabled {
      border-color: $blue-250;
      color: $blue-250;
      opacity: 0.4;
    }
  }

  .btn-dark-fill {
    @include button-variant(
      $grey-purple,
      $grey-purple,
      $color: $white,
      $hover-background: $blue-500,
      $hover-border: $blue-500,
      $hover-color: $white,
      $active-background: $purple,
      $active-border: $purple,
      $disabled-background: $grey-purple,
      $disabled-border: $grey-purple,
      $disabled-color: $white,
    );
    --bs-btn-border-width: 0;
    height: 32px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;

    &.terminal {
      --bs-btn-bg: #{$blue-600};
      color: $blue-280;
      padding: 0 12px;
      &:hover.enabled {
        color: $blue-200;
      }
    }

    &:disabled {
      cursor: auto;
      pointer-events: none !important;
    }
  }

  .btn-neon {
    @include button-variant(
      $neon-yellow,
      $neon-yellow,
      $color: $blue-500,
      $hover-background: $neon-yellow-hover,
    );
    font-size: 12px;
    font-weight: 500;
    &:not(.narrow) {
      height: 32px;
      padding: 0 32px;
    }
  }

  .btn-outline-neon {
    height: 32px;
    border-radius: 4px;
    font-weight: 500;
    background-color: $white;
    border: solid 1px $neon-yellow;
    padding: 0 32px;
    color: $blue-500;
    font-size: 12px;

    &:hover {
      background-color: #f8f9fa; // TODO: ask brio.
      border: solid 1px $neon-yellow-hover;
    }

    &:focus {
      background-color: #f8f9fa; // TODO: ask brio.
      border: solid 1px $neon-yellow-hover;
    }
  }

  .btn-link {
    color: $blue-300;
    &:hover {
      color: $blue-400;
      text-decoration: underline;
    }
  }


  .form-control {
    color: $blue-500;
    background-color: $white;
    border-color: $cloudy-blue-two;

    &:hover {
      border-color: $blue-300
    }

    &:hover:focus {
      border-color: $blue-400
    }
  }

  .btn.btn-icon {
    color: $blue-400;
    background-color: $blue-50;
    &:hover {
      color: $blue-500;
      background-color: $blue-100;
      &:not([disabled]) {
        color: $blue-500;
      }
    }
  }
}


/*  ALERT */
.ai-alert {
  max-width: 400px;

  i {
    margin-top: 1px;
  }
}

.btn.btn-icon {
  padding: 6px;
  border: none;
  line-height: 0;

  &:not([disabled]) {
    &:hover {
      color: $blue-100;
    }
  }

  &:focus {
    box-shadow: none;
  }

  &[disabled] {
    cursor: default;
  }
}
