.navds-date {
  padding: var(--a-spacing-4) var(--a-spacing-3);
}

.navds-date .rdp-day_range_middle.rdp-day_disabled {
  color: var(--ac-date-middle-text, var(--a-text-on-action));
  background: var(--ac-date-middle-bg, var(--a-surface-action-selected));
}

.navds-date .rdp-month,
.navds-date.rdp-month {
  display: grid;
  gap: var(--a-spacing-5);
}

.navds-date__caption-label {
  text-transform: capitalize;
}

.navds-date .rdp-head_cell {
  text-transform: capitalize;
  font-size: var(--a-font-size-small);
}

.navds-date .rdp-weeknumber {
  font-size: var(--a-font-size-small);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--a-border-radius-medium);
  margin: var(--a-spacing-2);
  color: var(--a-text-subtle);
}

.navds-date .rdp-weeknumber.rdp-button {
  width: 2rem;
  height: 2rem;
  box-shadow: 0 0 0 1px var(--a-border-default);
  color: var(--a-text-subtle);
  font-size: var(--a-font-size-small);
}

.navds-date .rdp-weeknumber.rdp-button:active {
  background-color: var(--a-surface-action-active);
  color: var(--a-text-on-action);
  box-shadow: none;
}

.navds-date__caption__month .navds-select__container select {
  text-transform: capitalize;
}

.navds-date .rdp-button {
  all: unset;
  display: block;
  width: 2.5rem;
  height: 2.5rem;
  text-align: center;
  border-radius: var(--a-border-radius-medium);
}

.navds-date .rdp-day_range_start {
  border-radius: var(--a-border-radius-xlarge) var(--a-border-radius-medium) var(--a-border-radius-medium)
    var(--a-border-radius-xlarge);
}

.navds-date .rdp-day_range_end:not(.rdp-day_range_start) {
  border-radius: var(--a-border-radius-medium) var(--a-border-radius-xlarge) var(--a-border-radius-xlarge)
    var(--a-border-radius-medium);
}

.navds-date .rdp-day_range_start.rdp-day_range_end {
  border-radius: var(--a-border-radius-xlarge);
}

.navds-date .rdp-button:not(.rdp-day_selected, [disabled]):focus-visible,
.navds-date .navds-date__month-button:not(.rdp-day_selected, [disabled]):focus-visible {
  box-shadow: var(--a-shadow-focus);
}

@supports not selector(:focus-visible) {
  .navds-date .rdp-button:not(.rdp-day_selected, [disabled]):focus,
  .navds-date .navds-date__month-button:not(.rdp-day_selected, [disabled]):focus {
    box-shadow: var(--a-shadow-focus);
  }
}

.navds-date .rdp-button.rdp-day_selected:not([disabled]):focus-visible,
.navds-date .navds-date__month-button.rdp-day_selected:not([disabled]):focus-visible {
  box-shadow:
    inset 0 0 0 1px var(--a-surface-default),
    var(--a-shadow-focus);
}

@supports not selector(:focus-visible) {
  .navds-date .rdp-button.rdp-day_selected:not([disabled]):focus,
  .navds-date .navds-date__month-button.rdp-day_selected:not([disabled]):focus {
    box-shadow:
      inset 0 0 0 1px var(--a-surface-default),
      var(--a-shadow-focus);
  }
}

/* Monthpicker */
.navds-date__month-button {
  all: unset;
  text-align: center;
  width: 3rem;
  height: 3rem;
  text-transform: capitalize;
  border-radius: var(--a-border-radius-medium);
  cursor: pointer;
}

.navds-date__month-button:focus-visible,
.navds-monthpicker__caption-button:focus-visible {
  box-shadow: var(--a-shadow-focus);
  z-index: 1;
}

@supports not selector(:focus-visible) {
  .navds-date__month-button:focus,
  .navds-monthpicker__caption-button:focus {
    box-shadow: var(--a-shadow-focus);
    z-index: 1;
  }
}

.navds-date__year-label {
  display: flex;
  align-items: center;
}

.navds-date__wrapper,
.navds-date__standalone-wrapper {
  height: fit-content;
  width: fit-content;
}

.navds-date .navds-date__field {
  display: flex;
  flex-direction: column;
  width: 100%;
  position: relative;
}

.navds-date__field-wrapper {
  display: inline-flex;
  align-items: center;
  position: relative;
  width: fit-content;
}

.navds-date .rdp-day_selected,
.navds-monthpicker__month--selected {
  color: var(--ac-date-selected-text, var(--a-text-on-action));
  background: var(--ac-date-selected-bg, var(--a-surface-action-selected));
  cursor: pointer;
}

