/**
  @prop --fw-label-color: Color of the label.
  @prop --fw-hint-color: Color of the hint text.
  @prop --fw-warning-color: Color of the warning text.
  @prop --fw-error-color: Color of the error text.
*/

@import '../../function-components/field-control.scss';

:host {
  display: block;
  position: relative;
  --fw-icon-size: 14px;

  * {
    user-select: none;
  }
  --fw-popover-max-height: 420px;
}

.mdp-container,
.mdp-range-container {
  width: 264px;
  background: $color-milk;
  box-sizing: border-box;
  padding: 16px;
  overflow: hidden;
}

.mdpc-footer {
  padding: 4px;
  display: flex;
  box-sizing: border-box;
  justify-content: flex-end;
  background: $color-smoke-25;

  fw-button {
    margin: 4px;
  }
}

.mdp-range-container {
  width: 536px;
}

.mdpc-head {
  --fw-select-margin-bottom: 16px;
  display: flex;
  align-items: center;
}

.mdpc-body {
  float: left;
  width: 100%;
}

.body-container {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: space-between;

  .mdpc-body {
    width: 232px;
    padding-inline: 8px;
    padding-block: 0;
    position: relative;
  }

  .mdpc-body-right {
    width: 232px;
    padding-inline: 8px;
    padding-block: 0;

    &::after {
      content: '';
      position: absolute;
      inset-block-start: 0;
      inset-inline-end: 251px;
      border-inline-end: 1px solid #ebeff3;
      height: 100%;
    }
  }
}

/**
 * Controls
 */

.btns {
  display: inherit;
  position: absolute;
  inset-inline-end: 14px;
}

.mdpch-button,
.mdpch-button-right {
  width: 12px;
  height: 100%;
  box-sizing: border-box;
  position: relative;
  inset-block-end: 6px;
  inset-inline-end: 14px;
}

.mdpchb-inner:hover,
.mdpchb-inner:focus {
  cursor: pointer;
  background: $color-smoke-50;
}

.mdpchb-inner {
  height: 20px;
  width: 20px;
  position: absolute;
  margin-block-start: -11px;

  &.disabled {
    cursor: not-allowed;
  }
}

.mdpch-button-right .mdpchb-inner {
  inset-inline-start: 12px;
}

.mdpchbi-left-arrow,
.mdpchbi-left-arrows,
.mdpchbi-left-arrows::after,
.mdpchbi-right-arrow,
.mdpchbi-right-arrows,
.mdpchbi-right-arrows::after {
  display: block;
  width: 6px;
  height: 6px;
  border-inline-start: 2px solid $app-primary-black;
  border-block-end: 2px solid $app-primary-black;
  position: absolute;
}

.mdpchbi-left-arrow,
.mdpchbi-left-arrows,
.mdpchbi-right-arrow,
.mdpchbi-right-arrows {
  transform: rotate(45deg);
  inset-inline-start: 50%;
  inset-block-start: 50%;
  margin-inline-start: -2px;
  margin-block-start: -4px;
}

.mdpchbi-right-arrow,
.mdpchbi-right-arrows {
  transform: rotate(225deg);
  margin-inline-start: -4px;
}

.mdpchbi-left-arrows::after,
.mdpchbi-right-arrows::after {
  content: '';
  inset-inline-start: 3px;
  inset-block-start: -5px;
}

.mdpchbi-left-arrows {
  margin-inline-start: -5px;
}

.mdpchbi-right-arrows {
  margin-inline-start: -2px;
}

.mdpch-container,
.mdpch-container-right {
  min-width: 50%;
}

.mdpch-container-right {
  padding-inline-start: 16px;
}

.mdpchc-year {
  --fw-button-min-width: 74px;
  float: left;
  height: 30px;
  font-size: 16px;
  color: $color-smoke-700;
  text-align: center;
  width: 74px;
  --fw-popover-max-height: 146px;
  --fw-popover-min-width: 170px;
}

.mdpchc-month {
  --fw-button-min-width: 65px;
  float: left;
  font-size: 16px;
  color: $color-smoke-700;
  text-align: center;
  width: 65px;
  --fw-popover-max-height: 146px;
  --fw-popover-min-width: 170px;

  fw-select .input-container-inner input {
    width: 98%;
  }
}

/**
 *  Calendar
 */
.c-container,
.c-day-container,
.cc-body,
.cc-head,
.cch-name,
.cdc-day,
.cdc-day span {
  position: relative;
  display: block;
  float: left;
  box-sizing: border-box;
}

.c-container {
  width: 100%;
  height: 100%;
}

.cc-head {
  height: 30px;
  width: 100%;
}

.cch-name {
  width: 14.285%;
  height: 30px;
  line-height: 30px;
  font-weight: 700;
  color: $color-smoke-700;
  font-size: 13px;
  text-align: center;
}

.cc-body {
  height: 180px;
  width: 100%;
}

.c-day-container {
  width: 14.285%;
  height: 11.185%;
  margin-block-start: 10px;
}

.cdc-day {
  width: 100%;
  height: 100%;
  font-size: 12px;
  font-weight: 300;
  color: $color-smoke-700;
  text-align: center;
}

.cdc-day span:hover,
.cdc-day span:focus {
  cursor: pointer;
  background: $color-smoke-50;
}

.cdc-day span {
  width: 24px;
  height: 22px;
  font-size: 14px;
  margin-block-start: -11px;
  margin-inline-start: -13px;
  inset-inline-start: 50%;
  inset-block-start: 50%;
  font-weight: 400;
  border-radius: 10%;
  line-height: 20px;
  color: #12344d;
}

.c-day-container.disabled {
  pointer-events: none;
}

.invalid-alert {
  position: relative;
  display: inline-block;
  overflow: hidden;

  fw-icon {
    cursor: pointer;
    margin-block-start: 4px;
    margin-inline-start: 4px;
  }
}

.icon-calendar {
  display: flex;
  align-items: center;
  margin-inline: 0px;
  margin-block: 4px;

  .separator {
    border-inline-start-width: 1px;
    border-inline-start-style: solid;
    height: 20px;
    margin-inline: 4px;
    margin-block: 0px;
  }
}

.date-icon {
  display: flex;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  align-items: center;
  justify-content: center;
  background-color: $color-smoke-50;
}

.c-day-container.disabled .cdc-day span {
  color: $color-smoke-300;
  background: $color-milk !important;
}

.c-day-container.highlight:not(.disabled) .cdc-day span {
  border: 1px solid $color-smoke-100;
}

.c-day-container.highlight-blue:not(.disabled) .cdc-day span {
  background: $color-azure-800;
  color: $color-smoke-25;
}

.c-day-container.start-day {
  .cdc-day {
    margin-inline-start: 10px;

    span {
      transform: translateX(-10px);
    }
  }
}

.c-day-container.end-day {
  .cdc-day {
    margin-inline-start: -10px;

    span {
      transform: translateX(10px);
    }
  }
}

.c-day-container.highlight-range:not(.disabled) .cdc-day {
  background: #e4f2fd;
}

.time-container {
  display: flex;
  width: 264px;
  gap: 8px;
  padding-block: 12px;
  padding-inline: 16px;
  background: $color-smoke-25;
  box-sizing: border-box;

  fw-input {
    width: 124px;
  }

  .mdc-time {
    width: 100px;
    --fw-popover-min-width: 170px;
    --fw-popover-max-height: 146px;
  }

  span {
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
  }
}

.datepicker {
  height: 100%;
}
