@import "../../../assets/scss/variables";

:root {
  --row-background: white;
  --column-border: #E6E2E2;
  --disabled-text-color: #cccccc;
  --disabled-status-hover-color: #f8f8f8;
}

:root[data-theme="dark"] {
  --row-background: #20262E;
  --column-border: #2C333B;
  --disabled-text-color: #B3B3B3;
  --disabled-status-hover-color: #20262E;
}

.dua-list {
  $disabled-status-hover-color: var(--disabled-status-hover-color);
  $disabled-text-color: var(--disabled-text-color);
  $row-background: var(--row-background);
  $column-border: var(--column-border);


  &.button-view {
    .list-head {
      display: none !important;
    }

    .list-row {
      border-radius: 6px !important;
      border: none !important;
      flex: 0 0 auto !important;
      height: 100% !important;
      min-height: 153px !important;
      flex-direction: column !important;
      align-items: start !important;
      padding: 6% 27px !important;
box-shadow: none!important;
      .list-column {
        border: none !important;

        img {
          filter: none !important;
        }

        div {
          .label {
            display: none !important;
          }
        }

        flex: none !important;

        .column-border {
          border: none !important;
        }

        .text-column {
          height: auto !important;
          min-height: 16px !important;
        }
      }

      &.has_submitted {
        border: 1px solid #D9D9D9 !important;
        padding-top: 11px !important;
      }
      &.isokay {
        border: 1px solid #D9D9D9 !important;
        padding-top: 11px !important;
      }
      &.isnotokay {
        border: 1px solid #D9D9D9 !important;
        padding-top: 11px !important;

        //&::after {
        //  content: "";
        //  position: absolute;
        //  left: 6% !important;
        //  top: 20px !important;
        //  width: 21px;
        //  height: 21px;
        //  background-image: url('../../../../src/assets/images/den-exei-ipovalei-a1.svg');
        //  background-size: contain;
        //  background-repeat: no-repeat;
        //  background-position: center;
        //}
      }

      &:hover {
        padding: 0 !important;
        height: 100% !important;
        min-height: 153px !important;
        width: 100% !important;

        .list-column {
          height: 100% !important;
          min-height: 153px !important;
          padding: 0 !important;
          width: 100% !important;

          .hover-column {
            display: flex !important;
            height: 100% !important;
            min-height: 153px !important;

          }
        }

        .list-column:not(:has(.hover-column)) {
          display: none;
        }

        &::after {
          display: none;
        }

      }

      &:has(.hover-column.locked) {
        padding: 0 !important;
        height: 100% !important;
        min-height: 153px !important;
        width: 100% !important;

        .list-column {
          height: 100% !important;
          min-height: 153px !important;
          padding: 0 !important;
          width: 100% !important;

          .hover-column {
            display: flex !important;
            height: 100% !important;
              min-height: 153px !important;
          }
        }

        .list-column:not(:has(.hover-column)) {
          display: none;
        }

        &::after {
          display: none;
        }
      }

    }

  }

  .list-row {
    width: 100%;
    display: flex;
    position: relative;
    min-height: 50px;
    box-shadow: 0 3px 6px $main-box-shadow;
    border: 1px solid $list-border;
    background-color: $row-background;


    &:hover {
      background: $list-hover;

      &.cancelled {
        .status-column b {
          background-color: $disabled-status-hover-color !important;
        }
      }
    }

    /***
    STATUS COLORING
     */
    &::after {
      content: "";
      width: 2px;
      height: calc(100% + 1px);
      position: absolute;
      left: -1px;
      top: 50%;
      transform: translateY(-50%);
    }

    &.pending:after {
      background-color: $status-pending;
    }

    &.warning:after {
      background-color: $status-warning;
    }

    &.completed:after {
      background-color: $status-completed;
    }

    &.inactive:after {
      background-color: $status-inactive;
    }

    &.success:after {
      background-color: $status-success;
    }

    &.critical:after {
      background-color: $status-critical;
    }

    &.error:after {
      background-color: $error-color;
    }

     &.submitted:after {
      background-color: #61C765;
    }

    &.error:after {
      background-color: $error-color;
    }

    &.success_completed:after {
      background: $status-completed;
      background: linear-gradient(180deg, $status-completed 50%, $status-success 50%);
    }

    &.cancelled {
      &::after {
        background-color: $inactive-color !important;
      }

      .status-column b {
        background-color: $grayish-box-background !important;
        color: $disabled-text-color !important;
        border: transparent !important;

      }

      .list-column-generic {
        .text-column {
          color: $disabled-text-color !important;
        }

        .indication-column--text-div {
          color: $disabled-text-color !important;
        }
      }
    }


    &.hasAttention {
      border-top: 1.7px solid var(--attention-color, $attention-color) !important;
      border-left: 1.7px solid var(--attention-color, $attention-color) !important;
      border-bottom: 1.7px solid var(--attention-color, $attention-color) !important;
      border-right: 1.7px solid var(--attention-color, $attention-color) !important;


    }

    &.hasBackground {
      border: none !important;

      &::before {
        content: '';
        position: absolute;
        top: -5px;
        left: -2px;
        z-index: 99;
        width: 0;
        transform: rotate(45deg);
        height: 0;
        border-top: 6px solid transparent !important;
        border-bottom: 6px solid transparent !important;
        border-right: 6px solid transparent !important;
      }

      &:after {
        background-color: transparent !important;
      }

      .status-column b {
        background-color: $grayish-box-background !important;
        color: $text-color !important;
        border: transparent !important;

      }

      .list-column-generic {
        .text-column {
          color: var(--text-color) !important;
        }

        .indication-column--text-div {
          color: var(--text-color) !important;
        }
      }

      .list-actions {

      }
    }

    &.hasTriangle {
      &::before {
        content: '';
        position: absolute;
        top: -5px;
        left: -2px;
        z-index: 99;
        width: 0;
        transform: rotate(45deg);
        height: 0;
        border-top: 6px solid transparent;
        border-bottom: 6px solid transparent;
        border-right: 6px solid var(--triangle-color, $attention-color);
      }
    }

    /***
    LIST ACTIONS
     */
    .list-actions {
      position: absolute;
      right: 0.4vw;
      padding-bottom: 3px;
      cursor: pointer;

      &--toggle {
        img {
          filter: $svg-default;
        }

      }

      &.empty {
        pointer-events: none;

        img {
          filter: invert(68%) sepia(76%) saturate(0%) hue-rotate(201deg) brightness(100%) contrast(102%);
        }
      }

      &--dropdown {
        text-align: left;
        position: absolute;
        left: auto;
        top: -14px;
        right: -10px;
        z-index: 999999;
        min-width: 305px;
        width: max-content;
        //border: 1px solid #D9D9D9;
        padding: 50px 15px 15px;
        background-color: $dropdown-color;
        box-shadow: 0px 3px 6px #00000029;
        color: $text-color;
        font-size: 1.4rem;
        line-height: 2.7rem;

        &.bottom-position {
          top: unset;
          bottom: 0;
        }

        & img.close-btn {
          position: absolute;
          left: 20px;
          top: 17px;
          cursor: pointer;
          filter: $svg-default;
        }

        a {
          transition: none;
          color: inherit;
        }

        ul {
          padding: 0;
          margin: 0;
          margin-left: -15px;

          li {
            color: $text-color;
            position: relative;
            font-size: 1.2rem;
            font-weight: 500;
            display: flex;
            align-items: center;
            height: 36px;
            padding-left: 35px;

            &:before {
              left: 23px;
              position: absolute;
              content: "";
              height: 100%;
              width: 6px;
              background-repeat: no-repeat;
              background: url('../../../assets/images/right-chevron.svg');
              background-position: center 14px;
              background-repeat: no-repeat;
              filter: $svg-default;
            }

            &:hover {
              background: #0D60C8;
              color: $white;

              &:before {
                filter: brightness(0) saturate(100%) invert(100%) sepia(97%) saturate(12%) hue-rotate(236deg) brightness(103%) contrast(100%);
              }
            }
          }
        }

      }
    }


  }

  &.card-view .list-row:after {
    height: 2px;
    width: calc(100% + 1px);
    top: 0;
  }

  &.card-view .list-row {
    flex-direction: column;
  }

  &.list-view .list-row {
    align-items: center;
    padding: 0 1.5vw 0 0.2vw;
    flex-direction: row;
    max-width: unset;
  }

  /***
   LAYOUT FOR COLUMNS  GOES HERE
  */
  &.list-view {
    .list-column {
      /**
    remove border from first item
    */
      &:first-of-type .column-border:first-of-type {
        border-left: none;
      }

      .label {
        display: none;
      }

      .icon-column {
        div {
          display: none;
        }
      }

      .popup-column {
        .hover-func:has(.popupindicator) .text {
          position: relative;
          right: 42%;
          transform: translateX(50%);
        }

        .popupindicator {
          position: absolute;
          left: 0;
        }
      }

      & > div {

        display: flex;
        align-items: center;
        justify-content: center;

      }


      .column-border {

        border-left: 1px dashed $column-border;
      }
    }
  }

  &.card-view {

    .list-column {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      flex: 0 0 80px !important;

      & > div {
        padding: 0 2vw 0 2vw;
        display: flex;
        align-items: flex-start;
        flex-direction: column;

        .label {
          display: flex;
          color: #ccc;
          font-size: 10px;
          font-weight: 700;
          margin-right: 10px;
          line-height: 15px;
        }
      }

      &:not(:last-of-type) {
        border: unset;
        border-bottom: 1px dashed #D9D9D9;
      }

      &.list-column-button {
        justify-content: center !important;
      }

      .status-column {
        display: flex;
        width: 100%;
        flex-direction: row !important;
        align-items: center !important;
      }

      .popup-column {
        .hover-func {
          flex-direction: row;
          justify-content: start;
        }

        .popupindicator {
          position: relative;
          left: 0;
        }
      }
      .text-column{
        .ellipsis{
          width: 100%;
        }
      }

    }

  }

  /***
    LIST ACTIONS POSITION FIX FOR CARDS
   */
  &.card-view .list-actions {

    top: 5px;
    right: 5px;

    &--dropdown {
      top: -6px;
      right: -6px;
    }
  }

}