.navds-date .rdp-day_disabled {
  cursor: not-allowed;
  text-decoration: line-through;
  background-color: var(--ac-date-disabled-bg, var(--a-surface-neutral-subtle));
  color: var(--ac-date-disabled-text, var(--a-text-subtle));
}

.navds-date .rdp-button:where(:not(.rdp-day_selected, [disabled])):hover,
.navds-date__month-button:where(:not(.rdp-day_selected, [disabled])):hover {
  background: var(--ac-date-hover-bg, var(--a-surface-action-subtle-hover));
  cursor: pointer;
}

.navds-date .rdp-day_today {
  box-shadow: 0 0 0 1px var(--ac-date-today-border, var(--a-border-action-selected));
  text-decoration: underline;
}

.navds-date__caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--a-spacing-1);
  padding-inline: var(--a-spacing-1);
}

.navds-date__caption-button,
.navds-date__caption-button:disabled,
.navds-date__caption-button:disabled:hover {
  color: var(--ac-date-caption-text, var(--a-text-default));
}

.navds-date__field-input {
  padding-right: var(--a-spacing-12);
}

.navds-form-field--small .navds-date__field-input {
  padding-right: var(--a-spacing-8);
}

/* Error-handling */
.navds-date__field--error .navds-date__field-input:not(:hover, :disabled) {
  border-color: var(--ac-date-input-error-border, var(--a-border-danger));
  box-shadow: inset 0 0 0 1px var(--ac-date-input-error-border, var(--a-border-danger));
}

.navds-date__field--error .navds-date__field-input:focus-visible:not(:hover, :disabled) {
  box-shadow:
    inset 0 0 0 1px var(--ac-date-input-error-border, var(--a-border-danger)),
    var(--a-shadow-focus);
}

@supports not selector(:focus-visible) {
  .navds-date__field--error .navds-date__field-input:focus:not(:hover, :disabled) {
    box-shadow:
      inset 0 0 0 1px var(--ac-date-input-error-border, var(--a-border-danger)),
      var(--a-shadow-focus);
  }
}

.navds-date__field-button {
  position: absolute;
  right: 0.0625rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ac-date-input-button-text, var(--a-text-default));
  display: inline-flex;
  cursor: pointer;
  margin: 0;
  text-decoration: none;
  border: none;
  background: none;
  border-radius: calc(var(--a-border-radius-medium) - 1px);
  padding: var(--a-spacing-3);
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  height: calc(100% - 0.125rem);
  border-start-start-radius: 0;
  border-end-start-radius: 0;
}

.navds-form-field--small .navds-date__field-button {
  padding: var(--a-spacing-1);
}

.navds-date__field-button:hover:where(:not([disabled])) {
  color: var(--ac-date-input-button-hover-text, var(--a-text-action-on-action-subtle));
  background-color: var(--ac-date-input-button-hover-bg, var(--a-surface-action-subtle-hover));
}

.navds-form-field--disabled .navds-date__field-button {
  opacity: 1;
  cursor: not-allowed;
}

.navds-date__field-button:focus-visible {
  outline: none;
  box-shadow: var(--a-shadow-focus);
  border-radius: var(--a-border-radius-medium);
}

@supports not selector(:focus-visible) {
  .navds-date__field-button:focus {
    outline: none;
    box-shadow: var(--a-shadow-focus);
  }
}

.navds-date__caption__year {
  width: 5rem;
}

.navds-date .rdp-day_outside {
  visibility: hidden;
  pointer-events: none;
}

/* Readonly */
.navds-date__field--readonly .navds-date__field-button {
  cursor: default;
  color: var(--a-gray-500);
}

.navds-date__caption-button {
  width: 2rem;
  height: 2rem;
}

.navds-date__week-row {
  display: flex;
  align-items: center;
  gap: var(--a-spacing-05);
}

.navds-date__week-wrapper {
  width: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.navds-date__modal.navds-date {
  padding: 0;
}

.navds-date__modal-body {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: var(--a-spacing-4);
  gap: var(--a-spacing-2);
}

.navds-date__modal-body > .navds-date {
  padding: 0;
}

.navds-date__popover:where(.navds-popover) {
  border: none;
}

@media (min-width: 480px) {
  .navds-date {
    padding: var(--a-spacing-5) var(--a-spacing-4);
  }

  .navds-date__modal-body {
    padding: var(--a-spacing-6);
  }

  .navds-date__caption {
    gap: var(--a-spacing-2);
  }

  .navds-date .rdp-button,
  .navds-date__caption-button {
    width: 3rem;
    height: 3rem;
  }
}
