.stlms-lesson-view {
  --header-height: 78px;
  position: relative;
  overflow: hidden;
  height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  @include transition(all 0.3s ease-in-out);

  &__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding: 10px 112px;
    border-top: 1px solid $gray;
    border-bottom: 1px solid $gray;
    flex-shrink: 0;
    @include breakpoint(max, $lg) {
      padding-left: 32px;
      padding-right: 80px;
    }
    @include breakpoint(max, $sm) {
      padding: 8px 16px;
      gap: 12px;
    }
    @include breakpoint(max, 500) {
      flex-wrap: wrap;
    }
    .stlms-lesson-toggle {
      position: absolute;
      right: 0;
      top: 0;
      width: 62px;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      background: $gray;
      color: $primary_dark;
      cursor: pointer;
      @include transition(all 0.3s ease-in-out);
      @include breakpoint(max, $sm) {
        position: relative;
        width: 42px;
        height: 42px;
        border-radius: 6px;
        flex-shrink: 0;
      }
    }
    .stlms-ai-chat {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: $font_size_base;
      font-weight: $font_weight_medium;
      color: $primary_dark;
      background: $white;
      padding: 8px 16px;
      border-radius: 5px;
      cursor: pointer;
      box-shadow: 0px 1px 2px -1px #0000001A;
      @include breakpoint(max, $sm) {
        font-size: 0;
        gap: 0;
        padding: 8px;
        width: 42px;
        height: 42px;
      }
      .icon {
        flex-shrink: 0;
        width: 20px;
        height: 20px;
      }
    }
  }
  &__breadcrumb {
    @include breakpoint(max, $sm) {
      width: 100%;
    }
    ul {
      display: flex;
      align-items: center;
      li {
        font-size: $font_size_lg;
        font-weight: $font_weight_medium;
        color: $primary_dark;
        padding-right: 16px;
        max-width: max-content;
        @include breakpoint(max, $md) {
          font-size: $font_size_base;
        }
        a {
          display: inline-block;
        }
        & + li {
          display: flex;
          align-items: center;
          &:before {
            content: "/";
            color: $gray;
            margin-right: 16px;
            font-weight: $font_weight_normal;
          }
        }
      }
    }
  }
  &__pagination {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    .stlms-btn {
      @include breakpoint(max, $sm) {
        font-size: 0;
        gap: 0;
        padding: 8px;
        background: $gray;
      }
    }
  }
  &__footer {
    border-top: 1px solid $gray;
    padding: 40px 112px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;

    @include breakpoint(max, $sm) {
      padding: 40px 20px;
      justify-content: center;
    }
    &.hidden {
      display: none;
    }
    .left {
      .stlms-quiz-timer {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        font-size: 16px;
        font-weight: 500;
        color: $primary_dark;
        background: $gray;
        padding: 8px 20px;
        border-radius: 24px;
        svg {
          flex-shrink: 0;
          color: $primary;
          display: block;
        }
      }
    }
    .right {
      display: flex;
      gap: 16px;
      flex-wrap: wrap;
      text-align: right;
    }
    &.no-steps {
      .right {
        width: 100%;
      }
    }
  }
  &__body {
    // height: calc(100% - 62px);
    height: 100%;
    overflow: auto;
  }
  &.active {
    padding-right: 420px;
    @include breakpoint(max, $md) {
      padding-right: 0;
    }
    .stlms-lesson-sidebar {
      right: 0;
    }
    .stlms-lesson-view__header {
      .stlms-lesson-toggle {
        opacity: 0;
        visibility: hidden;
      }
    }
    // .stlms-lesson-video-box {
    //   padding-bottom: 56.25%;
    //   &.stlms-pdf-view {
    //     @include breakpoint(max, $sm) {
    //       padding-bottom: 140.25%;
    //     }
    //   }
    // }
  }
}

.stlms-lesson-video-box {
  --plyr-color-main: #0f5aa7;
  position: relative;
  width: 100%;
  height: 100%;
  // padding-bottom: 44.25%;
  @include transition(all 0.3s ease-in-out);
  // @include breakpoint(max, $lg) {
  //   padding-bottom: 56.25%;
  // }
  > * {
    // position: absolute;
    // top: 0;
    // left: 0;
    width: 100%;
    height: 100%;
    display: block;
  }
  // &.stlms-pdf-view {
  //   @include breakpoint(max, $sm) {
  //     padding-bottom: 140.25%;
  //   }
  // }
}