.dua-list .list-head {

  display: flex;
  padding: 0 30px 0 0vw;
  position: relative;
  height: 24px;
  margin-bottom: 10px;

  .list-head-col {
    padding: 0 0.35vw;
    font-size: 10px;
    font-weight: bold;
    color: #ccc;
    margin: 0;

    &.orderable {
      cursor: pointer;
    }

    .order {
      display: inline-flex;
      flex-direction: column;
      gap: 3px;
      margin-left: 3px;
      padding-top: 2px;
      transform: translateY(-5px);

      .up {
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-bottom: 4px solid #C0C0C0;

        &.active {
          border-bottom-color: $main-color;
        }
      }

      .down {
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 4px solid #C0C0C0;

        &.active {
          border-top-color: $main-color;
        }
      }
    }

    .entity {
      display: flex;
      color: #ccc;
      font-size: 10px;
      font-weight: 700;
      margin-right: 10px;
      line-height: 15px;
    }
  }

  .change-view {
    visibility: visible;

    &.display {
      visibility: visible;
    }

    &.moveup {
      bottom: 100px !important;

    }

    position: absolute;
    right: 10px;
    bottom: 38px;

    button {
      &.active {
        svg {
          color: $secondary-color;
        }
      }

      &:disabled {
        pointer-events: none;
      }
    }

    button:first-child {
      margin-right: 10px;
    }
  }

  .download-csv {
    cursor: pointer;
    position: absolute;
    right: 75px;
    bottom: 38px;

    &.moveup {
      bottom: 100px !important;

    }

    @media(max-width: 500px) {
      right: unset;
      bottom: 18px;
      left: 40px;
    }

  }

  .download-xlsx {
    cursor: pointer;
    position: absolute;
    right: 115px;
    bottom: 38px;

    &.moveup {
      bottom: 100px !important;

    }

    @media(max-width: 500px) {
      right: unset;
      bottom: 18px;
    }

  }
}



