body {
  margin: 0;
  font-family: "Inter", sans-serif;
}
.sql__container {
  width: 100%;
  height: 100%;
  display: flex;
  min-height: 100vh;
}
.sql__box {
  background-color: #e7ebf3;
  overflow: hidden;
  overflow-y: auto;
  section {
    padding: 1rem;
  }
}
.sql__table {
  width: 0;
  form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    gap: 0.5rem;
    section {
      background-color: white;
      border-radius: 8px;
      padding-right: 1rem;

      .sql__table__header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 4px;
        label {
          span {
            display: block;
            font-size: 14px;
          }
          input {
            padding: 4px 8px;
            border: 1px solid #c7d7ff;
            border-radius: 4px;
            font-size: 16px;
          }
        }
      }
      .table__container {
        position: relative;
        display: block;
        width: 100%;
        overflow: auto;
        padding: 1px;
        padding-top: 0;
        border-radius: 6px;
        border: 1px solid #c7d7ff;
        padding-top: 0;
        max-height: 60vh;
        overflow-x: auto;

        &::-webkit-scrollbar {
          width: 10px;
          background-color: #fff;
        }
        &::-webkit-scrollbar-track {
          -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.119);
          background-color: #fff;
        }
        &::-webkit-scrollbar-thumb {
          background-color: #c7d7ff;
          border: 1px solid #a2a3aac9;
          border-radius: 10px;
        }
        table {
          width: 100%;
          min-width: 600px;
          border-collapse: collapse;
          border-style: hidden;
          overflow: scroll;
          border-top-left-radius: 6px;
          border-top-right-radius: 6px;
          box-shadow: 0 0 0 1px #c9ddfb;
          thead {
            position: sticky;
            top: 0;
            z-index: 9;
            background-color: #fff;

            th {
              font-weight: 500;
              font-size: 12px;
              line-height: 16px;
              background: rgba(134, 182, 255, 0.16);
              border-color: #c7d7ff;
              padding: 12px 5px;
              box-shadow: inset 0.5px 0.5px 0 #fff, inset 0.5px -0.5px 0 #fff;
            }
          }
          tbody {
            tr {
              td {
                border: 1px solid #e2e2e2;
                padding: 0 2px;

                &:first-child {
                  width: 40px;
                  padding: 0 4px;
                  font-size: 12px;
                  opacity: 0.5;
                }

                &:has(select) {
                  width: 250px;
                }

                &:has(input[type="text"]) {
                  width: 150px;
                }
                &:has(input[type="radio"]),
                &:has(input[type="checkbox"]) {
                  width: 50px;
                }
                input,
                select {
                  width: 100%;
                  border: none;
                  padding: 4px 8px;
                  &:focus {
                    background-color: #c9ddfb;
                  }
                }
                &:focus {
                  background-color: #dee2e6;
                }

                div {
                  display: flex;
                  width: 100%;
                  justify-content: center;
                  gap: 4px;
                  button {
                    padding: 2px 4px;
                    border: none;
                    color: #fff;

                    font-size: 12px;
                    border-radius: 4px;

                    &:disabled {
                      opacity: 0.5;
                    }

                    &:hover {
                      cursor: pointer;
                    }
                    &:first-child:hover {
                      background-color: #dc3545;
                    }
                    &:first-child {
                      background-color: #f75262;
                      color: white;
                    }
                    &:nth-child(2) {
                      background-color: #ffc107;
                      color: black;
                    }
                  }
                }
              }
              &:nth-child(2n-1) {
                background-color: #fff;
                input,
                select {
                  background-color: transparent;
                }
              }
              &:nth-child(2n) {
                background-color: #f4f9ff;
                input,
                select {
                  background-color: transparent;
                }
              }
              &.active__changed {
                background-color: #c9ddfb;
              }

              &:hover {
                background-color: #c9ddfb;
              }
            }
          }
        }
      }

      .sql__code__header {
        display: flex;
        justify-content: flex-end;
        align-items: center;
      }
      &:nth-child(2) {
        font-size: 10px;
        overflow: auto;
      }
    }
  }
}
.sql__cards {
  width: 100%;
  box-shadow: rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;
  .btn__back {
    border: none;
    outline: none;
    box-shadow: none;
    border-radius: 4px;
    background-color: #335d99;
    color: white;
    cursor: pointer;
    padding: 8px 12px;
    margin-bottom: 4px;
    &:hover {
      background-color: #5383c5;
    }
  }
  .btn__primary {
    border: none;
    outline: none;
    box-shadow: none;
    border-radius: 4px;
    background-color: #335d99;
    color: white;
    padding: 8px 12px;
    width: 150px;
    &:hover {
      background-color: #5383c5;
    }
  }
  .card__list {
    padding: 0.5rem;
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: start;
    gap: 1rem;
    flex-wrap: wrap;

    .table__card {
      width: calc(33% - 0.5rem);
      cursor: pointer;
      padding: 0.5rem 0.75rem;
      background-color: white;
      box-shadow: rgba(0, 0, 0, 0.02) 0px 1px 3px 0px, rgba(27, 31, 35, 0.15) 0px 0px 0px 1px;
      border-radius: 4px;

      &:hover {
        background-color: rgba(255, 255, 255, 0.2);
      }
      .card__title {
        font-size: 24px;
        font-weight: 600;
        margin-bottom: 0.5rem;
        .drop__btns {
          display: none;
        }
      }
      .card__body {
        display: flex;
        justify-content: flex-start;
        align-items: start;
        flex-wrap: wrap;
        gap: 4px;
        width: 100%;
        height: 100%;
        .card__badge {
          margin: 0.1rem;
          line-height: 1.8;
          font-size: 12px;
          padding: 0 0.6rem;
          background: #4ad0ff;
          color: rgba(0, 0, 0, 0.87);
          font-weight: 600;
          border-radius: 8px;
          span {
            font-weight: 500;
          }
        }
      }
    }
  }
}

