@import "../roots/color-map";

.table {
  width: 100%;
  border-collapse: collapse;

  & thead {
    background-color: $dark;

    & th {
      color: white;
      text-align: center;
      padding: 1rem;
      border: 1px solid $silver;
    }
  }
  & tr {
    border: 1px solid $silver;
    padding: 0.5rem;
  }

  & tbody {
    tr {
      &:nth-child(even) {
        background-color: #ececec;
      }

      &:hover {
        background-color: #f8f8f8;
      }

      & td {
        text-align: center;
        padding: 0.5rem;
        border: 1px solid $silver;
      }
    }
  }
}

// TABLE-2
table.table-2 {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;

  &.scroll-x {
    overflow-x: auto;
    overflow-y: hidden;
  }

  &.scroll-y {
    overflow-x: hidden;
    overflow-y: auto;
  }

  &.scroll-x.scroll-y {
    overflow-x: auto;
    overflow-y: auto;
  }

  th {
    background: #eeeeee;
    color: #333;
    padding: 1rem 1.5rem;
    text-align: center;
    text-transform: uppercase;

    &:last-child {
      border-right: none;
    }
  }

  td {
    padding: 16px 20px;
    color: #2d3436;
    vertical-align: middle;
    transition: background 0.3s ease;

    &:last-child {
      border-right: none;
    }
  }

  &.border-all {
    th {
      border-top: 1px solid #ccc;
    }
    td,
    th {
      border-right: 1px solid #ccc;
      border-bottom: 1px solid #ccc;

      &:first-child {
        border-left: 1px solid #ccc;
      }
      &:last-child {
        border-right: 1px solid #ccc;
      }
    }

    tr {
      &:last-child td {
        border-bottom: 1px solid #ccc;
      }
    }
  }

  tr {
    overflow: hidden;
    transition: background 0.3s ease;

    &:last-child td {
      border-bottom: none;
    }

    &:nth-child(even) {
      background: #f7f9fc;
    }

    &:hover:not(:first-child) {
      background: #e8ecef;
    }
  }

  &.scale-1 {
    tr {
      &:nth-child(even) {
        transition: transform 0.2s ease, background 0.3s ease;

        &:hover:not(:first-child) {
          background: #e8ecef;
          transform: scale(1.01);
        }
      }
    }
  }

  &::-webkit-scrollbar {
    height: 12px;
    width: 12px;
  }

  &::-webkit-scrollbar-track {
    background: #ecf0f1;
    border-radius: 6px;
    box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
  }

  &::-webkit-scrollbar-thumb {
    background: #34495e;
    border-radius: 6px;
    background: linear-gradient(45deg, #34495e, #5d788f);

    &:hover {
      background: linear-gradient(45deg, #2c3e50, #4b6580);
    }

    &:active {
      background: #2c3e50;
    }
  }

  @media (max-width: 768px) {
    display: block;
    -webkit-overflow-scrolling: touch;

    &.scroll-x {
      white-space: nowrap;
    }

    th,
    td {
      padding: 12px;
      font-size: 0.9em;
    }
  }
}
