/* The outbound connections tab: what this practice reaches out to.
   Sized to match the other two credential pages, which share service_accounts.css. */

/* The table wrapper pads itself by 1px for a table's outline. There is no table here, so
   the margin takes that back and the text lines up with the rest of the page. */
.outbound-connections--empty {
  max-width: 44rem;
  margin: -1px;
}

.outbound-connections--form {
  max-width: 34rem;
  margin-top: 1.5rem;

  label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: var(--rem-13);
    color: var(--neutral-600);
  }

  input[type="url"] {
    margin-bottom: 1.5rem;
  }
}

/* The shared table gives its six columns the same width, which cuts the two buttons in
   the last one. That column gets the width the buttons need, and the text columns share
   the rest, each cut with an ellipsis as in every other table. */
.outbound-connections--table {
  th:last-child {
    width: 16.5rem;
  }
}

/* Two buttons in a table cell, which `button_to` would otherwise stack as two forms. */
.outbound-connections--row-actions {
  display: flex;
  flex-direction: row;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* The last failure stays on the page rather than passing by in a flash: whoever wonders
   why the connection stopped is usually not whoever was there when it did. */
.outbound-connections--last-error {
  max-width: 44rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  background-color: var(--danger-100, var(--neutral-100));
  color: var(--neutral-900);
  font-size: var(--rem-13);
}

.outbound-connections--note {
  max-width: 44rem;
  margin-top: 1rem;
  color: var(--neutral-600);
  font-size: var(--rem-13);
}

/* Below this the text columns have no room left beside two buttons, so the buttons
   stack and their column narrows to one of them. */
@media (max-width: 70rem) {
  .outbound-connections--table th:last-child {
    width: 9.5rem;
  }

  .outbound-connections--row-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;

    button {
      width: 100%;
    }
  }
}

/* On a phone six columns cannot fit, so the row becomes a list: each value under its
   own heading, which the cell carries in data-label, and the buttons last. */
@media (max-width: 40rem) {
  .outbound-connections--table {
    thead {
      display: none;
    }

    tr {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.75rem 1rem;
      padding: 1rem;
    }

    tbody > tr > td:nth-child(n) {
      padding: 0;
      box-shadow: none;
      white-space: normal;
      text-wrap: wrap;
      overflow-wrap: anywhere;
    }

    td[data-label]::before {
      content: attr(data-label);
      display: block;
      color: var(--text-label);
      font-size: var(--rem-13);
    }

    td[data-type="actions"] {
      grid-column: 1 / -1;
    }
  }
}
