/**
 * Shared building blocks reused across user-picker widgets:
 * - .user-card         a single user's name + email + profile link
 * - .details-always-open   a <details> wrapper forced open (no collapse)
 */
.user-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  flex: 1;
}

.user-card__name {
  font-weight: 600;
}

.user-card__email {
  color: #55565b;
  overflow-wrap: anywhere;
}

.user-card__roles,
.user-card__status {
  color: #55565b;
}

.user-card__link {
  color: #0036b3;
  font-size: 12px;
}

.user-card__link:hover {
  text-decoration: none;
}

.user-details {
  display: flex;
  gap: 12px;
  font-size: 14px;
}

.item-container {
  .user-card__name,
  .user-card__email,
  .user-card__roles {
    font-size: 14px;
  }
}

/**
 * User selection — checkboxes widget (company-scoped content types,
 * field_users limited to the parent company's users).
 */
.field--name-field-users {
  .form-type--checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    background: #f1f4f9;
    border-radius: 4px;
    margin: 0 0 10px 0 !important;
  }

  .form-type--checkbox input {
    margin-top: 3px;
    flex-shrink: 0;
  }

  .form-type--checkbox:hover {
    background: #e6ecf5;
  }

  .form-type--checkbox .form-checkbox {
    margin: 0;
  }

  .option.form-item__label {
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    min-width: 0;
  }
}

/**
 * User selection — Entity Browser widget (company form, field_users).
 */
.details-always-open > summary::marker,
.details-always-open > summary::-webkit-details-marker {
  display: none;
}

input[name^="field_users_entity_browser"] {
  background: #0036b3;
  border: 1px solid #0036b3;
  border-radius: 4px;
  color: #fff;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

input[name^="field_users_entity_browser"]:hover {
  color: #fff;
  background: #002a8c;
  border-color: #002a8c;
}

.entities-list.entity-type--user {
  .item-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    background: #f1f4f9;
    border-radius: 4px;
    margin: 0 0 10px 0;
    overflow: hidden;
  }

  .item-container:hover {
    background: #e6ecf5;
  }

  .item-container:last-child {
    margin: 0;
  }

  .remove-button {
    padding: 4px 12px;
    font-size: 12px;
    background: #fff;
    border: 1px solid #c00;
    border-radius: 3px;
    color: #c00;
    cursor: pointer;
    margin: 0;
  }

  .remove-button:hover {
    background: #c00;
    color: #fff;
  }
}

@media (max-width: 600px) {
  .entities-list.entity-type--user {
    .item-container {
      flex-direction: column;
      align-items: flex-start;
      min-width: 0;
    }

    .remove-button {
      margin-top: 8px;
      align-self: flex-start;
    }
  }
}

/**
 * Files selection.
 */
.field--type-file {
  .tabledrag-toggle-weight-wrapper,
  .table-file-multiple-widget th {
    display: none;
  }

  .table-file-multiple-widget tr {
    background: #f1f4f9;
    border-radius: 4px;
  }

  .table-file-multiple-widget td {
    padding-bottom: var(--space-xs);
    padding-block: var(--space-xs);
  }

  .table-file-multiple-widget tr:hover {
    background: #e6ecf5;
  }

  .table-file-multiple-widget .remove-button {
    background: #fff;
    border: 1px solid #c00;
    border-radius: 3px;
    color: #c00;
    cursor: pointer;
    padding: 4px 12px;
    margin-top: 4px !important;
  }

  .table-file-multiple-widget .remove-button:hover {
    background: #c00;
    color: #fff;
  }
}
