/*!
 * Copyright (c) 2024 LatePoint LLC. All rights reserved.
 */

.latepoint-calendar-wrapper {
  position: relative;
  &.show-filters{
    .latepoint-calendar-filters {
      display: flex;
    }
    .le-filter {
      .latepoint-icon {
        &:before {
          content: "\e90a";
        }
      }
    }
  }
  &.os-loading {
    .latepoint-calendar-controls-wrapper {
      &:before {
        content: "";
        display: block;
        position: absolute;
        bottom: -1px;
        left: 0;
        right: 0;
        height: 3px;
        background: repeating-linear-gradient(to right, #fff 0%, #1D7BFF 50%, #fff 100%);
        width: 100%;
        background-size: 200% auto;
        background-position: 0 100%;
        animation: os-loading-gradient 1.5s infinite;
        animation-fill-mode: forwards;
        animation-timing-function: linear;
      }
    }
  }
}

.latepoint-calendar-controls-wrapper {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid #ddd;
  background-color: #fff;
}
.latepoint-calendar-filters {
  border-top: 1px solid #eee;
  padding: 15px 0;
  gap: 15px;
  display: none;
  align-items: center;
  justify-content: flex-end;
  .le-filters-label {
    font-size: $font-size-base;
  }
}
.le-range-selector {
  margin-left: auto;
}
.le-range-selector,
.latepoint-calendar-filters{
  select.os-form-control {
    padding: 8px 10px;
    line-height: 1.55;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: $font-size-base;
    height: auto;
  }
}
.latepoint-calendar-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 0;
  .le-label {
    color: rgba(0,0,0,0.3);
    font-size: floor($font-size-base * 1.8);
    font-weight: $body-font-weight-bold;
    line-height: 1;
  }
  .le-week {
    font-size: floor($font-size-base * 1.8);
    font-weight: $body-font-weight-bold;
    line-height: 1;
  }
  .le-month {
    font-size: floor($font-size-base * 2.4);
    font-weight: $body-font-weight-bold;
    line-height: 1;
  }
  .le-filter {
    padding: 6px 12px;
    border: 1px solid #ccc;
    color: $body-color;
    cursor: pointer;
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: $font-size-base;
    border-radius: 6px;
    position: relative;
    &.os-loading{
      &:before {
        @include loading-circle(#000, 10px);
        left: 18px;
      }
      .latepoint-icon {
        color: transparent;
      }
    }
    .latepoint-icon {
    }
    &:hover {
      border-color: #111;
    }
  }
  .le-navigation-wrapper {
    border-left: 1px solid #eee;
    padding-left: 20px;
    margin-left: 5px;
  }
  .le-navigation {
    display: flex;
    font-size: $font-size-base;
    border-radius: 6px;
    align-items: stretch;
    border: 1px solid #ccc;
    .le-today {
      padding: 6px 12px;
      color: $body-color;
      cursor: pointer;
      position: relative;
    border-radius: 6px;
      &:hover {
        box-shadow: 0 0 0 1px #111;
        z-index: 2;
      }
    }

    .le-navigation-button {
      padding: 11px 10px;
      cursor: pointer;
      position: relative;
      font-size: 10px;
      line-height: 1;
      border-radius: 6px;
      &:hover {
        box-shadow: 0 0 0 1px #111;
        z-index: 2;
        border-color: transparent;
      }
      &:first-child {
      }
      &:last-child {
      }
      &.os-loading {
        color: transparent;
        &:before {
          @include loading-circle(#000, 10px);
        }
      }
    }
  }
}

.latepoint-calendar-week {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
  padding-left: 50px;
  .le-day-wrapper {
    position: relative;
    &.os-month-prev {
      .le-day-weekday-wrapper {
        .le-day-number {
        }
      }
    }
    &.day-weekday-6,
    &.day-weekday-7 {
      .le-day-weekday-wrapper {
        background-color: #fffaf1;
      }
    }
    &.os-today {
      .le-day-weekday-wrapper {
        &:before {
          content: "";
          left: 0px;
          right: 0px;
          top: 0px;
          background-color: #f34a4a;
          position: absolute;
          height: 2px;
          z-index: 10;
        }
      }
    }
    &:hover {
      .le-day-number {
        color: $brand-primary;
        border-bottom-color: $brand-primary;
      }
    }
    &:first-child {
      .day-schedule-timeslot-value {
        display: block;
      }
      .le-day-schedule-wrapper .day-schedule-timeslot:before {
          content: "";
          background-color: #ddd;
          height: 1px;
          top: 0px;
          left: -5px;
          width: 5px;
          position: absolute;
      }
    }
    &:first-child {
      .le-day-weekday-wrapper {
      }
    }
    &:last-child {
      border-right: 1px solid #ddd;
    }
  }
  .le-day-weekday-wrapper {
    border-left: 1px solid #ddd;
    padding-left: 20px;
    padding-top: 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid #bbb;
    position: sticky;
    top: 35px;
    z-index: 7;
    box-shadow: 0 2px 0 0 rgba(0,0,0,0.05);
    background-color: #fff;
  }
  .le-day-weekday {
    font-weight: $body-font-weight-bold;
    color: #aaa;
    z-index: 3;
    position: relative;
  }
  .le-day-number {
    font-size: $font-size-base * 3;
    font-weight: $body-font-weight-bold;
    line-height: 1;
    border-bottom: 1px dotted transparent;
    display: inline-block;
    cursor: pointer;
    position: relative;
    z-index: 2;
    &:hover {
      border-bottom-style: solid;
    }
    &.os-loading {
      color: transparent!important;
      border-bottom-color: transparent!important;
      &:before {
        @include loading-circle($brand-primary, 30px);
      }
    }
  }
  .os-day-month {
    position: absolute;
    z-index: 1;
    font-size: floor($font-size-base * 5);
    color: rgba(0,0,0,0.05);
    left: 15px;
    top: 12px;
    line-height: 1;
    overflow: hidden;
    right: 0;
  }

  $timeslot_value_width: 50px;
  .le-day-schedule-wrapper {
    .day-schedule-timeslots {
      position: relative;
      &:before {
        content: "";
        top: 0;
        bottom: 0;
        width: 1px;
        background-color: #e1e1e1;
        position: absolute;
        left: 0;
      }
      .day-schedule-timeslot-wrapper {
        display: flex;
        background-color: #f9f9f9;
        &:first-child {
          .day-schedule-timeslot-value {
            display: none;
          }
          .day-schedule-timeslot:before {
            background-color: transparent;
          }
        }
        .day-schedule-timeslot {
          flex: 1;
          text-align: right;
          text-transform: uppercase;
          letter-spacing: 1px;
          font-size: floor($font-size-base * 0.75);
          height: $calendar-timeslot-height;
          position: relative;
          box-shadow: 0 1px 0 0 #ddd;
        }
      }
      .le-service-wrapper {
        position: absolute;
        left: 0;
        right: 0;
        font-size: floor($font-size-base * 0.8);
        background-color: #fff;
        z-index: 2;
        cursor: pointer;
        box-shadow: inset 0 1px 0 0px #ddd, 0 3px 0 0 rgba(0,0,0,0.03);
        border-bottom: 1px solid #ccc;
        &.os-loading {
          &:before {
            content: "";
            @include loading-circle(#111, 8px);
            top: 10px;
            right: 0px;
            left: auto;
          }
        }
        &.is-passed {
          .le-service-inner {
            opacity: 0.6;
          }
          cursor: not-allowed;
          &:hover {
            .is-passed-message {
              display: block;
            }
          }
          .is-passed-message {
            display: none;
            background-color: #000;
            color: #fff;
            padding: 5px 10px;
            font-weight: $body-font-weight-bold;
            font-size: floor($font-size-base * 0.8);
            position: absolute;
            top: 0;
            left: 50%;
            transform: translate(-50%, -110%);
            white-space: nowrap;
          }
        }
        &:hover {
          opacity: 1;
          z-index: 3;
          .le-color-elem {
            width: 5px;
          }
          .le-service-name, .le-service-time-period {
            transform: translateX(3px);
          }
        }
        .le-service-inner {
          padding: 3px;
          padding-left: 8px;
          display: flex;
          flex-direction: column;
          height: 100%;
          box-sizing: border-box;
        }
        .le-color-elem {
          position: absolute;
          top: 0px;
          bottom: -1px;
          left: 0px;
          width: 3px;
          display: block;
          transition: all 0.15s ease;
        }
      }
      .le-service-time-period {
        transition: transform 0.15s ease;
      }
      .le-service-name {
        font-weight: $body-font-weight-bold;
        font-size: floor($font-size-base);
        line-height: 1.4;
        overflow: hidden;
        transition: transform 0.15s ease;
      }
    }
    .day-schedule-timeslot {
      position: relative;
    }
  }

  .day-schedule-timeslot-value {
    display: none;
    position: absolute;
    top: 0;
    transform: translateY(-50%);
    left: -$timeslot_value_width - 10;
    width: $timeslot_value_width;
    text-align: right;
  }
}


.latepoint-calendar-month {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
  gap: 1px;
  background-color: #ddd;
  padding: 1px;
  padding-top: 0;
  .le-weekday {
    background-color: #fff;
    padding: 5px 15px;
    font-weight: $body-font-weight-bold;
    font-size: floor($font-size-base * 1.2);
    &.weekday-6,
    &.weekday-7 {
      color: #382c18;
    }
  }
  .le-day-wrapper {
    min-height: 200px;
    background-color: #fff;
    padding: 20px;
    position: relative;
    &:hover {
      .le-day-number {
        color: $brand-primary;
        border-bottom: 1px dotted $brand-primary;
      }
    }
    &.day-weekday-6,
    &.day-weekday-7 {
    }
    &.os-today {
      &:before {
        content: "";
        left: -1px;
        right: -1px;
        top: -1px;
        background-color: #f34a4a;
        position: absolute;
        height: 2px;
      }
    }
    &.os-day-passed,
    &.os-month-prev,
    &.os-month-next {
      background-color: #f9f9f9;
      .le-day-number {
        color: #999;
      }
      .le-service-wrapper {
        opacity: 0.8;
      }
    }
    .le-more-services {
      color: $brand-primary;
      border-bottom: 1px dotted $brand-primary;
      font-size: $font-size-base;
      display: inline-block;
      cursor: pointer;
      font-weight: $body-font-weight-bold;
      line-height: 1.2;
      position: relative;
      &:hover {
        border-bottom-style: solid;
      }
      &.os-loading {
        color: transparent;
        border-bottom-color: transparent;
        &:before {
          @include loading-circle($brand-primary, 10px);
        }
      }
    }
    .os-day-month {
      position: absolute;
      z-index: 1;
      font-size: floor($font-size-base * 4);
      color: rgba(0,0,0,0.05);
      left: 20px;
      top: 7px;
      line-height: 1;
      right: 0;
      overflow: hidden;
    }
    .le-day-number {
      z-index: 2;
      font-size: floor($font-size-base * 1.8);
      font-weight: $body-font-weight-bold;
      line-height: 1;
      margin-bottom: 10px;
      border-bottom: 1px dotted transparent;
      display: inline-block;
      cursor: pointer;
      position: relative;
      &:hover {
        border-bottom-style: solid;
      }
      &.os-loading {
        color: transparent;
        border-bottom-color: transparent;
        &:before {
          @include loading-circle($brand-primary, 15px);
        }
      }
    }
    .le-service-wrapper {
      padding: 3px;
      padding-left: 10px;
      font-size: floor($font-size-base * 0.8);
      margin-bottom: 10px;
      border: 1px solid #ddd;
      position: relative;
      background-color: #fff;
      z-index: 2;
      cursor: pointer;
      box-shadow: 0 2px 0 0 rgba(0,0,0,0.05);
      border-bottom-color: #bbb;
      border-left: none;
      &.is-passed {
        cursor: not-allowed;
        .le-service-inner {
          opacity: 0.6;
        }
        &:hover {
          .is-passed-message {
            display: block;
          }
        }
        .is-passed-message {
          display: none;
          background-color: #000;
          color: #fff;
          padding: 5px 10px;
          font-weight: $body-font-weight-bold;
          font-size: floor($font-size-base * 0.8);
          position: absolute;
          top: 0;
          left: 50%;
          transform: translate(-50%, -110%);
          white-space: nowrap;
        }
      }

      &.os-loading {
        &:before {
          content: "";
          @include loading-circle(#111, 8px);
          top: 10px;
          right: 0px;
          left: auto;
        }
      }
      &:hover {
        border-color: #bbb;
        .le-color-elem {
          transform: translateX(-2px);
          width: 5px;
        }
      }
      .le-color-elem {
        position: absolute;
        top: -1px;
        bottom: -1px;
        left: -1px;
        width: 3px;
        display: block;
        transition: all 0.15s ease;
      }
    }
    .le-service-name {
      font-weight: $body-font-weight-bold;
      font-size: floor($font-size-base);
      line-height: 1.35;
    }
    .le-service-time-period {

    }
  }
}


.le-day-view-wrapper {
  &.os-loading {
    .le-day-info-section {
      &:before {
        content: "";
        display: block;
        position: absolute;
        bottom: -1px;
        left: 0;
        right: 0;
        height: 3px;
        background: repeating-linear-gradient(to right, #fff 0%, #1D7BFF 50%, #fff 100%);
        width: 100%;
        background-size: 200% auto;
        background-position: 0 100%;
        animation: os-loading-gradient 1.5s infinite;
        animation-fill-mode: forwards;
        animation-timing-function: linear;
      }
    }
  }
  .le-day-info-section {
    display: flex;
    border-bottom: 1px solid rgba(0,0,0,0.2);
    padding: 20px 40px;
    position: sticky;
    top: 0;
    background-color: #fff;
    z-index: 4;

    .le-day-info {
      text-align: center;
      .le-day-number {
        font-size: floor($font-size-base * 4.1);
        font-weight: $body-font-weight-bold;
        line-height: 1;
      }
      .le-day-month {
        color: $color-faded;
        font-size: floor($font-size-base * 1.4);
        letter-spacing: 2px;
        text-transform: uppercase;
        font-weight: $body-font-weight-bold;
      }
    }
    .le-day-filters-wrapper {
      border-left: 1px solid #eee;
      margin-left: 40px;
      padding-left: 20px;
      flex: 1;
    }
    .le-day-heading {
      font-size: floor($font-size-base * 2.2);
      font-weight: $body-font-weight-bold;
      margin-bottom: 10px;
    }
    .le-day-filters {
      gap: 10px;
      display: flex;
      align-items: center;
      .os-form-group.os-form-select-group {
        margin-bottom: 0px!important;
        .os-form-control {
          height: auto!important;
          padding: 6px!important;
          border-color: #ccc!important;
          border-radius: 6px!important;
        }
      }
    }
  }
  $timeslot_value_width: 50px;
  .le-day-schedule-wrapper {
    padding: 40px;
    background-color: #f8f8f8;
    .day-schedule-timeslots {
      position: relative;
      padding-left: $timeslot_value_width;
      &:before {
        content: "";
        top: 0;
        bottom: 0;
        width: 1px;
        background-color: #e1e1e1;
        position: absolute;
        left: $timeslot_value_width + 10px;
      }
      .day-schedule-timeslot-wrapper {
        display: flex;
        box-shadow: 0 1px 0 0 #e1e1e1;
        &:first-child {
        }
        .day-schedule-timeslot {
          flex: 0 0 $timeslot_value_width;
          text-align: right;
          text-transform: uppercase;
          letter-spacing: 1px;
          font-size: floor($font-size-base * 0.75);
          height: $calendar-timeslot-height;
          position: relative;
          .day-schedule-timeslot-value {
            position: absolute;
            top: 0;
            transform: translateY(-50%);
            left: -$timeslot_value_width - 10;
            width: $timeslot_value_width;
            text-align: right;
          }
        }
      }
      .le-service-wrapper {
        position: absolute;
        left: $timeslot_value_width + 10;
        right: 0;
        font-size: floor($font-size-base * 0.8);
        box-shadow: inset 0 1px 0 0px #ddd, 0 3px 0 0 rgba(0, 0, 0, 0.03), 0 1px 0 0 #ddd;
        border-right: 1px solid #ddd;
        background-color: #fff;
        z-index: 2;
        cursor: pointer;
        .le-service-inner {
          padding: 3px;
          padding-left: 10px;
          flex-direction: column;
          height: 100%;
          box-sizing: border-box;
          display: flex;
        }
        &.is-passed {
          cursor: not-allowed;
          .le-service-inner{
            opacity: 0.6;
          }
          &:hover {
            .is-passed-message {
              display: block;
            }
          }
          .is-passed-message {
            display: none;
            background-color: #000;
            color: #fff;
            padding: 5px 10px;
            font-weight: $body-font-weight-bold;
            font-size: floor($font-size-base * 0.8);
            position: absolute;
            top: 0;
            left: 50%;
            transform: translate(-50%, -110%);
            white-space: nowrap;
          }
        }

        &:hover {
          border-bottom-color: #999;
          opacity: 1;
          z-index: 3;
          .le-color-elem {
            transform: translateX(-2px);
            width: 5px;
          }
          .le-service-name,
          .le-service-time-period {
            transform: translateX(3px);
          }
        }
        .le-color-elem {
          position: absolute;
          top: 0px;
          bottom: -1px;
          left: -1px;
          width: 3px;
          display: block;
          transition: all 0.15s ease;
        }
      }
      .le-service-name {
        font-weight: $body-font-weight-bold;
        font-size: floor($font-size-base);
        line-height: 1.4;
        overflow: hidden;
        transition: transform 0.15s ease;
      }
      .le-service-time-period {
        transition: transform 0.15s ease;
      }
    }
    .day-schedule-timeslot {
    }
  }
}