.stlms-lesson-sidebar {
  position: absolute;
  right: -430px;
  top: 0;
  width: 420px;
  height: 100%;
  border-top: 1px solid $gray;
  border-left: 1px solid $gray;
  border-bottom: 1px solid $gray;
  display: flex;
  flex-direction: column;
  padding: 12px;
  background: $white;
  z-index: 123;
  @include transition(all 0.3s ease-in-out);
  @include breakpoint(max, $md) {
    position: fixed;
    width: 300px;
  }
  .stlms-lesson-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 20px;
    padding: 16px;
    border-radius: 6px;
    background: $gray;
    font-size: $font_size_base;
    font-weight: $font_weight_medium;
    color: $primary_dark;
    margin-bottom: 4px;
    .icon-cross {
      margin-left: auto;
      color: $gray_light;
    }
  }
  .stlms-lesson-accordion {
    height: 100%;
    overflow: auto;
  }
}

.stlms-lesson-accordion {
  .stlms-accordion-item {
    border-bottom: 1px solid $gray;
    .stlms-accordion-collapse {
      border-top: 1px solid $gray;
    }
  }
  .stlms-lesson-title {
    display: flex;
    font-size: 18px;
    font-weight: 500;
    color: $primary_dark;
    padding: 16px 12px;
    @include breakpoint(max, $md) {
      font-size: $font_size_base;
    }
    .no {
      width: 24px;
      flex-shrink: 0;
    }
    .stlms-lesson-name {
      width: 100%;
      .name {
        padding-bottom: 10px;
      }
      .info {
        display: flex;
        font-size: 14px;
        color: $gray_light;
        span {
          display: flex;
          align-items: center;
          padding-right: 10px;
          & + span {
            &:before {
              content: "";
              margin-right: 10px;
              width: 5px;
              height: 5px;
              background-color: currentColor;
              border-radius: 100%;
            }
          }
        }
      }
    }
  }
}

.stlms-lesson-list {
  > ul {
    > li {
      label {
        display: flex;
        width: 100%;
        gap: 10px;
        padding: 16px 12px;
        color: $primary_dark;
        .stlms-check {
          flex-shrink: 0;
          margin-top: 4px;
        }
        .stlms-lesson-class {
          width: 100%;
          display: flex;
          flex-direction: column;
          gap: 10px;
          .class-name {
            display: flex;
            font-size: 16px;
            font-weight: 500;

            @include breakpoint(max, $md) {
              font-size: $font_size_sm;
            }
            @include breakpoint(max, $sm) {
              align-items: flex-start;
            }
            span {
              flex-shrink: 0;
              width: 32px;
            }
          }
          .class-type {
            display: flex;
            font-size: 14px;
            gap: 10px;

            svg {
              flex-shrink: 0;
              width: 16px;
            }
          }
        }
        &.in-progress {
          color: $gray_dark;
          .stlms-check:checked {
            background-color: $gray_dark;
            border-color: $gray_dark;
          }
        }
        &:has(.stlms-check[readonly]),
        &:has(.stlms-check[disable]),
        &:has(.stlms-check[disabled]) {
          color: $gray_light;
          pointer-events: none;
          .stlms-check {
            border-color: $gray_light;
          }
        }
      }
    }
  }
}

.stlms-course-requirement-box {
  .class-type {
    @include breakpoint(max, 767) {
      position: absolute;
      top: 0;
      left: 0;
    }
  }
  .class-name {
    align-items: center;
  }
}

.stlms-quiz-view {
  position: relative;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: auto;
  .sw.sw-loading {
    &:before {
      border: 2px solid #0b4178;
      border-top: 15px solid var(--sw-loader-background-color);
    }
  }
}

.stlms-quiz-start {
  text-align: center;
  h3 {
    color: $primary_dark;
    font-size: 20px;
    font-weight: 500;
    padding-bottom: 10px;
  }
  .info {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 20px;
    span {
      display: flex;
      align-items: center;
      padding-right: 10px;
      & + span {
        &:before {
          content: "";
          margin-right: 10px;
          width: 5px;
          height: 5px;
          background-color: currentColor;
          border-radius: 100%;
        }
      }
    }
  }
}

