/* "Korisnici" (admin-users.js): the same table and form language as the documents above (admin.css). The add form is
   a boxed block like "Dodaj dokument"; a row opens its editor in place. The one thing that stands out is the one-time
   password: large, cyan, spaced in its three groups, because someone reads it out or copies it by hand.
   AAA as in style.css: text on navy / navy-2 uses mist, slate, cyan, gold or danger only. */

#users-section .section-head-row {
  align-items: flex-end;
}

#users-seats {
  margin-top: 6px;
}

#groups-without-members {
  border-left-color: var(--gold);
  color: var(--mist);
  max-width: 68ch;
}

.user-form h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.user-form .admin-hint {
  margin-bottom: 20px;
}

#user-add {
  margin-bottom: 32px;
}

.user-form-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 16px;
}

.user-groups {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.user-groups legend {
  padding: 0;
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--mist);
}

.user-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 24px;
}

.user-group-list .admin-hint {
  margin: 0;
}

.user-form .error-box {
  margin: 12px 0 0;
  max-width: 68ch;
}

.user-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

/* Reset and deactivate are not part of saving the form: set apart below it. */
.user-more {
  padding-top: 20px;
  border-top: 1px solid var(--navy-line);
}

.danger-btn {
  color: var(--danger);
  border-color: var(--danger);
}

.danger-btn:hover {
  border-color: var(--danger);
}

/* The table: the person's name, the login under it, the admin mark under that. */
.user-name-cell,
.user-login,
.user-role {
  display: block;
}

.user-login {
  font-size: 14px;
  color: var(--slate);
  overflow-wrap: anywhere;
}

.user-role {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--cyan);
}

.user-email {
  overflow-wrap: anywhere;
}

#users-table td.user-actions {
  text-align: right;
  white-space: nowrap;
}

.user-inactive td,
.user-inactive .user-name-cell {
  color: var(--slate);
}

.doc-table tr.user-editor td,
.doc-table tbody tr.user-editor:hover td {
  padding: 24px;
  background: var(--navy-2);
}

/* The one-time password dialog. */
.password-dialog {
  width: min(32rem, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid var(--field-line);
  border-radius: 16px;
  background: var(--navy-2);
  color: var(--mist);
  box-shadow: var(--shadow-window);
}

.password-dialog::backdrop {
  background: rgb(11 19 27 / 0.8);
}

.password-dialog h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
}

.password-dialog .admin-hint {
  margin-top: 6px;
}

.password-label {
  margin: 20px 0 4px;
  font-size: 14px;
  font-weight: 500;
  color: var(--slate);
}

.password-username {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.password-value {
  margin: 0;
  font-size: clamp(1.75rem, 7vw, 2.25rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--cyan);
  user-select: all;
  -webkit-user-select: all;
  overflow-wrap: anywhere;
}

.password-once {
  margin: 16px 0 0;
  font-weight: 600;
  color: var(--gold);
}

@media (max-width: 860px) {
  .user-form-fields {
    grid-template-columns: 1fr;
  }
}

/* On a phone a user is a short stack, not a row to scroll sideways: the editor then fits the screen. */
@media (max-width: 640px) {
  #users-table {
    min-width: 0;
  }
  #users-table thead {
    display: none;
  }
  #users-table tr,
  #users-table td {
    display: block;
  }
  #users-table td {
    padding: 4px 0;
    border-bottom: 0;
  }
  #users-table tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--navy-line);
  }
  #users-table td.user-actions {
    text-align: left;
    padding-top: 8px;
  }
  .doc-table tr.user-editor td,
  .doc-table tbody tr.user-editor:hover td {
    padding: 20px 16px;
  }
  .password-dialog {
    padding: 20px 16px;
  }
}
