@use '../common/var' as *;
@use '../mixins/mixins' as *;

@include b(date-table) {
  font-size: 12px;
  user-select: none;

  @include when(week-mode) {
    .#{$namespace}-date-table__row {
      &:hover {
        .sg-date-table-cell {
          background-color: var(--sg-datepicker-inrange-bg-color);
        }
        td.available:hover {
          color: var(--sg-datepicker-text-color);
        }
        td:first-child .sg-date-table-cell {
          margin-left: 5px;
        }
        td:last-child .sg-date-table-cell {
          margin-right: 5px;
          
        }
      }

      &.current .sg-date-table-cell {
        background-color: var(--sg-datepicker-inrange-bg-color);
      }
    }
  }

  td {
    width: 32px;
    height: 30px;
    padding: 4px 0;
    box-sizing: border-box;
    text-align: center;
    cursor: pointer;
    position: relative;

    @include b(date-table-cell) {
      height: 30px;
      padding: 3px 0;
      box-sizing: border-box;
      @include b(date-table-cell__text) {
        width: 24px;
        height: 24px;
        display: block;
        margin: 0 auto;
        line-height: 24px;
        position: absolute;
        border-radius: var(--sg-border-radius-base);
        left: 50%;
        transform: translateX(-50%);
        font-size: var(--sg-font-size-base);
      }
    }

    &.next-month,
    &.prev-month {
      color: var(--sg-datepicker-off-text-color);
    }

    &.today {
      position: relative;
      .sg-date-table-cell {
        border: 1px solid var(--sg-color-primary);
        border-radius: var(--sg-border-radius-base);
      }
      &.start-date .sg-date-table-cell__text,
      &.end-date .sg-date-table-cell__text {
        color: $color-white;
      }
    }

    &.available:not(.current,.selected):hover {
      .sg-date-table-cell {
        background-color: var(--sg-color-primary-light-9);
      }
    }
    &.in-range .sg-date-table-cell {
      background-color: var(--sg-datepicker-inrange-bg-color);
      &:hover {
        background-color: var(--sg-datepicker-inrange-hover-bg-color);
      }
    }

    &.current:not(.disabled) .sg-date-table-cell {
        border: 1px solid var(--sg-color-primary);
        border-radius: var(--sg-border-radius-base);
        color: var(--sg-color-white);
        background-color: var(--sg-color-primary-light-1);
    }
    &.start-date .sg-date-table-cell,
    &.end-date .sg-date-table-cell {
      color: $color-white;
      background-color: var(--sg-datepicker-active-color)!important;
      border: 1px solid var(--sg-color-primary);
      border-radius: var(--sg-border-radius-base);
    }
    
    &.start-date .sg-date-table-cell {
      margin-left: 5px;
    }

    &.end-date .sg-date-table-cell {
      margin-right: 5px;
    }

    &.disabled .sg-date-table-cell {
      background-color: var(--sg-bg-color);
      opacity: 1;
      cursor: not-allowed;
      color: var(--sg-text-color-placeholder);
    }

    &.selected .sg-date-table-cell {
      border: 1px solid var(--sg-color-primary);
      border-radius: var(--sg-border-radius-base);
      color: var(--sg-color-white);
      background-color: var(--sg-color-primary-light-1);
      
    }

    &.selected .sg-date-table-cell__text {
      color: $color-white;    
    }

    &.week {
      font-size: 80%;
      color: var(--sg-datepicker-header-text-color);
    }
  
  }

  th {
    padding: 5px 0px;
    width: 14.285%;
    color: var(--sg-datepicker-header-text-color);
    font-weight: 400;
    font-size: var(--sg-font-size-base);
    color:  var(--sg-text-color-secondary);
  }
}
.select-today {
  line-height: 38px;
  text-align: center;
  width: 100%;
  border-top: 1px solid var(--sg-border-color-lighter);
  span {
    font-size: var(--sg-font-size-base);
    color: var(--sg-color-primary);
    &:hover {
      cursor: pointer;
      color: var(--sg-color-primary-light-2);
    }
  }
}