.sql__container.active {
  .sql__table {
    width: 100%;
    overflow-x: auto;
    padding: 1rem;
  }
  .sql__cards {
    width: 300px;
    background-color: white;
    .btn__primary {
      width: 100%;
    }
    .card__list {
      gap: 6px;
      padding: 0;
      margin: 0;
      flex-direction: column;
      margin-top: 0.5rem;

      .table__card {
        padding: 4px 6px;
        width: 100%;

        &:hover {
          background-color: rgba(0, 0, 255, 0.04);
          .drop__btns {
            display: flex;
            gap: 2px;

            button {
              cursor: pointer;
              background-color: #d9534f;
              border-radius: 4px;
              padding: 3px 4px;
              border: none;
              position: relative;

              .tooltiptext {
                visibility: hidden;
                background-color: rgb(52, 49, 49);
                color: #fff;
                text-align: center;
                padding: 2px 4px;
                border-radius: 6px;
                position: absolute;
                font-size: 10px;
                z-index: 1;
                bottom: 100%;

                margin-left: -50%;
              }

              &:hover .tooltiptext {
                visibility: visible;
              }
            }
          }
        }

        .card__title {
          font-size: 14px;
          margin: 0;
          font-weight: 500;
          user-select: none;
          display: flex;
          justify-content: space-between;
          span::before {
            content: "\2637";
            color: #000;
            margin-right: 8px;
          }
        }
        .card__body {
          width: 0;
          height: 0;
          overflow: hidden;
          font-size: 0;
          .card__badge {
            font-size: 0;
            padding: 0;
            height: 0;
          }
        }
      }
    }
  }
}

.btn__groups {
  display: flex;
  justify-content: flex-start;
  align-items: stretch;
  gap: 1rem;
}
.sql__btn {
  cursor: pointer;
  font-weight: 400;
  text-align: center;
  white-space: nowrap;
  user-select: none;
  border: 1px solid transparent;
  padding: 0.375rem 0.75rem;
  font-size: 12px;
  border-radius: 0.25rem;
  &:disabled {
    opacity: 0.5;
  }
}

.sql__primary {
  color: #fff;
  background-color: #335d99;
  border-color: #335d99;
}
.sql__success {
  color: #fff;
  background-color: #28a745;
  border-color: #28a745;
}
.sql__danger {
  color: #fff;
  background-color: #dc3545;
  border-color: #dc3545;
}
