import { css } from 'lit'

export default css`
  :host {
    display: inline-block;
    vertical-align: middle;
    outline: none;
    -webkit-tap-highlight-color: transparent;

    --md-ripple-hover-state-layer-color: var(--md-sys-color-on-surface);
    --md-ripple-focus-state-layer-color: var(--md-sys-color-on-surface);
    --md-ripple-pressed-state-layer-color: var(--md-sys-color-primary);
  }

  .surface {
    position: relative;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
  }

  .container {
    border-radius: 2px;
    border: 2px var(--md-sys-color-on-surface) solid;
    background-color: transparent;

    position: absolute;
    inset: 11px 0px 0px 11px;

    width: 18px;
    height: 18px;

    box-sizing: border-box;

    transition:
      cubic-bezier(0.4, 0, 0.2, 1) border-radius 0.23s,
      cubic-bezier(0.4, 0, 0.2, 1) border-color 0.23s,
      cubic-bezier(0.4, 0, 0.2, 1) background-color 0.13s;
  }

  .icon {
    width: 18px;
    height: 18px;
    position: absolute;
    inset: 11px 0 0 11px;
  }

  .icon > svg {
    width: 18px !important;
    height: 18px !important;
  }

  .state {
    position: absolute;
    inset: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--md-sys-shape-corner-full);
  }

  .ripple {
    border-radius: var(--md-sys-shape-corner-full);
    z-index: 3;
  }

  :host([checked]) .container,
  :host([indeterminate]) .container {
    border-width: 0px;
    background-color: var(--md-sys-color-primary);
  }

  :host([checked]) .icon > svg,
  :host([indeterminate]) .icon > svg {
    fill: var(--md-sys-color-on-primary);
  }

  /* Invalid state */

  :host([invalid]) .container {
    border-color: var(--md-sys-color-error);
  }

  :host([checked][invalid]) .container,
  :host([indeterminate][invalid]) .container {
    border-color: transparent;
    background-color: var(--md-sys-color-error);
  }

  :host([checked][invalid]) .icon > svg,
  :host([indeterminate][invalid]) .icon > svg {
    fill: var(--md-sys-color-on-error);
  }

  /* Disabled state */

  :host([disabled]) {
    pointer-events: none;
  }

  :host([disabled]) .container {
    border-color: var(--md-sys-color-on-surface);
    border-width: 2px;
    opacity: 38%;
  }

  :host([checked][disabled]) .container,
  :host([indeterminate][disabled]) .container {
    background-color: var(--md-sys-color-on-surface);
    border-width: 0;
    opacity: 38%;
  }

  :host([checked][disabled]) .icon > svg,
  :host([indeterminate][disabled]) .icon > svg {
    fill: var(--md-sys-color-surface);
  }

  /* Hover state */

  /* :host(:hover) .state {
  background-color: var(--md-sys-color-on-surface);
  opacity: var(--md-sys-state-hover-state-layer-opacity);
} */

  /* :host([checked]:hover) .state,
:host([indeterminate]:hover) .state {
  background-color: var(--md-sys-color-primary);
  opacity: var(--md-sys-state-hover-state-layer-opacity);
} */

  :host(:hover) .container {
    border-color: var(--md-sys-color-on-surface);
    border-width: 2px;
  }

  :host([checked]:hover) .container,
  :host([indeterminate]:hover) .container {
    background-color: var(--md-sys-color-primary);
    border-width: 0px;
  }

  :host(:hover) .icon > svg {
    fill: var(--md-sys-color-on-primary);
  }

  :host([invalid]:hover) {
    --md-ripple-hover-state-layer-color: var(--md-sys-color-error);
    --md-ripple-focus-state-layer-color: var(--md-sys-color-error);
    --md-ripple-pressed-state-layer-color: var(--md-sys-color-error);
  }

  /* :host([invalid]:hover) .state {
  background-color: var(--md-sys-color-error);
  opacity: var(--md-sys-state-hover-state-layer-opacity);
} */

  :host([invalid]:hover) .container {
    border-color: var(--md-sys-color-error);
    border-width: 2px;
  }

  :host([checked][invalid]:hover) .container,
  :host([indeterminate][invalid]:hover) .container {
    background-color: var(--md-sys-color-error);
    border-width: 0px;
  }

  :host([checked][invalid]:hover) .icon > svg,
  :host([indeterminate][invalid]:hover) .icon > svg {
    fill: var(--md-sys-color-on-error);
  }

  /* Focus state */

  /* :host(:focus) .state {
  background-color: var(--md-sys-color-primary);
  opacity: var(--md-sys-state-focus-state-layer-opacity);
}

:host([checked]:focus) .state,
:host([indeterminate]:focus) .state {
  background-color: var(--md-sys-color-on-surface);
  opacity: var(--md-sys-state-focus-state-layer-opacity);
} */

  :host(:focus) .container {
    border-color: var(--md-sys-color-on-surface);
    border-width: 2px;
  }

  :host([checked]:focus) .container,
  :host([indeterminate]:focus) .container {
    background-color: var(--md-sys-color-primary);
    border-width: 0px;
  }

  :host(:focus) .icon > svg {
    fill: var(--md-sys-color-on-primary);
  }

  /* :host([invalid]:focus) .state {
  background-color: var(--md-sys-color-error);
  opacity: var(--md-sys-state-focus-state-layer-opacity);
} */

  :host([invalid]:focus) .container {
    border-color: var(--md-sys-color-error);
    border-width: 2px;
  }

  :host([checked][invalid]:focus) .container,
  :host([indeterminate][invalid]:focus) .container {
    background-color: var(--md-sys-color-error);
    border-width: 0px;
  }

  :host([checked][invalid]:focus) .icon > svg,
  :host([indeterminate][invalid]:focus) .icon > svg {
    fill: var(--md-sys-color-on-error);
  }

  /* Pressed state */

  /* :host(:active) .state,
:host .pressed .state {
  background-color: var(--md-sys-color-primary);
  opacity: var(--md-sys-state-pressed-state-layer-opacity);
}

:host([checked]:active) .state,
:host([checked]) .pressed .state,
:host([indeterminate]:active) .state,
:host([indeterminate]) .pressed .state {
  background-color: var(--md-sys-color-on-surface);
  opacity: var(--md-sys-state-pressed-state-layer-opacity);
} */

  :host(:active) .container,
  :host .pressed .container {
    border-color: var(--md-sys-color-on-surface);
    border-width: 2px;
  }

  :host([checked]:active) .container,
  :host([checked]) .pressed .container,
  :host([indeterminate]:active) .container,
  :host([indeterminate]) .pressed .container {
    background-color: var(--md-sys-color-primary);
    border-width: 0px;
  }

  :host([checked]:active) .icon > svg,
  :host([checked]) .pressed .icon > svg,
  :host([indeterminate]:active) .icon > svg,
  :host([indeterminate]) .pressed .icon > svg {
    fill: var(--md-sys-color-on-primary);
  }

  /* :host([invalid]:active) .state,
:host([invalid]) .pressed .state {
  background-color: var(--md-sys-color-error);
  opacity: var(--md-sys-state-pressed-state-layer-opacity);
} */

  :host([invalid]:active) .container,
  :host([invalid]) .pressed .container {
    border-color: var(--md-sys-color-error);
    border-width: 2px;
  }

  :host([checked][invalid]:active) .container,
  :host([checked][invalid]) .pressed .container,
  :host([indeterminate][invalid]:active) .container :host([indeterminate][invalid]) .pressed .container {
    background-color: var(--md-sys-color-error);
    border-width: 0px;
  }

  :host([checked][invalid]:active) .icon > svg,
  :host([checked][invalid]) .pressed .icon > svg,
  :host([indeterminate][invalid]:active) .icon > svg,
  :host([indeterminate][invalid]) .pressed .icon > svg {
    fill: var(--md-sys-color-on-error);
  }
`
