@use 'sass:math';

@import 'mobile';
@import 'variables';

@mixin table {
  .table {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    display: table;
    border: 1px solid $border-color;
    border-collapse: collapse;

    .table-row-even {
      display: table-row;
      background: $dark-row-color !important;
    }

    .table-row-odd {
      display: table-row;
      background: $light-row-color !important;
    }
  }

  .table-body {
    display: table-row-group;

    >tr {
      display: table-row;
      background: $dark-row-color;

      >td {
        padding: math.div($ui-margin, 2) math.div($ui-margin, 2);
        display: table-cell;

        &:first-child {
          padding-left: $ui-margin;
        }

        &:last-child {
          padding-right: $ui-margin;
        }
      }

      &:nth-of-type(odd) {
        background: $light-row-color;
      }
    }
  }

  .number {
    text-align: right;
    font-weight: bold;
    font-variant-numeric: tabular-nums;
  }

  .selected {
    background: $selected-row-color !important;
  }

  .tab-bar>button {
    font-size: 15px;
    min-height: 30px;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
    margin-bottom: 0;
    border-bottom: 0;
  }

  tr>td>input {
    margin-right: -40px;

    &:focus {
      outline: 0;
    }
  }

  input {
    font-size: 15px;
    border: none;
    border-bottom: 1px solid hsla(0, 0%, 100%, 0.25);
    background: transparent;
    color: white;
    text-overflow: ellipsis;
    font-family: "fira", sans-serif;
  }

  input[Type="text"] {
    font-family: inherit;
  }

  select {
    background: $dark-row-color;
    font-size: 15px;
    border: 1px solid $border-color;
    color: white;
    text-overflow: ellipsis;
    font-family: "fira", sans-serif;
  }

  .settings-table {
    width: $settings-table-width;

    tr {
      height: 30px;

      td:first-child {
        width: 100%;
      }

      .settings-value-box {
        width: math.div($settings-table-width, 2) - 2*$ui-margin;
        display: grid;
        column-gap: $ui-margin;
        row-gap: $ui-margin;
        grid-template-columns: 100%;

        input {
          height: $settings-row-height;
          box-sizing: border-box;

          &:focus {
            outline: 0;
          }
        }

        select {
          height: $settings-row-height;
          min-width: 80px;
        }

        &.optional-value {
          grid-template-columns: max-content 1fr;
        }

        &.two-colors {
          grid-template-columns: 1fr 45px 45px;
        }

        &.one-color {
          grid-template-columns: 1fr 45px;
        }

        &.removable-string {
          grid-template-columns: 1fr 30px;

          button {
            margin: 0;
            font-size: 12px;
            min-height: $settings-row-height;
            padding-top: 0;
            padding-bottom: 0;
          }
        }
      }
    }

    @include mobile {
      width: 100%;
    }
  }
}
