/* mixins & extensions */

@keyframes in {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}

@keyframes in-down {
  0% {
    opacity: 0;
    transform: translate3D(0, -5px, 0);
  }

  100% {
    opacity: 1;
    transform: translate3D(0, 0, 0);
  }
}

@keyframes in-up {
  0% {
    opacity: 0;
    transform: translate3D(0, 5px, 0);
  }

  100% {
    opacity: 1;
    transform: translate3D(0, 0, 0);
  }
}

@keyframes in-scale {
  0% {
    opacity: 0;
    transform: scale3D(0.95, 0.95, 1);
  }

  100% {
    opacity: 1;
    transform: scale3D(1, 1, 1);
  }
}

/**
* Currently only used in Checkbox.
*/

:root {
  --calcite-popper-transition: 150ms ease-in-out;
}

:host([hidden]) {
  display: none;
}

:host-context([theme=dark]) {
  --calcite-ui-blue-1: #00A0FF;
  --calcite-ui-blue-2: #0087D7;
  --calcite-ui-blue-3: #47BBFF;
  --calcite-ui-green-1: #36DA43;
  --calcite-ui-green-2: #11AD1D;
  --calcite-ui-green-3: #44ED51;
  --calcite-ui-yellow-1: #FFC900;
  --calcite-ui-yellow-2: #F4B000;
  --calcite-ui-yellow-3: #FFE24D;
  --calcite-ui-red-1: #FE583E;
  --calcite-ui-red-2: #F3381B;
  --calcite-ui-red-3: #FF7465;
  --calcite-ui-background: #202020;
  --calcite-ui-foreground-1: #2b2b2b;
  --calcite-ui-foreground-2: #353535;
  --calcite-ui-foreground-3: #404040;
  --calcite-ui-text-1: #ffffff;
  --calcite-ui-text-2: #bfbfbf;
  --calcite-ui-text-3: #9f9f9f;
  --calcite-ui-border-1: #4a4a4a;
  --calcite-ui-border-2: #404040;
  --calcite-ui-border-3: #353535;
  --calcite-ui-border-4: #757575;
  --calcite-ui-border-5: #9f9f9f;
  --calcite-ui-foreground-current: #214155;
}

:host {
  display: flex;
  justify-content: center;
  outline: none;
  color: var(--calcite-ui-text-3);
  cursor: pointer;
  width: calc(100% / 7);
  min-width: 0;
}

.day-v-wrapper {
  flex: 1 1 auto;
}

.day {
  display: flex;
  border-radius: 100%;
  font-size: 0.875rem;
  line-height: 1.5;
  justify-content: center;
  align-items: center;
  line-height: 1;
  color: var(--calcite-ui-text-3);
  transition: all 150ms ease-in-out;
  background: none;
  box-shadow: 0 0 0 2px transparent, 0 0 0 0px transparent;
  opacity: var(--calcite-ui-opacity-disabled);
}

.text {
  margin: 1px 0 0 1px;
}

:host([scale=s]) .day-v-wrapper {
  padding-top: 0.125rem;
  padding-bottom: 0.125rem;
}

:host([scale=s]) .day-wrapper {
  padding: 0;
}

:host([scale=s]) .day {
  height: 27px;
  width: 27px;
  font-size: var(--calcite-font-size--2);
}