.stlms-quiz-question {
  padding: 24px 0;
  > .qus-no {
    text-align: center;
    font-size: 16px;
    color: $gray_light;
    font-weight: 500;
    padding-bottom: 10px;
  }
  > h3 {
    color: $primary_dark;
    font-size: 24px;
    font-weight: 500;
    padding-bottom: 10px;
    text-align: center;

    @include breakpoint(max, $sm) {
      font-size: 20px;
    }
  }
  .stlms-quiz-input-ans {
    max-width: 640px;
    margin: 0 auto;
    padding-top: 30px;
  }
  .stlms-quiz-option-list {
    max-width: 320px;
    margin: 0 auto;
    padding-top: 30px;
    > ul {
      display: flex;
      flex-direction: column;
      gap: 20px;
      > li {
        label {
          display: flex;
          align-items: center;
          padding: 10px;
          border-radius: 6px;
          border: 1px solid $gray;
          gap: 10px;
          font-size: 16px;
          color: $gray_light;
          cursor: pointer;
          .stlms-check {
            flex-shrink: 0;
          }
          &:has(.stlms-check:checked) {
            border-color: $primary;
            color: $primary;
          }
          &:has(.stlms-check.invalid) {
            border-color: $red;
            color: $red;
            input[type="checkbox"].stlms-check:checked {
              background-color: $red;
              border-color: $red;
            }
            input[type="radio"].stlms-check:checked {
              background-color: $red;
              border-color: $red;
            }
          }
          &:has(.stlms-check.valid) {
            border-color: $green;
            color: $green;
            input[type="checkbox"].stlms-check:checked {
              background-color: $green;
              border-color: $green;
            }
            input[type="radio"].stlms-check:checked {
              background-color: $green;
              border-color: $green;
            }
          }
        }
      }
    }
  }
}

.sw {
  width: 100%;
  &.sw-theme-basic {
    border: 0;
    > .nav {
      display: none;
    }
  }
  .toolbar {
    &:empty {
      display: none;
    }
  }
}

.stlms-alert {
  max-width: 658px;
  margin: 0 auto;
  padding: 20px 40px;
  border-width: 1px;
  border-style: dashed;
  border-radius: 12px;
  display: flex;
  gap: 20px;
  margin-top: 48px;
  &-icon {
    width: 30px;
    flex-shrink: 0;
  }
  &-text {
    width: 100%;
    font-size: 14px;
    line-height: 1.5;
    color: $primary_dark;
    p {
      margin: 0;
    }
  }
  &-title {
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 12px;
  }
  &.stlms-alert-error {
    background: rgba($red, 0.05);
    border-color: $red;
  }
  &.stlms-alert-success {
    background: rgba($green, 0.05);
    border-color: $green;
  }
}

.stlms-quiz-content {
  padding: 0 20px;
  max-width: 1140px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.5;
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    color: $primary_dark;
    margin: 0;
    line-height: 1.4;
    padding: 8px 0 16px;
    font-weight: 500;
  }
  a {
    color: $primary;
  }
  h1 {
    font-size: 24px;
    font-weight: 600;
  }
  h2 {
    font-size: 22px;
  }
  h3 {
    font-size: 20px;
  }
  h4 {
    font-size: 18px;
  }
  h5 {
    font-size: 16px;
  }
  h6 {
    font-size: 14px;
  }
  p {
    margin: 0;
    padding-bottom: 16px;
  }
  strong {
    font-weight: 500;
    color: $primary_dark;
  }
  ul,
  ol {
    margin: 0;
    padding: 0 0 16px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    li {
      padding-left: 24px;
      position: relative;
    }
  }
  ul {
    li {
      &:before {
        content: "";
        position: absolute;
        left: 0;
        top: 10px;
        width: 6px;
        height: 6px;
        background-color: currentColor;
        border-radius: 100%;
        opacity: 0.5;
      }
    }
  }
  ol {
    counter-reset: my-awesome-counter;
    li {
      counter-increment: my-awesome-counter;
      &:before {
        content: counter(my-awesome-counter) ". ";
        position: absolute;
        left: 0;
        top: 0;
        color: currentColor;
      }
    }
  }
  img {
    display: block;

    &.aligncenter {
      margin: 0 auto;
    }
    &.alignright {
      margin-left: auto;
    }
  }
}

