/*
 * Copyright (c) 2019-present Sonatype, Inc.
 * This program and the accompanying materials are made available under
 * the terms of the Eclipse Public License 2.0 which accompanies this
 * distribution and is available at https://www.eclipse.org/legal/epl-2.0/.
 */
@use '../../scss-shared/nx-focus-border-helpers';
@use '../../scss-shared/nx-radio-checkbox-helpers';

$-size: 16px;
$-checked-border-width: 4px;

.nx-radio {
  min-width: $-size;
}

.nx-radio__circle {
  background-color: var(--nx-color-component-background);
  border-radius: 50%;
  height: $-size;
  width: $-size;
}

.nx-radio__input {
  &:checked {
    &, &:hover {
      + .nx-radio__circle {
        @include nx-radio-checkbox-helpers.inset-box-shadow(var(--nx-color-radio-checkbox-selected), $-checked-border-width);
      }

      &:disabled + .nx-radio__circle {
        background-color: var(--nx-color-radio-disabled-checked-dot);
      }
    }
  }

  &:disabled {
    &, &:hover {
      + .nx-radio__circle {
        background-color: var(--nx-color-radio-disabled-dot);
        box-shadow:
          inset 0 0 0 1px var(--nx-color-radio-disabled-border),
          inset 0 0 0 #{$-checked-border-width} var(--nx-color-radio-disabled-ring);
      }
    }
  }
}

// Pseudo-element style is for the focus border
.nx-radio__focus {
  &::after{
    @include nx-focus-border-helpers.radio-checkbox-focus-border($-size, $-size);

    border-radius: 12px;
    left: -28px;
    top: -12px;
  }
}
