/*
 * Copyright (c) 2021 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
 */

@import "../variables";

.toggle {
  display: flex;
  flex-direction: column;
}

.toggle.disabled .toggle-handle {
  cursor: default;
}

.toggle-bar {
  position: relative;
  font-family: sans-serif;
  display: flex;
  flex-direction: row;
  min-width: 28px;
  border-radius: 8px;
  height: 16px;
}

.toggle-bar-primary {
  background: $gray-700;
}

.toggle-bar-primary-toggled {
  background: $primary;
}

.toggle-bar-secondary {
  background: $gray-300;
}

.toggle-bar-secondary-toggled {
  background: $primary;
}

.toggle-handle {
  position: absolute;
  transform: translate3d(0px, 0, 0);
  top: 2px;
  left: 2px;
  height: 12px;
  width: 12px;
  transition: all 0.2s ease;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2);
}

.toggle-handle-toggled {
  transform: translate3d(12px, 0, 0);
  transition: all 0.1s ease;
  transition-property: transform;
}

.toggle-handle-primary {
  background: $gray-300;
}

.toggle-handle-primary-toggled {
  background: $white;
}

.toggle-handle-secondary {
  background: $gray-700;
}

.toggle-handle-secondary-toggled {
  background: $white;
}

.toggle label {
  display: flex;
  flex: 1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
  margin-right: -0.5rem;
}

.toggle label > * {
  margin-right: 0.5rem;
}

.toggle-label {
  font-size: 0.8rem;
  white-space: pre-wrap;
}

.toggle-label-rest {
  text-align: end;
}

.toggle input {
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  position: absolute;
}