:host([scale=m]) .day-v-wrapper {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

:host([scale=m]) .day-wrapper {
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

:host([scale=m]) .day {
  height: 33px;
  width: 33px;
  font-size: var(--calcite-font-size--1);
}

:host([scale=l]) .day-v-wrapper {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

:host([scale=l]) .day-wrapper {
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

:host([scale=l]) .day {
  height: 43px;
  width: 43px;
  font-size: var(--calcite-font-size-0);
}

:host([current-month]) .day {
  opacity: 1;
}

:host([disabled]) {
  cursor: default;
  opacity: 0.2;
}

:host(:hover:not([disabled])) .day,
:host([active]:not([range])) .day {
  background-color: var(--calcite-ui-foreground-2);
  color: var(--calcite-ui-text-1);
}

:host(:focus),
:host([active]) {
  z-index: 1;
}

:host(:focus:not([disabled])) .day {
  box-shadow: 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-blue-1);
}

:host([selected]) .day {
  background-color: var(--calcite-ui-blue-1) !important;
  color: var(--calcite-ui-foreground-1) !important;
  font-weight: 500;
  z-index: 1;
}

:host([range][selected]) .day-wrapper {
  background-color: var(--calcite-ui-foreground-current);
}

:host([start-of-range][dir=ltr]) .day-wrapper,
:host([end-of-range][dir=rtl]) .day-wrapper {
  border-top-left-radius: 40%;
  border-bottom-left-radius: 40%;
  box-shadow: inset 4px 0 var(--calcite-ui-foreground-1);
}

:host([start-of-range][dir=ltr]:not(:focus)) .day,
:host([end-of-range][dir=rtl]:not(:focus)) .day {
  box-shadow: 2px 0 var(--calcite-ui-foreground-1);
}

:host([end-of-range][dir=ltr]) .day-wrapper,
:host([start-of-range][dir=rtl]) .day-wrapper {
  border-top-right-radius: 40%;
  border-bottom-right-radius: 40%;
  box-shadow: inset -4px 0 var(--calcite-ui-foreground-1);
}

:host([end-of-range][dir=ltr]:not(:focus)) .day,
:host([start-of-range][dir=rtl]:not(:focus)) .day {
  box-shadow: -2px 0 var(--calcite-ui-foreground-1);
}

:host([end-of-range][scale=l][dir=ltr]) .day-wrapper,
:host([start-of-range][scale=l][dir=rtl]) .day-wrapper {
  box-shadow: inset -8px 0 var(--calcite-ui-foreground-1);
}

:host([highlighted]) .day-wrapper {
  background-color: var(--calcite-ui-foreground-current);
}

:host([highlighted]) .day-wrapper .day {
  color: var(--calcite-ui-text-1);
}

:host([highlighted]:not([active]:focus)) .day {
  border-radius: 0;
  color: var(--calcite-ui-text-1);
}

:host([range-hover]:not([selected])) .day-wrapper {
  background-color: var(--calcite-ui-foreground-2);
}

:host([range-hover]:not([selected])) .day {
  border-radius: 0;
}

:host([end-of-range][range-hover][dir=ltr]) .day-wrapper,
:host([start-of-range][range-hover][dir=rtl]) .day-wrapper {
  background-image: linear-gradient(to right, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));
  border-radius: 0;
  box-shadow: none;
}

:host([start-of-range][range-hover][dir=ltr]) .day-wrapper,
:host([end-of-range][range-hover][dir=rtl]) .day-wrapper {
  background-image: linear-gradient(to left, var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-current), var(--calcite-ui-foreground-2), var(--calcite-ui-foreground-2));
  border-radius: 0;
  box-shadow: none;
}

:host(:hover[range-hover]:not([selected]).focused--end[dir=ltr]) .day-wrapper,
:host(:hover[range-hover]:not([selected]).focused--start[dir=rtl]) .day-wrapper {
  border-top-right-radius: 40%;
  border-bottom-right-radius: 40%;
  box-shadow: inset -4px 0 var(--calcite-ui-foreground-1);
}

:host(:hover[range-hover]:not([selected]).focused--end[dir=ltr]) .day,
:host(:hover[range-hover]:not([selected]).focused--start[dir=rtl]) .day {
  border-radius: 100%;
  box-shadow: -2px 0 var(--calcite-ui-foreground-1);
}

:host(:hover[range-hover]:not([selected]).focused--start[dir=ltr]) .day-wrapper,
:host(:hover[range-hover]:not([selected]).focused--end[dir=rtl]) .day-wrapper {
  border-top-left-radius: 40%;
  border-bottom-left-radius: 40%;
  box-shadow: inset 4px 0 var(--calcite-ui-foreground-1);
}

:host(:hover[range-hover]:not([selected]).focused--start[dir=ltr]) .day,
:host(:hover[range-hover]:not([selected]).focused--end[dir=rtl]) .day {
  border-radius: 100%;
  box-shadow: 2px 0 var(--calcite-ui-foreground-1);
}

:host([end-of-range].hover--inside-range.focused--end) .day-wrapper,
:host([start-of-range].hover--inside-range.focused--start) .day-wrapper,
:host(:hover[start-of-range].hover--inside-range.focused--end) .day-wrapper,
:host(:hover[end-of-range].hover--inside-range.focused--start) .day-wrapper {
  background: none;
}

:host([start-of-range].hover--inside-range.focused--end) .day-wrapper,
:host([end-of-range].hover--inside-range.focused--start) .day-wrapper {
  background-color: var(--calcite-ui-foreground-2);
}

:host([dir=ltr][highlighted]:first-child) .day-wrapper,
:host([dir=rtl][highlighted]:last-child) .day-wrapper,
:host([range-hover][dir=ltr]:not([selected]):first-child) .day-wrapper,
:host([range-hover][dir=rtl]:not([selected]):last-child) .day-wrapper {
  border-top-left-radius: 45%;
  border-bottom-left-radius: 45%;
}

:host([dir=ltr][highlighted]:last-child) .day-wrapper,
:host([dir=rtl][highlighted]:first-child) .day-wrapper,
:host([range-hover][dir=ltr]:not([selected]):last-child) .day-wrapper,
:host([range-hover][dir=rtl]:not([selected]):first-child) .day-wrapper {
  border-top-right-radius: 45%;
  border-bottom-right-radius: 45%;
}