.stlms-quiz-complete {
  max-width: 470px;
  margin: 0 auto;
  text-align: center;
  h3 {
    font-size: 24px;
    font-weight: 600;
    color: $primary_dark;
    padding: 30px 0 8px;
  }
  > p {
    font-size: 16px;
    color: $gray_dark;
    margin: 0;
  }
  .stlms-quiz-result-list {
    display: flex;
    gap: 30px;
    padding-top: 40px;

    @include breakpoint(max, $sm) {
      gap: 8px;
    }
    .stlms-quiz-result-item {
      width: 100%;
      border: 1px solid $gray;
      border-radius: 6px;
      padding: 20px 30px;
      font-size: 16px;
      color: $gray_dark;
      text-align: center;
      display: flex;
      flex-direction: column;
      gap: 10px;

      @include breakpoint(max, $sm) {
        padding: 20px 08px;
        font-size: 14px;
      }
      p {
        margin: 0;
        font-size: 18px;
        color: $primary_dark;
        font-weight: 600;
        @include breakpoint(max, $sm) {
          font-size: 16px;
        }
      }
    }
  }
}

.stlms-lesson-list li.active {
  background: #eaeaea;
}
.stlms-ai-chat {
  &__wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    @include transition(all 0.3s ease-in-out);
  }
  &__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba($black, 0.4);
    z-index: 0;
    @include transition(all 0.2s ease-in-out);
  }
  &__box{
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: absolute;
    right: -420px;
    top: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
    max-width: 420px;
    background: $white;
    border-radius: 5px 0 0 5px;
    @include transition(all 0.3s ease-in-out);
  }
  &__title {
    font-size: $font_size_base;
    font-weight: 700;
    color: $primary_dark;
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    justify-content: space-between;
    background: rgba(9, 27, 221, 0.1);
    &--left {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    &--right {
      flex-shrink: 0;
      button {
        display: flex;
        cursor: pointer;
      }
      .icon-cross {
        color: $gray_light;
      }
    }
  }
  &__text {
    display: flex;
    gap: 8px;
  }
  &__icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    background: #091BDD;
    border-radius: 100%;
    color: $white;
  }
  &__body {
    overflow-y: auto;
    height: 100%;
    ul {
      display: flex;
      flex-direction: column;
      gap: 12px;
      li {
        max-width: 70%;
        padding: 11px 17px;
        border:1px solid #E6E9F0;
        border-radius: 12px;
        font-size: $font_size_sm;
        display: flex;
        flex-direction: column;
        gap: 4px;
      }
    }
  }
  &__message {
    &--bot {
      margin-right: auto;
      background: #F5F7FA;
      color: $primary_dark;
    }
    &--user {
      background: $primary;
      color: $white;
      margin-left: auto;
    }
    &--loader-dots {
      display: inline-block;
      font-size: 30px;
      line-height: 0;
      font-weight: 700;
      letter-spacing: 2px;

      span {
        animation: blink 1.4s infinite;
        animation-fill-mode: both;

        &:nth-child(2) {
          animation-delay: 0.2s;
        }

        &:nth-child(3) {
          animation-delay: 0.4s;
        }
      }
    }
  }
  &__footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    .stlms-ai-chat-send-btn {
      background: $primary;
      color: $white;
      padding: 12px 16px;
      border-radius: 8px;
      display: grid;
      place-items: center;
      width: 48px;
      flex-shrink: 0;
      cursor: pointer;
    }
    .disabled {
      &.stlms-ai-chat-send-btn {
        opacity: 0.6;
        pointer-events: none;
      }
     
    }
    .stlms-ai-chat-form {
      display: flex;
      gap: 8px;
      align-items: flex-end;
    }
    .stlms-ai-chat-input {
      width: 100%;
      padding: 12px 16px 4px;
      border: 1px solid $gray;
      border-radius: 8px;
      font-size: $font_size_sm;
      resize: none;
      height: 60px;
      &:focus {
        border-color: $primary;
        outline: 0;
        box-shadow: none;
      }
    }
  }
  &__info {
    font-size: $font_size_sm;
    color: $gray_light;
    text-align: center;
  }
  &__disclaimer {
    font-size: 12px;
    color: $red;
    text-align: center;
  }
}
.stlms-ai-chat__wrap.active {
  opacity: 1;
  visibility: visible;
  .stlms-ai-chat__box {
    right: 0;
    @include transition(all 0.3s ease-in-out);
  }
}
body.active {
  overflow: hidden;
}

@keyframes blink {
  0%, 80%, 100% {
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
}